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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue Jul 24 09:58:43 CDT 2012


branch "alternate_source_cleanup" has been updated
       via  9f20808efe50679ec12f187c003324519bbe5b54 (commit)
      from  a80ff0e6e50f11dfb1c0e67a318f9f239248903b (commit)

Summary of changes:
 src/PJMEDIAEndpoint.cpp    |   17 +++--------------
 src/PJMEDIAEndpoint.h      |    6 +-----
 src/PJMEDIAEnvironment.cpp |   12 +-----------
 src/PJMEDIAEnvironment.h   |    9 ---------
 src/RTPSession.cpp         |    4 ++--
 5 files changed, 7 insertions(+), 41 deletions(-)


- Log -----------------------------------------------------------------
commit 9f20808efe50679ec12f187c003324519bbe5b54
Author: Brent Eagles <beagles at digium.com>
Date:   Tue Jul 24 12:27:59 2012 -0230

    Revert "Experimental changes aimed at constraining resource consumption when..."
    
    This reverts commit a80ff0e6e50f11dfb1c0e67a318f9f239248903b.

diff --git a/src/PJMEDIAEndpoint.cpp b/src/PJMEDIAEndpoint.cpp
index 1ba53fc..97092ec 100644
--- a/src/PJMEDIAEndpoint.cpp
+++ b/src/PJMEDIAEndpoint.cpp
@@ -23,31 +23,20 @@ using namespace AsteriskSCF::PJMEDIARTP;
 using namespace AsteriskSCF::System::V1;
 using namespace AsteriskSCF::PJUtil;
 
-const int MaxThreads = 16;
-
-boost::mutex PJMEDIAEndpoint::mEndpointMutex;
-PJMEDIAEndpointPtr PJMEDIAEndpoint::mEndpointInstance;
-
 PJMEDIAEndpoint::~PJMEDIAEndpoint()
 {
     pjmedia_endpt_destroy(mEndpoint);
 }
 
-PJMEDIAEndpointPtr AsteriskSCF::PJMEDIARTP::PJMEDIAEndpoint::get(const PJMEDIAEnvironmentPtr& env)
+PJMEDIAEndpointPtr AsteriskSCF::PJMEDIARTP::PJMEDIAEndpoint::create(const PJMEDIAEnvironmentPtr& env)
 {
-    boost::lock_guard<boost::mutex> lock(mEndpointMutex);
-    if (mEndpointInstance)
-    {
-        return mEndpointInstance;
-    }
     pjmedia_endpt* t;
-    pj_status_t result =  pjmedia_endpt_create(env->poolFactory(), env->ioQueue(), MaxThreads, &t);
+    pj_status_t result =  pjmedia_endpt_create(env->poolFactory(), 0, 1, &t);
     if (fail(result))
     {
         throw InternalInitializationException("Unable to create media endpoint!");
     }
-    mEndpointInstance.reset(new PJMEDIAEndpoint(t));
-    return mEndpointInstance;
+    return PJMEDIAEndpointPtr(new PJMEDIAEndpoint(t));
 }
 
 PJMEDIAEndpoint::PJMEDIAEndpoint(pjmedia_endpt* endpt) :
diff --git a/src/PJMEDIAEndpoint.h b/src/PJMEDIAEndpoint.h
index 674a82d..93c614e 100644
--- a/src/PJMEDIAEndpoint.h
+++ b/src/PJMEDIAEndpoint.h
@@ -18,7 +18,6 @@
 
 #include "PJMEDIAEnvironment.h"
 #include <boost/shared_ptr.hpp>
-#include <boost/thread/mutex.hpp>
 
 //
 // forward declarations.
@@ -44,16 +43,13 @@ public:
         return mEndpoint;
     }
 
-    static PJMEDIAEndpointPtr get(const PJMEDIAEnvironmentPtr& environ);
+    static PJMEDIAEndpointPtr create(const PJMEDIAEnvironmentPtr& environ);
 
 private:
     pjmedia_endpt* mEndpoint;
 
     PJMEDIAEndpoint(pjmedia_endpt* endpoint);
 
-    static boost::mutex mEndpointMutex;
-    static PJMEDIAEndpointPtr mEndpointInstance;
-
     //
     // Hidden and unimplemented.
     //
