[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
Mon Oct 18 12:54:00 CDT 2010


branch "master" has been updated
       via  7109e4266e63fc36049d8b8e1ed5b15fcbb1e616 (commit)
      from  e460305c84db283af782b128ffb7d81338201da2 (commit)

Summary of changes:
 test/TestRTPpjmedia.cpp |   73 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 0 deletions(-)


- Log -----------------------------------------------------------------
commit 7109e4266e63fc36049d8b8e1ed5b15fcbb1e616
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Oct 18 10:52:42 2010 -0700

    Add a test for confirming the RTP component can handle receiving a payload it does not understand.

diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index 459b327..61a1d1e 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -644,6 +644,79 @@ BOOST_AUTO_TEST_CASE(TransmitandReceiveFrame)
 }
 
 /**
+ * Confirm receiving an RTP packet that is not payload mapped to a media format does not cause a crash
+ */
+BOOST_AUTO_TEST_CASE(ReceiveUnknownRTPPacket)
+{
+	bool dropped = false;
+
+	try
+	{
+	   ServiceLocatorParamsPtr params = new ServiceLocatorParams();
+	   params->category = "rtp";
+
+	   RTPMediaServicePrx service = RTPMediaServicePrx::uncheckedCast(Testbed.locator->locate(params));
+
+	   AudioFormatPtr format = new AudioFormat();
+	   format->name = "zombies";
+	   format->frameSize = 20;
+
+	   FormatSeq formats;
+	   formats.push_back(format);
+
+	   RTPSessionPrx session = service->allocate(formats);
+
+	   PayloadMap mapping;
+	   mapping.insert(make_pair(13, format));
+
+	   session->associatePayloads(mapping);
+
+	   StreamSourceSeq sources = Testbed.session->getSources();
+	   StreamSourceRTPPrx source = StreamSourceRTPPrx::uncheckedCast(sources.front());
+	   string address = source->getLocalAddress();
+	   int port = source->getLocalPort();
+
+	   StreamSinkSeq sinks = session->getSinks();
+	   StreamSinkRTPPrx sink = StreamSinkRTPPrx::uncheckedCast(sinks.front());
+	   sink->setRemoteDetails(address, port);
+
+	   AudioFramePtr frame = new AudioFrame();
+	   frame->mediaformat = format;
+
+	   /* Populate the payload with some useless data, but enough to confirm the payload passes unaltered. */
+	   frame->payload.push_back('a');
+	   frame->payload.push_back('b');
+	   frame->payload.push_back('c');
+	   frame->payload.push_back('d');
+	   frame->payload.push_back('e');
+	   frame->payload.push_back('f');
+	   frame->payload.push_back('g');
+	   frame->payload.push_back('h');
+	   frame->payload.push_back('i');
+	   frame->payload.push_back('j');
+
+	   FrameSeq frames;
+	   frames.push_back(frame);
+
+	   sink->write(frames);
+
+	   session->release();
+
+	   dropped = true;
+	}
+	catch (const Ice::Exception &e)
+	{
+	   BOOST_TEST_MESSAGE(e.ice_name());
+	   BOOST_TEST_MESSAGE(e.what());
+	}
+	catch (...)
+	{
+	}
+
+	BOOST_CHECK(dropped);
+}
+
+/**
  * Attempt to release our RTP session
  */
 BOOST_AUTO_TEST_CASE(ReleaseRTPSession)

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list