public ClientStream AddClient(ClientConnection client) { ClientStream stream = new ClientStream(client, Encoder); Task.Run(() => { stream.Run().Wait(); stream.Stop(); CurrentStreams.Remove(stream); StreamStopped?.Invoke(this, new StreamStoppedEventArgs(stream)); if (!CurrentStreams.Any()) { Source.StopCapture(); } }); if (!CurrentStreams.Any()) { Source.StartCapture(); } CurrentStreams.Add(stream); StreamStarted?.Invoke(this, new StreamStartedEventArgs(stream)); return(stream); }
public StreamStartedEventArgs(ClientStream stream) { Stream = stream; }