public void Start(Peer peer, uint publisherId, FlowWriter controller) { if (PublisherId != 0) { if (controller != null) { controller.WriteStatusResponse("Publish.BadName", Name + "is already published"); } } PublisherId = publisherId; //string error; //if (!peer.OnPublish(this, out error)) //{ // if (String.IsNullOrEmpty(error)) error = "Not allowed to publish " + Name; //} _publisher = peer; _controller = controller; _firstKeyFrame = false; foreach (var baseOutStream in OutStreams.OfType <IOutNetStream>()) { baseOutStream.SendPublishNotify(); } if (controller != null) { controller.WriteStatusResponse("Publish.Start", Name + "is now published"); } }
public override bool Stop() { if (PublisherId == 0) { return(true); } foreach (var baseOutStream in OutStreams.OfType <IOutNetStream>()) { baseOutStream.SendUnpublishNotify(); } _controller.WriteStatusResponse("Unpublish.Success", Name + " is now unpublished"); Flush(); PublisherId = 0; _publisher = null; return(true); }