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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jul 11 16:22:40 CDT 2011


branch "rtcp" has been updated
       via  0665e06e6544ef26990e5379040e0b9915af7a8e (commit)
      from  7959b9db758e935ed9f8152a582dac39a2e15df2 (commit)

Summary of changes:
 src/RTPSession.cpp |   72 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 72 insertions(+), 0 deletions(-)


- Log -----------------------------------------------------------------
commit 0665e06e6544ef26990e5379040e0b9915af7a8e
Author: Joshua Colp <jcolp at digium.com>
Date:   Mon Jul 11 18:23:24 2011 -0300

    Finish up RTCPInformationImpl class.

diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 942a0c7..060bf98 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -91,14 +91,68 @@ public:
     RTCPInformationImpl(pjmedia_rtcp_stat *general, pjmedia_rtcp_stream_stat *stream) :
 	mGeneralStatistics(general), mStreamStatistics(stream) { }
 
+    RTCP::V1::StatisticsPtr getStatistics(const Ice::Current&)
+    {
+        RTCP::V1::StatisticsPtr statistics = new RTCP::V1::Statistics();
+
+        statistics->roundTripDelay = new RTCP::V1::ExtendedDetails();
+        statistics->roundTripDelay->maximum = mGeneralStatistics->rtt.max;
+        statistics->roundTripDelay->minimum = mGeneralStatistics->rtt.min;
+        statistics->roundTripDelay->last = mGeneralStatistics->rtt.last;
+        statistics->roundTripDelay->mean = mGeneralStatistics->rtt.mean;
+
+        statistics->packets = mStreamStatistics->pkt;
+        statistics->discardedPackets = mStreamStatistics->discard;
+        statistics->lostPackets = mStreamStatistics->loss;
+        statistics->outOfOrderPackets = mStreamStatistics->reorder;
+        statistics->duplicatePackets = mStreamStatistics->dup;
+
+        statistics->loss = new RTCP::V1::ExtendedDetails();
+        statistics->loss->maximum = mStreamStatistics->loss_period.max;
+        statistics->loss->minimum = mStreamStatistics->loss_period.min;
+        statistics->loss->last = mStreamStatistics->loss_period.last;
+        statistics->loss->mean = mStreamStatistics->loss_period.mean;
+
+        statistics->jitter = new RTCP::V1::ExtendedDetails();
+        statistics->jitter->maximum = mStreamStatistics->jitter.max;
+        statistics->jitter->minimum = mStreamStatistics->jitter.min;
+        statistics->jitter->last = mStreamStatistics->jitter.last;
+        statistics->jitter->mean = mStreamStatistics->jitter.mean;
+
+        return statistics;
+    }
+
+    void addListener(const RTCP::V1::InformationListenerPrx& listener, const Ice::Current&)
+    {
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
+        mListeners.push_back(listener);
+    }
+
+    void removeListener(const RTCP::V1::InformationListenerPrx& listener, const Ice::Current&)
+    {
+        boost::unique_lock<boost::shared_mutex> lock(mLock);
+        std::remove(mListeners.begin(), mListeners.end(), listener);
+    }
+
+    /**
+     * Implementation specific function which returns a copy of the listeners.
+     */
+    std::vector<RTCP::V1::InformationListenerPrx> getListeners()
+    {
+        boost::shared_lock<boost::shared_mutex> lock(mLock);
+        return mListeners;
+    }
+
 private:
     /**
      * Lock to protect the listeners.
      */
+    boost::shared_mutex mLock;
 
     /**
      * Listeners present.
      */
+    std::vector<RTCP::V1::InformationListenerPrx> mListeners;
 
     /**
      * Structure where general RTCP information is.
@@ -204,6 +258,16 @@ public:
      * A pointer to the RTCP session interface.
      */
     RTCP::V1::RTCPSessionPtr mRtcpSessionInterface;
+
+    /**
+     * RTCP information for Receiver Report.
+     */
+    RTCPInformationImplPtr mReceiverReport;
+
+    /**
+     * RTCP information for Sender Report.
+     */
+    RTCPInformationImplPtr mSenderReport;
 };
 
 /**
@@ -311,6 +375,14 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const RTPSe
     mImpl->mRtcpSessionInterface = new RTCPSessionImpl(this);
     mImpl->mAdapter->addFacet(mImpl->mRtcpSessionInterface, mImpl->mProxy->ice_getIdentity(), RTCP::V1::SessionFacet);
 
+    // Create an RTCP information implementation for Receiver Reports
+    mImpl->mReceiverReport = new RTCPInformationImpl(&mImpl->mRtcpSession.stat, &mImpl->mRtcpSession.stat.rx);
+    mImpl->mAdapter->addFacet(mImpl->mReceiverReport, mImpl->mSessionStateItem->mSourceIdentity, RTCP::V1::Facet);
+
+    // Create an RTCP information implementation for Sender Reports
+    mImpl->mSenderReport = new RTCPInformationImpl(&mImpl->mRtcpSession.stat, &mImpl->mRtcpSession.stat.tx);
+    mImpl->mAdapter->addFacet(mImpl->mSenderReport, mImpl->mSessionStateItem->mSinkIdentity, RTCP::V1::Facet);
+
     // Since everything has just come into creation send one big update with all state items
     replicateState(mImpl->mSessionStateItem, mImpl->mStreamSink->getStateItem(), mImpl->mStreamSource->getStateItem());
 }

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list