[asterisk-scf-commits] asterisk-scf/release/media_rtp_pjmedia.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Fri Apr 1 10:49:58 CDT 2011


branch "master" has been updated
       via  bd6452ec09f440b872d99b2b56b818d0b816ff78 (commit)
       via  5a8aa0e39283ebc8eed7883d0b6cbb1867e3863b (commit)
      from  c62a171fb8baea2a25b3fc817d96aa186e98db32 (commit)

Summary of changes:
 src/MediaRTPpjmedia.cpp            |   56 +++++++++++++++++++++++-------------
 src/RTPSession.cpp                 |   35 +++++++++++++++-------
 src/RTPSession.h                   |   18 ++++++++----
 src/RTPSink.cpp                    |   16 ++++++----
 src/RTPSink.h                      |    2 +-
 src/RTPSource.cpp                  |   13 +++++---
 src/RTPSource.h                    |    4 +-
 src/RtpStateReplicator.h           |    7 ++--
 src/RtpStateReplicatorApp.cpp      |   27 ++++++++++-------
 src/RtpStateReplicatorListener.cpp |   25 ++++++++++------
 10 files changed, 129 insertions(+), 74 deletions(-)


- Log -----------------------------------------------------------------
commit bd6452ec09f440b872d99b2b56b818d0b816ff78
Merge: c62a171 5a8aa0e
Author: Brent Eagles <beagles at digium.com>
Date:   Fri Apr 1 13:18:35 2011 -0230

    Merge branch 'code-conventions'.


commit 5a8aa0e39283ebc8eed7883d0b6cbb1867e3863b
Author: Brent Eagles <beagles at digium.com>
Date:   Mon Mar 21 11:19:59 2011 -0230

    * Update method signatures to pass smart pointers, references and proxies
       by const ref.
    * Split some long lines

diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index 4a1d0ee..f041e4f 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -59,7 +59,8 @@ static const string MediaServiceId("RTPMediaService");
 class RTPMediaServiceImpl : public RTPMediaService
 {
 public:
-    RTPMediaServiceImpl(Ice::ObjectAdapterPtr, ReplicaPtr, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>);
+    RTPMediaServiceImpl(const Ice::ObjectAdapterPtr&, const ReplicaPtr&,
+            const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>&);
     RTPSessionPrx allocate(const FormatSeq&, const Ice::Current&);
     pj_pool_factory *getPoolFactory() { return &mCachingPool.factory; };
 private:
@@ -100,7 +101,7 @@ typedef IceUtil::Handle<RTPMediaServiceImpl> RTPMediaServiceImplPtr;
 class ReplicaImpl : public Replica
 {
 public:
-    ReplicaImpl(Ice::ObjectAdapterPtr adapter) : mAdapter(adapter), mPaused(false), mActive(true) { }
+    ReplicaImpl(const Ice::ObjectAdapterPtr& adapter) : mAdapter(adapter), mPaused(false), mActive(true) { }
 
     bool isActive(const Ice::Current&)
     {
@@ -111,9 +112,11 @@ public:
     {
         mActive = true;
 
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
+                 mListeners.begin(); listener != mListeners.end(); ++listener)
         {
-            (*listener)->activated(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
+            (*listener)->activated(ReplicaPrx::uncheckedCast(
+                        mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
         }
 
         return true;
@@ -123,9 +126,11 @@ public:
     {
         mActive = false;
 
-        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener = mListeners.begin(); listener != mListeners.end(); ++listener)
+        for (vector<AsteriskSCF::System::Component::V1::ReplicaListenerPrx>::const_iterator listener =
+                 mListeners.begin(); listener != mListeners.end(); ++listener)
         {
-            (*listener)->onStandby(ReplicaPrx::uncheckedCast(mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
+            (*listener)->onStandby(ReplicaPrx::uncheckedCast(
+                        mAdapter->createDirectProxy(mAdapter->getCommunicator()->stringToIdentity(ReplicaServiceId))));
         }
     }
 
@@ -226,7 +231,8 @@ public:
     /**
      * A constructor for this implementation which just sets a few variables, nothing extreme.
      */
-    ComponentServicepjmediaImpl(MediaRTPpjmediaApp& app, RtpGeneralStateItemPtr generalState) : mApplication(app), mGeneralState(generalState) { };
+    ComponentServicepjmediaImpl(MediaRTPpjmediaApp& app, const RtpGeneralStateItemPtr& generalState) :
+        mApplication(app), mGeneralState(generalState) { };
 
     /**
      * An implementation of the suspend method which actually suspends ourselves
@@ -321,7 +327,8 @@ private:
 /**
  * Constructor for the RTPMediaServiceImpl class.
  */
-RTPMediaServiceImpl::RTPMediaServiceImpl(Ice::ObjectAdapterPtr adapter, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) :
+RTPMediaServiceImpl::RTPMediaServiceImpl(const Ice::ObjectAdapterPtr& adapter, const ReplicaPtr& replicaService,
+        const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
     mAdapter(adapter), mReplicaService(replicaService), mStateReplicator(stateReplicator)
 {
     /* Initialize the memory caching pool using default policy as specified by pjlib. */
@@ -336,19 +343,20 @@ RTPMediaServiceImpl::RTPMediaServiceImpl(Ice::ObjectAdapterPtr adapter, ReplicaP
  */
 RTPSessionPrx RTPMediaServiceImpl::allocate(const FormatSeq& formats, const Ice::Current&)
 {
-    RTPSessionImplPtr session = new RTPSessionImpl(mAdapter, formats, &mCachingPool.factory, mReplicaService, mStateReplicator);
+    RTPSessionImplPtr session =
+        new RTPSessionImpl(mAdapter, formats, &mCachingPool.factory, mReplicaService, mStateReplicator);
     return session->getProxy();
 }
 
 /**
  * Implementation of the IceBox::Service::start method.
  */
-void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorPtr& communicator, const Ice::StringSeq& args)
+void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorPtr& communicator,
+        const Ice::StringSeq& args)
 {
     // we need a logger before we're ready to build the real communicator.
     // use the one we're provided to create the IceLogger.
-    mLoggerAdapter = communicator->createObjectAdapter(
-        "MediaRTPpjmediaAdapterLogger");
+    mLoggerAdapter = communicator->createObjectAdapter("MediaRTPpjmediaAdapterLogger");
     ConfiguredIceLoggerPtr iceLogger = createIceLogger(mLoggerAdapter);
     getLoggerFactory().setLogOutput(iceLogger->getLogger());
     mLoggerAdapter->activate();
@@ -388,7 +396,8 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
 
     lg(Info) << "Activated pjmedia rtp component media service." << endl;
 
-    ServiceLocatorManagementPrx management = ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
+    ServiceLocatorManagementPrx management =
+        ServiceLocatorManagementPrx::checkedCast(mCommunicator->propertyToProxy("ServiceLocatorManagementProxy"));
 
     // The service locator is required for state replicator operation, so go ahead and find it
     ServiceLocatorPrx locator = ServiceLocatorPrx::checkedCast(mCommunicator->propertyToProxy("LocatorService.Proxy"));
@@ -396,7 +405,8 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
     // Look for the configured state replicator or default one
     RtpStateReplicatorParamsPtr replicatorParams = new RtpStateReplicatorParams();
     replicatorParams->category = StateReplicatorDiscoveryCategory;
-    replicatorParams->mName = mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
+    replicatorParams->mName =
+        mCommunicator->getProperties()->getPropertyWithDefault("Sip.StateReplicatorName", "default");
 
     try
     {  
@@ -408,12 +418,15 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
         lg(Error) << "State replicator could not be found, operating without.";
     }
 
-    RTPMediaServiceImplPtr rtpmediaservice = new RTPMediaServiceImpl(mGlobalAdapter, mReplicaService, mStateReplicator);
+    RTPMediaServiceImplPtr rtpmediaservice =
+        new RTPMediaServiceImpl(mGlobalAdapter, mReplicaService, mStateReplicator);
 
     if (mStateReplicator)
     {
-        mReplicatorListener = new RtpStateReplicatorListenerI(mGlobalAdapter, rtpmediaservice->getPoolFactory(), mGeneralState);
-        mReplicatorListenerProxy = RtpStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
+        mReplicatorListener =
+            new RtpStateReplicatorListenerI(mGlobalAdapter, rtpmediaservice->getPoolFactory(), mGeneralState);
+        mReplicatorListenerProxy =
+            RtpStateReplicatorListenerPrx::uncheckedCast(mLocalAdapter->addWithUUID(mReplicatorListener));
 
 	if (mCommunicator->getProperties()->getPropertyWithDefault("Rtp.StateReplicatorListener", "no") == "yes")
 	{
@@ -434,7 +447,8 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
 
     if (mReplicaService->isActive() == true)
     {
-	mGeneralState->mServiceManagement = ServiceManagementPrx::uncheckedCast(management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
+	mGeneralState->mServiceManagement = ServiceManagementPrx::uncheckedCast(
+            management->addService(RTPMediaServiceProxy, "media_rtp_pjmedia"));
 	/* Now we can add some parameters to help find us. */
 	genericparams->category = "rtp";
 	mGeneralState->mServiceManagement->addLocatorParams(genericparams, "");
@@ -442,10 +456,12 @@ void MediaRTPpjmediaApp::start(const std::string& name, const Ice::CommunicatorP
 
     /* One must provide a component service to manage us, if someone wants to */
     ComponentServicePtr ComponentService = new ComponentServicepjmediaImpl(*this, mGeneralState);
-    ComponentServicePrx ComponentServiceProxy = ComponentServicePrx::uncheckedCast(mLocalAdapter->addWithUUID(ComponentService));
+    ComponentServicePrx ComponentServiceProxy =
+        ComponentServicePrx::uncheckedCast(mLocalAdapter->addWithUUID(ComponentService));
 
     /* Let's add the component service to the service locator first */
-    mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(management->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
+    mComponentServiceManagement =
+        ServiceManagementPrx::uncheckedCast(management->addService(ComponentServiceProxy, "media_rtp_pjmedia"));
     genericparams->category = "Component/media_rtp_pjmedia";
     mComponentServiceManagement->addLocatorParams(genericparams, "");
 
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index 5e7f33e..d4e0381 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -54,8 +54,12 @@ using namespace AsteriskSCF::SmartProxy;
 class RTPSessionImplPriv
 {
 public:
-    RTPSessionImplPriv(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) :
-	mAdapter(adapter), mFormats(formats), mSessionStateItem(new RtpSessionStateItem()), mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
+    RTPSessionImplPriv(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
+            const ReplicaPtr& replicaService,
+            const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) :
+	mAdapter(adapter), mFormats(formats),
+        mSessionStateItem(new RtpSessionStateItem()),
+        mReplicaService(replicaService), mStateReplicator(stateReplicator) { };
     ~RTPSessionImplPriv();
 
     /**
@@ -127,7 +131,9 @@ public:
 /**
  * Constructor for the RTPSessionImpl class (used by Ice).
  */
-RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& formats, pj_pool_factory* factory, ReplicaPtr replicaService, AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx> stateReplicator) : 
+RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, const FormatSeq& formats,
+        pj_pool_factory* factory, const ReplicaPtr& replicaService,
+        const AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>& stateReplicator) : 
     mImpl(new RTPSessionImplPriv(adapter, formats, replicaService, stateReplicator))
 {
     /* Add ourselves to the ICE ASM so we can be used. */
@@ -144,7 +150,8 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
     /* Now create some transport we can use to actually send or receive the media. */
     for (int port = DEFAULT_RTP_PORT_MINIMUM; port < DEFAULT_RTP_PORT_MAXIMUM; port += 2)
     {
-        if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport)) == PJ_SUCCESS)
+        if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport)) ==
+                PJ_SUCCESS)
         {
 	    mImpl->mSessionStateItem->mPort = port;
             break;
@@ -173,8 +180,10 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, const FormatSeq& f
 /**
  * Constructor for the RTPSessionImpl class (used by state replicator).
  */
-RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, pj_pool_factory* factory, Ice::Identity sessionIdentity, Ice::Identity sinkIdentity,
-    Ice::Identity sourceIdentity, Ice::Int port, const FormatSeq& formats) : mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>)))
+RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_factory* factory,
+        const Ice::Identity& sessionIdentity, const Ice::Identity& sinkIdentity, const Ice::Identity& sourceIdentity,
+        Ice::Int port, const FormatSeq& formats) :
+    mImpl(new RTPSessionImplPriv(adapter, formats, 0, *(new AsteriskSCF::SmartProxy::SmartProxy<RtpStateReplicatorPrx>)))
 {
     mImpl->mProxy = RTPSessionPrx::uncheckedCast(adapter->add(this, sessionIdentity));
 
@@ -185,13 +194,15 @@ RTPSessionImpl::RTPSessionImpl(Ice::ObjectAdapterPtr adapter, pj_pool_factory* f
 	/* TODO: This is bad... we can't go on! */
     }
 
-    if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport)) != PJ_SUCCESS)
+    if ((status = pjmedia_transport_udp_create2(mImpl->mEndpoint, "RTP", NULL, port, 0, &mImpl->mTransport))
+            != PJ_SUCCESS)
     {
 	// TODO: This is also bad, something is using the port */
     }
 
     mImpl->mStreamSource = new StreamSourceRTPImpl(this, "");
-    mImpl->mStreamSourceProxy = StreamSourceRTPPrx::uncheckedCast(mImpl->mAdapter->add(mImpl->mStreamSource, sourceIdentity));
+    mImpl->mStreamSourceProxy =
+        StreamSourceRTPPrx::uncheckedCast(mImpl->mAdapter->add(mImpl->mStreamSource, sourceIdentity));
 
     mImpl->mStreamSink = new StreamSinkRTPImpl(this, "");
     mImpl->mStreamSinkProxy = StreamSinkRTPPrx::uncheckedCast(mImpl->mAdapter->add(mImpl->mStreamSink, sinkIdentity));
@@ -331,7 +342,7 @@ FormatSeq RTPSessionImpl::getFormats()
 /**
  * API call which calls into RTPSourceImpl in order to setup transport.
  */
-void RTPSessionImpl::setRemoteDetails(std::string address, int port)
+void RTPSessionImpl::setRemoteDetails(const string& address, int port)
 {
     mImpl->mStreamSource->setRemoteDetails(address, port);
 }
@@ -389,7 +400,8 @@ StreamSinkRTPPtr RTPSessionImpl::getSink()
 /**
  * API call which replicates state items.
  */
-void RTPSessionImpl::replicateState(RtpSessionStateItemPtr session, RtpStreamSinkStateItemPtr sink, RtpStreamSourceStateItemPtr source)
+void RTPSessionImpl::replicateState(const RtpSessionStateItemPtr& session, const RtpStreamSinkStateItemPtr& sink,
+        const RtpStreamSourceStateItemPtr& source)
 {
     // If state replication has been disabled do nothing
     if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
@@ -432,7 +444,8 @@ void RTPSessionImpl::replicateState(RtpSessionStateItemPtr session, RtpStreamSin
 /**
  * API call which removes state items from the replicator.
  */
-void RTPSessionImpl::removeState(RtpSessionStateItemPtr session, RtpStreamSinkStateItemPtr sink, RtpStreamSourceStateItemPtr source)
+void RTPSessionImpl::removeState(const RtpSessionStateItemPtr& session, const RtpStreamSinkStateItemPtr& sink,
+        const RtpStreamSourceStateItemPtr& source)
 {
     // If state replication has been disabled do nothing
     if (!mImpl->mStateReplicator || mImpl->mReplicaService->isActive() == false)
diff --git a/src/RTPSession.h b/src/RTPSession.h
index a76b610..4929906 100644
--- a/src/RTPSession.h
+++ b/src/RTPSession.h
@@ -41,9 +41,11 @@ typedef IceUtil::Handle<StreamSourceRTPImpl> StreamSourceRTPImplPtr;
 class RTPSessionImpl : public AsteriskSCF::Media::RTP::V1::RTPSession
 {
 public:
-    RTPSessionImpl(Ice::ObjectAdapterPtr, const AsteriskSCF::Media::V1::FormatSeq&, pj_pool_factory*, AsteriskSCF::System::Component::V1::ReplicaPtr, 
-    		   AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>);
-    RTPSessionImpl(Ice::ObjectAdapterPtr, pj_pool_factory*, Ice::Identity, Ice::Identity, Ice::Identity, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&);
+    RTPSessionImpl(const Ice::ObjectAdapterPtr&, const AsteriskSCF::Media::V1::FormatSeq&,
+            pj_pool_factory*, const AsteriskSCF::System::Component::V1::ReplicaPtr&, 
+            const AsteriskSCF::SmartProxy::SmartProxy<AsteriskSCF::Media::RTP::V1::RtpStateReplicatorPrx>&);
+    RTPSessionImpl(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const Ice::Identity&, const Ice::Identity&,
+            const Ice::Identity&, Ice::Int, const AsteriskSCF::Media::V1::FormatSeq&);
     AsteriskSCF::Media::V1::StreamSourceSeq getSources(const Ice::Current&);
     AsteriskSCF::Media::V1::StreamSinkSeq getSinks(const Ice::Current&);
     std::string getId(const Ice::Current&);
@@ -54,13 +56,17 @@ public:
     pjmedia_transport* getTransport();
     AsteriskSCF::Media::V1::FormatSeq getFormats();
     void associatePayloads(const AsteriskSCF::Media::RTP::V1::PayloadMap&, const Ice::Current&);
-    void setRemoteDetails(std::string address, int port);
+    void setRemoteDetails(const std::string& address, int port);
     AsteriskSCF::Media::V1::FormatPtr getFormat(int payload);
     int getPayload(const AsteriskSCF::Media::V1::FormatPtr& mediaformat);
     StreamSourceRTPImplPtr getSource();
     AsteriskSCF::Media::RTP::V1::StreamSinkRTPPtr getSink();
-    void replicateState(AsteriskSCF::Media::RTP::V1::RtpSessionStateItemPtr, AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItemPtr, AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItemPtr);
-    void removeState(AsteriskSCF::Media::RTP::V1::RtpSessionStateItemPtr, AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItemPtr, AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItemPtr);
+    void replicateState(const AsteriskSCF::Media::RTP::V1::RtpSessionStateItemPtr&,
+            const AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItemPtr&,
+            const AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItemPtr&);
+    void removeState(const AsteriskSCF::Media::RTP::V1::RtpSessionStateItemPtr&,
+            const AsteriskSCF::Media::RTP::V1::RtpStreamSinkStateItemPtr&,
+            const AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItemPtr&);
 private:
     /**
      * Private implementation data for RTPSessionImpl.
diff --git a/src/RTPSink.cpp b/src/RTPSink.cpp
index e20f86d..2324799 100644
--- a/src/RTPSink.cpp
+++ b/src/RTPSink.cpp
@@ -44,7 +44,7 @@ public:
     /**
      * Constructor for our StreamSinkRTPImplPriv class.
      */
-    StreamSinkRTPImplPriv(RTPSessionImplPtr, std::string);
+    StreamSinkRTPImplPriv(const RTPSessionImplPtr&, const std::string&);
 
     /**
      * A structure containing outgoing pjmedia session data.
@@ -65,7 +65,8 @@ public:
 /**
  * Constructor for the StreamSinkRTPImplPriv class.
  */
-StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSinkStateItem(new RtpStreamSinkStateItem())
+StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(const RTPSessionImplPtr& session, const string& sessionId) :
+    mSession(session), mSinkStateItem(new RtpStreamSinkStateItem)
 {
     pjmedia_rtp_session_init(&mOutgoingSession, 0, pj_rand());
     mSinkStateItem->mSessionId = sessionId;
@@ -76,7 +77,8 @@ StreamSinkRTPImplPriv::StreamSinkRTPImplPriv(RTPSessionImplPtr session, std::str
 /**
  * Constructor for the StreamSinkRTPImpl class.
  */
-StreamSinkRTPImpl::StreamSinkRTPImpl(RTPSessionImplPtr session, std::string sessionId) : mImpl(new StreamSinkRTPImplPriv(session, sessionId))
+StreamSinkRTPImpl::StreamSinkRTPImpl(const RTPSessionImplPtr& session, const string& sessionId) :
+    mImpl(new StreamSinkRTPImplPriv(session, sessionId))
 {
 }
 
@@ -112,7 +114,8 @@ void StreamSinkRTPImpl::write(const AsteriskSCF::Media::V1::FrameSeq& frames, co
         }
 
         /* Using the available information construct an RTP header that we can place at the front of our packet */
-        pj_status_t status = pjmedia_rtp_encode_rtp(&mImpl->mOutgoingSession, mImpl->mSession->getPayload((*frame)->mediaformat), 0, (*frame)->payload.size(),
+        pj_status_t status = pjmedia_rtp_encode_rtp(&mImpl->mOutgoingSession,
+                mImpl->mSession->getPayload((*frame)->mediaformat), 0, (*frame)->payload.size(),
             (*frame)->payload.size(), &header, &header_len);
 
         if (status != PJ_SUCCESS)
@@ -131,7 +134,8 @@ void StreamSinkRTPImpl::write(const AsteriskSCF::Media::V1::FrameSeq& frames, co
         pj_memcpy(packet + header_len, &(*frame)->payload[0], (*frame)->payload.size());
 
         /* All done, transmission can now occur */
-        status = pjmedia_transport_send_rtp(mImpl->mSession->getTransport(), packet, (*frame)->payload.size() + header_len);
+        status = pjmedia_transport_send_rtp(mImpl->mSession->getTransport(), packet,
+                (*frame)->payload.size() + header_len);
 
         if (status != PJ_SUCCESS)
         {
@@ -179,7 +183,7 @@ std::string StreamSinkRTPImpl::getId(const Ice::Current& current)
 /**
  * Implementation of the setRemoteDetails method as defined in MediaRTPIf.ice
  */
-void StreamSinkRTPImpl::setRemoteDetails(const std::string& address, Ice::Int port, const Ice::Current&)
+void StreamSinkRTPImpl::setRemoteDetails(const string& address, Ice::Int port, const Ice::Current&)
 {
     /* This method is essentially a passthru to the RTPSourceImpl. It takes care of
      * actually attaching the transport.
diff --git a/src/RTPSink.h b/src/RTPSink.h
index a350d18..6254d5a 100644
--- a/src/RTPSink.h
+++ b/src/RTPSink.h
@@ -21,7 +21,7 @@ class StreamSinkRTPImplPriv;
 class StreamSinkRTPImpl : public AsteriskSCF::Media::RTP::V1::StreamSinkRTP
 {
 public:
-    StreamSinkRTPImpl(RTPSessionImplPtr, std::string);
+    StreamSinkRTPImpl(const RTPSessionImplPtr&, const std::string&);
     void write(const AsteriskSCF::Media::V1::FrameSeq&, const Ice::Current&);
     void setSource(const AsteriskSCF::Media::V1::StreamSourcePrx&, const Ice::Current&);
     AsteriskSCF::Media::V1::StreamSourcePrx getSource(const Ice::Current&);
diff --git a/src/RTPSource.cpp b/src/RTPSource.cpp
index 39c52e2..7e0450b 100644
--- a/src/RTPSource.cpp
+++ b/src/RTPSource.cpp
@@ -51,7 +51,7 @@ public:
     /**
      * Constructor for our StreamSourceRTPImplPriv class.
      */
-    StreamSourceRTPImplPriv(RTPSessionImplPtr, std::string);
+    StreamSourceRTPImplPriv(const RTPSessionImplPtr&, const string&);
 
     /**
      * A structure containing incoming pjmedia session data.
@@ -72,7 +72,8 @@ public:
 /**
  * Constructor for the StreamSourceRTPImplPriv class.
  */
-StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std::string sessionId) : mSession(session), mSourceStateItem(new RtpStreamSourceStateItem())
+StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(const RTPSessionImplPtr& session, const string& sessionId) :
+    mSession(session), mSourceStateItem(new RtpStreamSourceStateItem)
 {
     pjmedia_rtp_session_init(&mIncomingSession, 0, 0);
     mSourceStateItem->mSessionId = sessionId;
@@ -82,7 +83,8 @@ StreamSourceRTPImplPriv::StreamSourceRTPImplPriv(RTPSessionImplPtr session, std:
 /**
  * Constructor for the StreamSourceRTPImpl class.
  */
-StreamSourceRTPImpl::StreamSourceRTPImpl(RTPSessionImplPtr session, std::string sessionId) : mImpl(new StreamSourceRTPImplPriv(session, sessionId))
+StreamSourceRTPImpl::StreamSourceRTPImpl(const RTPSessionImplPtr& session, const string& sessionId) :
+    mImpl(new StreamSourceRTPImplPriv(session, sessionId))
 {
 }
 
@@ -174,7 +176,8 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
     Ice::Byte* payload;
     unsigned int payload_size;
 
-    pj_status_t status = pjmedia_rtp_decode_rtp(&source->mImpl->mIncomingSession, packet, size, &header, (const void**)&payload, &payload_size);
+    pj_status_t status = pjmedia_rtp_decode_rtp(&source->mImpl->mIncomingSession, packet, size, &header,
+            (const void**)&payload, &payload_size);
 
     if (status != PJ_SUCCESS)
     {
@@ -219,7 +222,7 @@ static void receiveRTP(void *userdata, void *packet, pj_ssize_t size)
 /**
  * API call which sets up our pjmedia transport and allows media to be sent and received.
  */
-void StreamSourceRTPImpl::setRemoteDetails(std::string address, int port)
+void StreamSourceRTPImpl::setRemoteDetails(const string& address, int port)
 {
     pj_sockaddr_in sin;
 
diff --git a/src/RTPSource.h b/src/RTPSource.h
index c6d9d4a..d7373e7 100644
--- a/src/RTPSource.h
+++ b/src/RTPSource.h
@@ -21,7 +21,7 @@ class StreamSourceRTPImplPriv;
 class StreamSourceRTPImpl : public AsteriskSCF::Media::RTP::V1::StreamSourceRTP
 {
 public:
-    StreamSourceRTPImpl(RTPSessionImplPtr, std::string);
+    StreamSourceRTPImpl(const RTPSessionImplPtr&, const std::string&);
     void setSink(const AsteriskSCF::Media::V1::StreamSinkPrx&, const Ice::Current&);
     AsteriskSCF::Media::V1::StreamSinkPrx getSink(const Ice::Current&);
     AsteriskSCF::Media::V1::FormatSeq getFormats(const Ice::Current&);
@@ -29,7 +29,7 @@ public:
     void requestFormat(const AsteriskSCF::Media::V1::FormatPtr&, const Ice::Current&);
     std::string getLocalAddress(const Ice::Current&);
     Ice::Int getLocalPort(const Ice::Current&);
-    void setRemoteDetails(std::string address, int port);
+    void setRemoteDetails(const std::string& address, int port);
     AsteriskSCF::Media::RTP::V1::RtpStreamSourceStateItemPtr getStateItem();
 
     /**
diff --git a/src/RtpStateReplicator.h b/src/RtpStateReplicator.h
index 34dc017..b2db101 100644
--- a/src/RtpStateReplicator.h
+++ b/src/RtpStateReplicator.h
@@ -24,17 +24,18 @@
 
 using namespace AsteriskSCF::Media::RTP::V1;
 
-typedef AsteriskSCF::StateReplication::StateReplicator<RtpStateReplicator, RtpStateItemPtr, std::string, RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
+typedef AsteriskSCF::StateReplication::StateReplicator<RtpStateReplicator, RtpStateItemPtr, std::string,
+                                                       RtpStateReplicatorListenerPrx> RtpStateReplicatorI;
 typedef IceUtil::Handle<RtpStateReplicatorI> RtpStateReplicatorIPtr;
 
 class RtpStateReplicatorListenerI : public RtpStateReplicatorListener
 {
 public:
-    RtpStateReplicatorListenerI(Ice::ObjectAdapterPtr, pj_pool_factory*, RtpGeneralStateItemPtr);
+    RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr&, pj_pool_factory*, const RtpGeneralStateItemPtr&);
     ~RtpStateReplicatorListenerI();
     void stateRemoved(const Ice::StringSeq&, const Ice::Current&);
     void stateSet(const RtpStateItemSeq&, const Ice::Current&);
-    bool operator==(RtpStateReplicatorListenerI &rhs);
+    bool operator==(const RtpStateReplicatorListenerI &rhs);
 private:
     struct RtpStateReplicatorListenerImpl *mImpl;
 };
diff --git a/src/RtpStateReplicatorApp.cpp b/src/RtpStateReplicatorApp.cpp
index 6fa76d9..91c0e37 100644
--- a/src/RtpStateReplicatorApp.cpp
+++ b/src/RtpStateReplicatorApp.cpp
@@ -53,7 +53,7 @@ public:
     virtual void start(const string &name, const Ice::CommunicatorPtr& ic, const Ice::StringSeq& args);
     virtual void stop();
 private:
-    void initialize(std::string appName, const Ice::CommunicatorPtr& ic);
+    void initialize(const string& appName, const Ice::CommunicatorPtr& ic);
     void registerWithServiceLocator(const Ice::CommunicatorPtr& ic);
     void deregisterFromServiceLocator();
     std::string mAppName;
@@ -101,7 +101,7 @@ private:
 class RtpStateReplicatorCompare : public ServiceLocatorParamsCompare
 {
 public:
-    RtpStateReplicatorCompare(string name) : mName(name) {}
+    RtpStateReplicatorCompare(const string& name) : mName(name) {}
     bool isSupported(const ServiceLocatorParamsPtr &params, const Ice::Current &)
     {
         RtpStateReplicatorParamsPtr sipParams = RtpStateReplicatorParamsPtr::dynamicCast(params);
@@ -126,11 +126,13 @@ void RtpStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
     try
     {
         // Get a proxy to the management interface for the Service Locator, so we can add ourselves into the system discovery mechanisms.
-        mServiceLocatorManagement = ServiceLocatorManagementPrx::checkedCast(ic->propertyToProxy("LocatorServiceManagement.Proxy"));
+        mServiceLocatorManagement =
+            ServiceLocatorManagementPrx::checkedCast(ic->propertyToProxy("LocatorServiceManagement.Proxy"));
 
         if (mServiceLocatorManagement == 0)
         {
-            lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. This component can't be found until this is corrected." << endl;
+            lg(Error) << "Unable to obtain proxy to ServiceLocatorManagement interface. Check config file. "
+                "This component can't be found until this is corrected.";
             return;
         }
 
@@ -140,7 +142,8 @@ void RtpStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
 
         // The GUID passed in to add service needs to be unique for reporting.
         string componentServiceGuid(AsteriskSCF::Media::RTP::V1::StateReplicatorComponentCategory);
-        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
+        mComponentServiceManagement = ServiceManagementPrx::uncheckedCast(
+            mServiceLocatorManagement->addService(componentServicePrx, componentServiceGuid));
 
         // Add category as a parameter to enable other components look this component up.
         ServiceLocatorParamsPtr genericparams = new ServiceLocatorParams();
@@ -152,14 +155,16 @@ void RtpStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
         RtpStateReplicatorPrx stateReplicatorPrx = RtpStateReplicatorPrx::checkedCast(stateReplicatorObjectPrx);
 
         string stateReplicationGuid(AsteriskSCF::Media::RTP::V1::StateReplicatorDiscoveryCategory);
-        mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
+        mStateReplicationManagement = ServiceManagementPrx::uncheckedCast(
+            mServiceLocatorManagement->addService(stateReplicatorPrx, stateReplicationGuid));
 
-        ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams();
+        ServiceLocatorParamsPtr discoveryParams = new ServiceLocatorParams;
         discoveryParams->category = AsteriskSCF::Media::RTP::V1::StateReplicatorDiscoveryCategory;
 
         string replicatorName = ic->getProperties()->getPropertyWithDefault("RtpStateReplicator.Name", "default");
         RtpStateReplicatorCompare* nameCompare = new RtpStateReplicatorCompare(replicatorName);
-        ServiceLocatorParamsComparePrx compareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(mAdapter->addWithUUID(nameCompare));
+        ServiceLocatorParamsComparePrx compareProxy = ServiceLocatorParamsComparePrx::uncheckedCast(
+            mAdapter->addWithUUID(nameCompare));
 
         string compareGuid = IceUtil::generateUUID();
         mServiceLocatorManagement->addCompare(compareGuid, compareProxy);
@@ -169,7 +174,7 @@ void RtpStateReplicatorService::registerWithServiceLocator(const Ice::Communicat
     }
     catch(...)
     {
-        lg(Error) << "Exception in " << mAppName << " registerWithServiceLocator()" << endl;
+        lg(Error) << "Exception in " << mAppName << " registerWithServiceLocator()";
     }
 }
 
@@ -186,11 +191,11 @@ void RtpStateReplicatorService::deregisterFromServiceLocator()
     }
     catch(...)
     {
-        lg(Error) << "Had trouble in deregisterFromServiceLocator()." << endl;
+        lg(Error) << "Had trouble in deregisterFromServiceLocator().";
     }
 }
 
-void RtpStateReplicatorService::initialize(const std::string appName, const Ice::CommunicatorPtr& ic)
+void RtpStateReplicatorService::initialize(const string& appName, const Ice::CommunicatorPtr& ic)
 {
     mAdapter = ic->createObjectAdapter("RtpStateReplicator");
 
diff --git a/src/RtpStateReplicatorListener.cpp b/src/RtpStateReplicatorListener.cpp
index cc00a2a..b47f408 100644
--- a/src/RtpStateReplicatorListener.cpp
+++ b/src/RtpStateReplicatorListener.cpp
@@ -56,8 +56,10 @@ private:
 struct RtpStateReplicatorListenerImpl
 {
 public:
-    RtpStateReplicatorListenerImpl(Ice::ObjectAdapterPtr adapter, pj_pool_factory *poolFactory, RtpGeneralStateItemPtr generalState)
+    RtpStateReplicatorListenerImpl(const Ice::ObjectAdapterPtr& adapter, pj_pool_factory *poolFactory,
+            const RtpGeneralStateItemPtr& generalState)
         : mId(IceUtil::generateUUID()), mAdapter(adapter), mPoolFactory(poolFactory), mGeneralState(generalState) {}
+    
     void removeStateNoticeImpl(const Ice::StringSeq& itemKeys)
     {
         for (Ice::StringSeq::const_iterator key = itemKeys.begin(); key != itemKeys.end(); ++key)
@@ -71,7 +73,7 @@ public:
 	class visitor : public AsteriskSCF::Media::RTP::V1::RtpStateItemVisitor
 	{
 	public:
-	visitor(RtpStateReplicatorListenerImpl *impl) : impl(impl)
+            visitor(RtpStateReplicatorListenerImpl *impl) : impl(impl)
 	    {
 	    }
 
@@ -94,8 +96,9 @@ public:
 		    localitem = newitem;
 		    impl->mStateItems.insert(make_pair(item->mSessionId, newitem));
 
-		    RTPSessionImplPtr localSession = new RTPSessionImpl(impl->mAdapter, impl->mPoolFactory, item->mSessionIdentity, item->mSinkIdentity,
-			item->mSourceIdentity, item->mPort, item->mFormats);
+		    RTPSessionImplPtr localSession =
+                        new RTPSessionImpl(impl->mAdapter, impl->mPoolFactory, item->mSessionIdentity,
+                                item->mSinkIdentity, item->mSourceIdentity, item->mPort, item->mFormats);
 		    localitem->setSession(localSession);
 		}
 		else
@@ -108,17 +111,20 @@ public:
 		    
 	    void visitStreamSink(const RtpStreamSinkStateItemPtr &item, const Ice::Current &)
 	    {
-		map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = impl->mStateItems.find(item->mSessionId);
+		map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i =
+                    impl->mStateItems.find(item->mSessionId);
 		if (i != impl->mStateItems.end())
 		{
 		    i->second->getSession()->getSink()->setSource(item->mSource, Ice::Current());
-		    i->second->getSession()->getSink()->setRemoteDetails(item->mRemoteAddress, item->mRemotePort, Ice::Current());
+		    i->second->getSession()->getSink()->setRemoteDetails(item->mRemoteAddress, item->mRemotePort,
+                            Ice::Current());
 		}
 	    }
 		    
 	    void visitStreamSource(const RtpStreamSourceStateItemPtr &item, const Ice::Current &)
 	    {
-		map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i = impl->mStateItems.find(item->mSessionId);
+		map<string, boost::shared_ptr<RtpStateReplicatorItem> >::iterator i =
+                    impl->mStateItems.find(item->mSessionId);
 		if (i != impl->mStateItems.end())
 		{
 		    i->second->getSession()->getSource()->setSink(item->mSink, Ice::Current());
@@ -141,7 +147,8 @@ public:
     RtpGeneralStateItemPtr mGeneralState;
 };
 
-RtpStateReplicatorListenerI::RtpStateReplicatorListenerI(Ice::ObjectAdapterPtr adapter, pj_pool_factory *poolFactory, RtpGeneralStateItemPtr generalState)
+RtpStateReplicatorListenerI::RtpStateReplicatorListenerI(const Ice::ObjectAdapterPtr& adapter,
+        pj_pool_factory *poolFactory, const RtpGeneralStateItemPtr& generalState)
     : mImpl(new RtpStateReplicatorListenerImpl(adapter, poolFactory, generalState)) {}
 
 RtpStateReplicatorListenerI::~RtpStateReplicatorListenerI()
@@ -159,7 +166,7 @@ void RtpStateReplicatorListenerI::stateSet(const RtpStateItemSeq& items, const I
     mImpl->setStateNoticeImpl(items);
 }
 
-bool RtpStateReplicatorListenerI::operator==(RtpStateReplicatorListenerI &rhs)
+bool RtpStateReplicatorListenerI::operator==(const RtpStateReplicatorListenerI &rhs)
 {
     return mImpl->mId == rhs.mImpl->mId;
 }

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


-- 
asterisk-scf/release/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list