[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
Tue Aug 17 20:51:36 CDT 2010


branch "master" has been updated
       via  baf590492af8bb988f0cd537101390bec9d1ba78 (commit)
       via  04780b2b34a49fd4c11a2c9b2c19f057c3f2d784 (commit)
      from  f781c7e7756a7d39123dc488888944550e54c82f (commit)

Summary of changes:
 src/RTPSession.cpp      |   14 ++++--
 test/TestRTPpjmedia.cpp |  127 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+), 4 deletions(-)


- Log -----------------------------------------------------------------
commit baf590492af8bb988f0cd537101390bec9d1ba78
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 17 23:03:51 2010 -0300

    Add RTP tests detailing with the sources/sinks, specifically that they exist and that the state of them is correct.

diff --git a/test/TestRTPpjmedia.cpp b/test/TestRTPpjmedia.cpp
index 964a915..40c315f 100644
--- a/test/TestRTPpjmedia.cpp
+++ b/test/TestRTPpjmedia.cpp
@@ -173,6 +173,132 @@ BOOST_AUTO_TEST_CASE(AllocateRTPSession)
 }
 
 /**
+ * Check that the RTP session has at least one source
+ */
+BOOST_AUTO_TEST_CASE(CheckForSource)
+{
+	bool hassource = false;
+
+	try
+	{
+		StreamSourceSeq sources = Testbed.session->getSources();
+
+		if (sources.size() > 0)
+		{
+			hassource = true;
+		}
+	}
+	catch (const Ice::Exception &e)
+	{
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+	}
+	catch (...)
+	{
+	}
+
+	BOOST_CHECK(hassource);
+}
+
+/**
+ * Check that we receive valid local address information from the sources
+ */
+BOOST_AUTO_TEST_CASE(VerifyLocalAddressonSources)
+{
+	bool validaddresses = true;
+
+	try
+	{
+		StreamSourceSeq sources = Testbed.session->getSources();
+
+		for (StreamSourceSeq::const_iterator i = sources.begin(); i != sources.end(); ++i)
+		{
+			StreamSourceRTPPrx source = StreamSourceRTPPrx::checkedCast((*i));
+
+			if (source->getLocalAddress().empty() || !source->getLocalPort())
+			{
+				validaddresses = false;
+			}
+		}
+	}
+	catch (const Ice::Exception &e)
+	{
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		validaddresses = false;
+	}
+	catch (...)
+	{
+		validaddresses = false;
+	}
+
+	BOOST_CHECK(validaddresses);
+}
+
+/**
+ * Check that the RTP session has at least one sink
+ */
+BOOST_AUTO_TEST_CASE(CheckForSink)
+{
+	bool hassink = false;
+
+	try
+	{
+		StreamSinkSeq sinks = Testbed.session->getSinks();
+
+		if (sinks.size() > 0)
+		{
+			hassink = true;
+		}
+	}
+	catch (const Ice::Exception &e)
+	{
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+	}
+	catch (...)
+	{
+	}
+
+	BOOST_CHECK(hassink);
+}
+
+/**
+ * Check that the sinks do not yet have any remote address information set
+ */
+BOOST_AUTO_TEST_CASE(ConfirmBlankRemoteAddressonSinks)
+{
+	bool hasaddresses = false;
+
+	try
+	{
+		StreamSinkSeq sinks = Testbed.session->getSinks();
+
+		for (StreamSinkSeq::const_iterator i = sinks.begin(); i != sinks.end(); ++i)
+		{
+			StreamSinkRTPPrx sink = StreamSinkRTPPrx::checkedCast((*i));
+
+			if ((!sink->getRemoteAddress().empty() && sink->getRemoteAddress() != "0.0.0.0") || sink->getRemotePort())
+			{
+				hasaddresses = true;
+			}
+		}
+	}
+	catch (const Ice::Exception &e)
+	{
+		BOOST_TEST_MESSAGE(e.ice_name());
+		BOOST_TEST_MESSAGE(e.what());
+		hasaddresses = true;
+	}
+	catch (...)
+	{
+		hasaddresses = true;
+	}
+
+	BOOST_CHECK(!hasaddresses);
+}
+
+/**
  * Attempt to release our RTP session
  */
 BOOST_AUTO_TEST_CASE(ReleaseRTPSession)
@@ -196,3 +322,4 @@ BOOST_AUTO_TEST_CASE(ReleaseRTPSession)
 
 	BOOST_CHECK(released);
 }
+

commit 04780b2b34a49fd4c11a2c9b2c19f057c3f2d784
Author: Joshua Colp <jcolp at digium.com>
Date:   Tue Aug 17 22:42:36 2010 -0300

    Fix an RTP session lifetime problem exposed by the test driver.

diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 678adde..8647258 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -147,10 +147,6 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
  */
 RTPSessionImplPriv::~RTPSessionImplPriv()
 {
-	/* Drop the source and sink from the ASM */
-	mAdapter->remove(mStreamSourceProxy->ice_getIdentity());
-	mAdapter->remove(mStreamSinkProxy->ice_getIdentity());
-
 	/* Discontinue the media transport. */
 	pjmedia_transport_close(mTransport);
 
@@ -212,6 +208,16 @@ RTCPSessionPrx RTPSessionImpl::getRTCPSession(const Ice::Current&)
  */
 void RTPSessionImpl::release(const Ice::Current&)
 {
+	/* Drop the source and sink from the ASM */
+	mImpl->mAdapter->remove(mImpl->mStreamSourceProxy->ice_getIdentity());
+	mImpl->mAdapter->remove(mImpl->mStreamSinkProxy->ice_getIdentity());
+
+	/* Since both the source and sink have a pointer back to the session we need to get rid of them,
+	 * which will in turn get rid of ourselves once we are removed from the ASM.
+	 */
+	mImpl->mStreamSource = 0;
+	mImpl->mStreamSink = 0;
+
 	/* All we have to do is remove ourselves from the ASM, our smart pointerness will cause us to
 	 * destruct and then cleanup will occur.
 	 */

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list