[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
Sun Oct 17 20:07:21 CDT 2010


branch "master" has been updated
       via  e460305c84db283af782b128ffb7d81338201da2 (commit)
      from  7d6a6d1de91aee2592358c9f072385360e522560 (commit)

Summary of changes:
 src/RTPSession.cpp |    6 ++++++
 src/RTPSource.cpp  |   33 ++++++++++++++++++---------------
 2 files changed, 24 insertions(+), 15 deletions(-)


- Log -----------------------------------------------------------------
commit e460305c84db283af782b128ffb7d81338201da2
Author: Joshua Colp <jcolp at digium.com>
Date:   Sun Oct 17 18:06:02 2010 -0700

    If an RTP packet is received with a payload that has not been configured do not attempt to write it to the sink.

diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index c11fc56..800fc14 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -273,6 +273,12 @@ void RTPSessionImpl::setRemoteDetails(std::string address, int port)
 FormatPtr RTPSessionImpl::getFormat(int payload)
 {
 	PayloadMap::iterator it = mImpl->mPayloadstoFormats.find(payload);
+
+	if (it == mImpl->mPayloadstoFormats.end())
+	{
+	   return 0;
+	}
+
 	return (*it).second;
 }
 
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 132d944..2cb6f90 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -161,27 +161,30 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 	{
 	   FormatPtr mediaformat = source->mImpl->mSession->getFormat(header->pt);
 
-	   FrameSeq frames;
+	   if (mediaformat != 0)
+	   {
+	      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 */

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list