[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu Aug 26 11:54:05 CDT 2010


branch "master" has been updated
       via  d73762f3cc7eb13b5441a37e889cead9064d0888 (commit)
      from  c34444cbf9e8d293c5a4053a8a51c8fcf1f6b5bc (commit)

Summary of changes:
 src/RTPSource.cpp |   35 +++++++++++++++++++----------------
 1 files changed, 19 insertions(+), 16 deletions(-)


- Log -----------------------------------------------------------------
commit d73762f3cc7eb13b5441a37e889cead9064d0888
Author: Joshua Colp <jcolp at digium.com>
Date:   Thu Aug 26 14:06:04 2010 -0300

    Only write frames out to a sink if a sink is actually present.

diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 8c371c1..ead38fc 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -160,29 +160,32 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 		return;
 	}
 
-	FormatPtr mediaformat = source->mImpl->mSession->getFormat(header->pt);
+	if (source->mImpl->mSink != 0)
+	{
+	   FormatPtr mediaformat = source->mImpl->mSession->getFormat(header->pt);
 
-	FrameSeq frames;
+	   FrameSeq frames;
 
-	AudioFormatPtr audioformat;
+	   AudioFormatPtr audioformat;
 
-	if ((audioformat = AudioFormatPtr::dynamicCast(mediaformat)))
-	{
-		AudioFramePtr frame = new AudioFrame();
-		frame->mediaformat = mediaformat;
+	   if ((audioformat = AudioFormatPtr::dynamicCast(mediaformat)))
+	   {
+	      AudioFramePtr frame = new AudioFrame();
+	      frame->mediaformat = mediaformat;
 
-		/* Populate the common data */
-		frame->timestamp = header->ts;
-		frame->seqno = header->seq;
+	      /* Populate the common data */
+	      frame->timestamp = header->ts;
+	      frame->seqno = header->seq;
 
-		/* Copy the payload from the RTP packet to the frame, yahoo! */
-		copy(payload, payload + payload_size, std::back_inserter(frame->payload));
+	      /* Copy the payload from the RTP packet to the frame, yahoo! */
+	      copy(payload, payload + payload_size, std::back_inserter(frame->payload));
 
-		/* Into the sequence it goes, yarrrrrrrrrr matey */
-		frames.push_back(frame);
-	}
+	      /* Into the sequence it goes, yarrrrrrrrrr matey */
+	      frames.push_back(frame);
+	   }
 
-	source->mImpl->mSink->write(frames);
+	   source->mImpl->mSink->write(frames);
+	}
 
 	/* Now that all is said and done update the internal RTP stack state */
 	pjmedia_rtp_session_update(&source->mImpl->mIncomingSession, header, NULL);

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list