protected void UpdateRemoteCameraStatus(VideoThreadData videoThreadData) { var decoder = videoThreadData.Decoder; var validator = videoThreadData.Validator; if (decoder.IsReceivingData != validator.IsCameraWorking) { validator.IsCameraWorking = decoder.IsReceivingData; if (RemoteCameraChanged != null) { RemoteCameraChanged(this, new RemoteCameraChangedEventArgs(videoThreadData.SsrcId, validator.IsCameraWorking)); } } }
/// <summary> /// Registers a media stream source listener for a given ssrcId. /// </summary> /// <param name="ssrcId">The ssrcId of the media stream source for which it should be listening.</param> /// <remarks> /// This method is called when the main client is notified (via the web service) that a new user has joined the room. /// This method tells the media controller to be prepared for video data tagged for the specified SsrcId /// to start coming down the pipe. /// </remarks> public virtual void RegisterRemoteSession(ushort ssrcId) { VideoThreadData videoThreadData; lock (RemoteSessions) { if (RemoteSessions.ContainsKey(ssrcId)) { ClientLogger.Debug("A remote session for ssrcId {0} already exists.", ssrcId); return; } ClientLogger.Debug("Registering remote session for ssrcId {0}", ssrcId); videoThreadData = new VideoThreadData(ssrcId, _codecFactory.GetVideoDecoder(VideoQualityController)); videoThreadData.Validator.Timer = new Timer(timerCheckingRemoteCameras_Tick, ssrcId, VideoConstants.RemoteCameraCheckDelay, VideoConstants.RemoteCameraTimeout); RemoteSessions.Add(ssrcId, videoThreadData); _videoEncoder.Synchronize(); _mediaEnvironment.RemoteSessions = RemoteSessions.Count; } var decoderThread = new Thread(ProcessVideoQueue); decoderThread.Start(videoThreadData); }