diff --git a/src/PJMEDIAEnvironment.cpp b/src/PJMEDIAEnvironment.cpp
index 89f7059..2983073 100644
--- a/src/PJMEDIAEnvironment.cpp
+++ b/src/PJMEDIAEnvironment.cpp
@@ -27,14 +27,6 @@ using namespace AsteriskSCF::PJMEDIARTP;
 using namespace AsteriskSCF::System::V1;
 using namespace AsteriskSCF::PJUtil;
 
-PJMEDIAEnvironment::~PJMEDIAEnvironment()
-{
-    if (mIOQueue)
-    {
-        pj_ioqueue_destroy(mIOQueue);
-    }
-}
-
 //
 // The main work of creating the various objects is done by the factory, not the PJMEDIAEnvironment constructor.
 //
@@ -48,8 +40,7 @@ PJMEDIAEnvironment::PJMEDIAEnvironment(const PJLIBConfigurationPtr& libCfg,
         const RTPConfigurationPtr& configObject) :
     mPJLIBConfig(libCfg),
     mConfiguration(configObject),
-    mCachingPool(new pj_caching_pool),
-    mIOQueue(0)
+    mCachingPool(new pj_caching_pool)
 {
     //
     // I find this practice a little sketchy since the pointers that might be retrieve through the accessors *must*
@@ -62,5 +53,4 @@ PJMEDIAEnvironment::PJMEDIAEnvironment(const PJLIBConfigurationPtr& libCfg,
     // TODO: should these values come from configuration.
     //
     mMemoryPool = pj_pool_create(mPoolFactory, "media_rtp_pjmedia", 1024, 1024, 0);
-    pj_status_t ioqueueStatus = pj_ioqueue_create(mMemoryPool, PJ_IOQUEUE_MAX_HANDLES, &mIOQueue);
 }
diff --git a/src/PJMEDIAEnvironment.h b/src/PJMEDIAEnvironment.h
index 418d48e..67e604a 100644
--- a/src/PJMEDIAEnvironment.h
+++ b/src/PJMEDIAEnvironment.h
@@ -29,7 +29,6 @@ struct pj_pool_factory;
 struct pjmedia_endpt;
 struct pj_pool_t;
 struct pj_caching_pool;
-struct pj_ioqueue_t;
 
 namespace AsteriskSCF
 {
@@ -59,7 +58,6 @@ typedef boost::shared_ptr<PJMEDIAEnvironment> PJMEDIAEnvironmentPtr;
 class PJMEDIAEnvironment
 {
 public:
-    virtual ~PJMEDIAEnvironment();
 
     /**
      * Get generic configuration object.
@@ -112,11 +110,6 @@ public:
         return mMemoryPool;
     }
 
-    pj_ioqueue_t* ioQueue() const
-    {
-        return mIOQueue;
-    }
-
     /**
      * Create an instance of the object based on the Ice properties.
      */
@@ -129,12 +122,10 @@ private:
     
     pj_pool_factory* mPoolFactory;
     pj_pool_t* mMemoryPool;
-    pj_ioqueue_t* mIOQueue;
     boost::shared_ptr<pj_caching_pool> mCachingPool;
 
     PJMEDIAEnvironment(const PJLIBConfigurationPtr& libConfig,
             const RTPConfigurationPtr& configObject);
-
 };
 
 } /* End of namespace PJMEDIARTP */
diff --git a/src/RTPSession.cpp b/src/RTPSession.cpp
index fca1d53..ce5ba9b 100644
--- a/src/RTPSession.cpp
+++ b/src/RTPSession.cpp
@@ -515,7 +515,7 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter,
         const ConfigurationServiceImplPtr& configurationService) :
     mOperationContextCache(OperationContextCache::create(DEFAULT_TTL_SECONDS)),
     mEnvironment(env),
-    mEndpoint(PJMEDIAEndpoint::get(env)),
+    mEndpoint(PJMEDIAEndpoint::create(env)),
     mId(id),
     mAdapter(adapter),
     mFormats(params->formats),
@@ -574,7 +574,7 @@ RTPSessionImpl::RTPSessionImpl(const Ice::ObjectAdapterPtr& adapter,
 	const RTPReplicationContextPtr& replicationContext,
         const ConfigurationServiceImplPtr& configurationService) :
     mEnvironment(env),
-    mEndpoint(PJMEDIAEndpoint::get(env)),
+    mEndpoint(PJMEDIAEndpoint::create(env)),
     mId(sessionIdentity),
     mAdapter(adapter),
     mFormats(formats),

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list