[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 Aug 16 13:22:10 CDT 2010


branch "master" has been updated
       via  695c4fef0eebb0e0c433f2f6856f81053ce7b86d (commit)
       via  dd4ffa2148e7ba41d82c9e3c48b5ed401a1237a4 (commit)
       via  57f3a53ce2c12878603e9e28f3a02d5d87181b46 (commit)
       via  c7322f9a33841775c008695b9a823ebbaae1e874 (commit)
       via  ec6bd7a204861a6eab5def1f4327841f0c7a3626 (commit)
       via  eb8afd47aa71f223f09b05fed9b1afdc9458d036 (commit)
       via  91899800b6801ee227dffe6d28278ee535280542 (commit)
      from  3b50b49d0c4b4681fe00922f8a8e8851d171213a (commit)

Summary of changes:
 slice              |    2 +-
 src/RTPSession.cpp |   45 +++++++++++++++++++++++++++++++++++++++++++++
 src/RTPSession.h   |    3 +++
 src/RTPSink.cpp    |   15 ++-------------
 src/RTPSource.cpp  |   40 +++++++++++++++++++++++-----------------
 5 files changed, 74 insertions(+), 31 deletions(-)


- Log -----------------------------------------------------------------
commit 695c4fef0eebb0e0c433f2f6856f81053ce7b86d
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:33:10 2010 -0300

    Utilize the getPayload function to retrieve a payload based on format.

diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index a9af850..a066d58 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -86,7 +86,8 @@ void StreamSinkRTPImpl::write(const Hydra::Media::V1::FrameSeq& frames, const Ic
 
 		/* Using the available information construct an RTP header that we can place at the front of our packet */
 		/* TODO: We need to be able to set the RTP payload value here, from the frame? otherwise? */
-		pj_status_t status = pjmedia_rtp_encode_rtp(&mImpl->mOutgoingSession, 0, 0, (*frame)->payload.size(), audioformat->frameSize, &header, &header_len);
+		pj_status_t status = pjmedia_rtp_encode_rtp(&mImpl->mOutgoingSession, mImpl->mSession->getPayload((*frame)->mediaformat), 0, (*frame)->payload.size(),
+							    audioformat->frameSize, &header, &header_len);
 
 		if (status != PJ_SUCCESS)
 		{

commit dd4ffa2148e7ba41d82c9e3c48b5ed401a1237a4
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:32:05 2010 -0300

    Pass a pointer to a media format into getPayload.

diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 0c3fb7b..678adde 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -285,8 +285,8 @@ FormatPtr RTPSessionImpl::getFormat(int payload)
  *
  * @return The payload number.
  */
-int RTPSessionImpl::getPayload(const Format& mediaformat)
+int RTPSessionImpl::getPayload(const FormatPtr& mediaformat)
 {
-	map<string, int>::iterator it = mImpl->mFormatstoPayloads.find(mediaformat.name);
+	map<string, int>::iterator it = mImpl->mFormatstoPayloads.find(mediaformat->name);
 	return (*it).second;
 }
diff --git a/src/RTPSession.h b/src/RTPSession.h
index 09d0045..0ade8c0 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -44,7 +44,7 @@ public:
 	void associatePayloads(const Hydra::Media::RTP::V1::PayloadMap&, const Ice::Current&);
 	void setRemoteDetails(std::string address, int port);
 	Hydra::Media::V1::FormatPtr getFormat(int payload);
-	int getPayload(const Hydra::Media::V1::Format& mediaformat);
+	int getPayload(const Hydra::Media::V1::FormatPtr& mediaformat);
 private:
 	/**
 	 * Private implementation data for RTPSessionImpl.

commit 57f3a53ce2c12878603e9e28f3a02d5d87181b46
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:29:41 2010 -0300

    Change some TODO comments into actual log messages.

diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 81530bc..609dd43 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -144,7 +144,7 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 	/* Ensure that no errors occurred when reading this packet in */
 	if (size < 0)
 	{
-		/* TODO: Determine what we should do, spit out an error? */
+		cerr << "[ERROR] We attempted to read data from an RTP session but failed." << endl;
 		return;
 	}
 
@@ -156,7 +156,7 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 
 	if (status != PJ_SUCCESS)
 	{
-		/* TODO: Somehow we failed to parse the RTP header, nothing we can really do... */
+		cerr << "[ERROR] We read an RTP packet of size " << size << " in but failed to decode it." << endl;
 		return;
 	}
 

commit c7322f9a33841775c008695b9a823ebbaae1e874
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:27:58 2010 -0300

    Utilize the format retrieval function to get a format based on payload, and construct a frame using those details.

diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index e3f4493..81530bc 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -160,25 +160,31 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 		return;
 	}
 
-	/* TODO: Based on the payload of the packet we need to find the media format, and construct the relevant
-	 * frame based on it. For example video would need a video frame.
-	 */
-	AudioFramePtr frame = new AudioFrame();
-	frame->mediaformat = source->mImpl->mSession->getFormats().front();
+	FormatPtr mediaformat = source->mImpl->mSession->getFormat(header->pt);
 
-	/* Populate the common data */
-	frame->timestamp = header->ts;
-	frame->seqno = header->seq;
+	FrameSeq frames;
 
-	/* Yay! The actual payload! */
-	frame->payload.resize(payload_size);
+	AudioFormatPtr audioformat;
 
-	/* TODO: Use vectorness to do this instead of memcpy if possible */
-	memcpy(&frame->payload[0], payload, payload_size);
+	if ((audioformat = AudioFormatPtr::dynamicCast(mediaformat)))
+	{
+		AudioFramePtr frame = new AudioFrame();
+		frame->mediaformat = mediaformat;
+
+		/* Populate the common data */
+		frame->timestamp = header->ts;
+		frame->seqno = header->seq;
+
+		/* Yay! The actual payload! */
+		frame->payload.resize(payload_size);
+
+		/* TODO: Use vectorness to do this instead of memcpy if possible */
+		memcpy(&frame->payload[0], payload, payload_size);
+
+		/* Into the sequence it goes, yarrrrrrrrrr matey */
+		frames.push_back(frame);
+	}
 
-	/* Now out it goes */
-	FrameSeq frames;
-	frames.push_back(frame);
 	source->mImpl->mSink->write(frames);
 
 	/* Now that all is said and done update the internal RTP stack state */

commit ec6bd7a204861a6eab5def1f4327841f0c7a3626
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:27:33 2010 -0300

    Update our slice submodule to the latest revision.

diff --git a/slice b/slice
index 49fdc43..0fd4cb3 160000
--- a/slice
+++ b/slice
@@ -1 +1 @@
-Subproject commit 49fdc431aec2f9335f386125e76ea2ab77802187
+Subproject commit 0fd4cb3a22d7a3993ae64ee5e4ee73f9ae97a64d

commit eb8afd47aa71f223f09b05fed9b1afdc9458d036
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 15:25:54 2010 -0300

    Add handling of pushing payload mapping information in, and add retrieval functions for use by the source and sink.

diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 3e26884..0c3fb7b 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -96,6 +96,16 @@ public:
 	 * A proxy to the above mentioned stream sink.
 	 */
 	StreamSinkRTPPrx mStreamSinkProxy;
+
+	/**
+	 * A dictionary mapping payloads to media formats.
+	 */
+	PayloadMap mPayloadstoFormats;
+
+	/**
+	 * A dictionary mapping media formats to payloads.
+	 */
+	map<string, int> mFormatstoPayloads;
 };
 
 /**
@@ -209,6 +219,19 @@ void RTPSessionImpl::release(const Ice::Current&)
 }
 
 /**
+ * Implementation of the associatePayloads method as defined in MediaRTPIf.ice
+ */
+void RTPSessionImpl::associatePayloads(const Hydra::Media::RTP::V1::PayloadMap& mappings, const Ice::Current&)
+{
+	mImpl->mPayloadstoFormats = mappings;
+
+	for (PayloadMap::const_iterator it = mappings.begin(); it != mappings.end(); ++it)
+	{
+		mImpl->mFormatstoPayloads.insert(make_pair((*it).second->name, (*it).first));
+	}
+}
+
+/**
  * API call which returns a proxy to this RTP session.
  *
  * @return A proxy to this RTP session.
@@ -245,3 +268,25 @@ void RTPSessionImpl::setRemoteDetails(std::string address, int port)
 {
 	mImpl->mStreamSource->setRemoteDetails(address, port);
 }
+
+/**
+ * API call which returns a media format based on payload.
+ *
+ * @return The media format corresponding to the payload.
+ */
+FormatPtr RTPSessionImpl::getFormat(int payload)
+{
+	PayloadMap::iterator it = mImpl->mPayloadstoFormats.find(payload);
+	return (*it).second;
+}
+
+/**
+ * API call which returns a payload based on media format.
+ *
+ * @return The payload number.
+ */
+int RTPSessionImpl::getPayload(const Format& mediaformat)
+{
+	map<string, int>::iterator it = mImpl->mFormatstoPayloads.find(mediaformat.name);
+	return (*it).second;
+}
diff --git a/src/RTPSession.h b/src/RTPSession.h
index 620b2a5..09d0045 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -41,7 +41,10 @@ public:
 	Hydra::Media::RTP::V1::RTPSessionPrx getProxy();
 	pjmedia_transport* getTransport();
 	Hydra::Media::V1::FormatSeq getFormats();
+	void associatePayloads(const Hydra::Media::RTP::V1::PayloadMap&, const Ice::Current&);
 	void setRemoteDetails(std::string address, int port);
+	Hydra::Media::V1::FormatPtr getFormat(int payload);
+	int getPayload(const Hydra::Media::V1::Format& mediaformat);
 private:
 	/**
 	 * Private implementation data for RTPSessionImpl.

commit 91899800b6801ee227dffe6d28278ee535280542
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Aug 16 14:22:16 2010 -0300

    Remove old variables that are no longer used.

diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index cd02983..a9af850 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -57,18 +57,6 @@ public:
 	 * A proxy to the sink that we are receiving media from.
 	 */
 	StreamSourcePrx mSource;
-
-	/**
-	 * Temporary storage for remote address, used while waiting for port
-	 * to be populated.
-	 */
-	string mRemoteAddress;
-
-	/**
-	 * Temporary storage for remote port, used while waiting for address
-	 * to be populated.
-	 */
-        int mRemotePort;
 };
 
 /**

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list