public override bool TryGetLogger(out Common.ILogging logger) { if (IsReady.Equals(false)) { return(base.TryGetLogger(out logger)); } try { //Set the logger logger = RtpClient.Logger; return(true); } catch { logger = null; return(false); } finally { // } }
//It is completely possible to allow another thread here, such a thread would be soley responsible for issuing the data to the handlers of the RtpClient's events and would provide better performance in some cases. //It's also possible to Multicast the source resulting in the network handling the aggregation (See Sink) #endregion #region Unused [Example of how an implementation would begin to propagate the realization that may have to actually do some type of work] //Asked by a user here how they would save a rtsp stream to disk.... //RtpTools, MediaFileWriter, FFMPEG, Media Foundation................................................................ //http://stackoverflow.com/questions/37285323/how-to-record-a-rtsp-stream-to-disk-using-net7mma //System.Drawing.Image m_lastDecodedFrame; //internal virtual void DecodeFrame(Rtp.RtpClient sender, Rtp.RtpFrame frame) //{ // if (RtpClient == null || RtpClient != sender) return; // try // { // //Get the MediaDescription (by ssrc so dynamic payload types don't conflict // Media.Sdp.MediaDescription mediaDescription = RtpClient.GetContextBySourceId(frame.SynchronizationSourceIdentifier).MediaDescription; // if (mediaDescription.MediaType == Sdp.MediaType.audio) // { // //Could have generic byte[] handlers OnAudioData OnVideoData OnEtc // //throw new NotImplementedException(); // } // else if (mediaDescription.MediaType == Sdp.MediaType.video) // { // if (mediaDescription.MediaFormat == 26) // { // OnFrameDecoded(m_lastDecodedFrame = (new RFC2435Stream.RFC2435Frame(frame)).ToImage()); // } // else if (mediaDescription.MediaFormat >= 96 && mediaDescription.MediaFormat < 128) // { // //Dynamic.. // //throw new NotImplementedException(); // } // else // { // //0 - 95 || >= 128 // //throw new NotImplementedException(); // } // } // } // catch // { // return; // } //} #endregion #endregion #region ILoggingReference public override bool TrySetLogger(Common.ILogging logger) { if (IsReady.Equals(false)) { return(false); } try { //Set the logger RtpClient.Logger = logger; return(true); } catch { return(false); } finally { // } }