[asterisk-scf-commits] asterisk-scf/integration/media_rtp_pjmedia.git branch "modular-transport-refactor" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Jul 4 11:55:34 CDT 2011


branch "modular-transport-refactor" has been updated
       via  1dcbe3dd82f1be73b25948f13370b8bd58ab4ac3 (commit)
      from  38a7ef028c1a0fa6e8e02aa969fbc43413a14aa3 (commit)

Summary of changes:
 src/PJMediaEnvironment.h  |    6 +++---
 src/PJMediaTransport.cpp  |    8 ++++----
 src/SRTPConfiguration.cpp |    2 +-
 src/SessionAdapter.h      |   13 +++++++------
 src/UDPTransport.cpp      |   44 ++++++++++++--------------------------------
 src/UDPTransport.h        |    5 +++++
 6 files changed, 32 insertions(+), 46 deletions(-)


- Log -----------------------------------------------------------------
commit 1dcbe3dd82f1be73b25948f13370b8bd58ab4ac3
Author: Brent Eagles <beagles at digium.com>
Date:   Mon Jul 4 14:25:22 2011 -0230

    Incorporated review feedback.

diff --git a/src/PJMediaEnvironment.h b/src/PJMediaEnvironment.h
index b9be64a..dc4d39d 100644
--- a/src/PJMediaEnvironment.h
+++ b/src/PJMediaEnvironment.h
@@ -84,7 +84,7 @@ public:
     }
             
     /**
-     * Get SRTP relatd configuratino object.
+     * Get SRTP related configuration object.
      */
     SRTPConfigurationPtr srtpConfig() const
     {
@@ -93,7 +93,7 @@ public:
 
     /**
      * Get our library instance's main pool factory. As this function does not return a reference counted pointer, its
-     * value should not be cached at all. It's validity is directly related to the lifetime of the PJMediaEnvironment
+     * value should not be cached at all. Its validity is directly related to the lifetime of the PJMediaEnvironment
      * object.
      */
     pj_pool_factory* poolFactory() const
@@ -103,7 +103,7 @@ public:
     
     /**
      * Get the main memory pool. As this function does not return a reference counted pointer, its value should
-     * not be cached at all. It's validity is directly related to the lifetime of the PJMediaEnvironment object.
+     * not be cached at all. Its validity is directly related to the lifetime of the PJMediaEnvironment object.
      */
     pj_pool_t* memoryPool() const
     {
diff --git a/src/PJMediaTransport.cpp b/src/PJMediaTransport.cpp
index f218831..c646175 100644
--- a/src/PJMediaTransport.cpp
+++ b/src/PJMediaTransport.cpp
@@ -52,13 +52,13 @@ AddressPtr PJMediaTransport::remoteAddress()
     pjmedia_transport_info_init(&info);
     pjmedia_transport_get_info(mTransport, &info);
 
-    if (info.src_rtp_name.addr.sa_family != PJ_AF_INET && 
-      info.src_rtp_name.addr.sa_family != PJ_AF_INET6)
+    if (info.src_rtp_name.addr.sa_family != pj_AF_INET() && 
+      info.src_rtp_name.addr.sa_family != pj_AF_INET6())
     {
         //
         // If we don't have the remote address yet (we know because the default
-        // intialization for the above is neither PF_AF_INET or PF_AF_INET6) then
-        // return 0
+        // intialization for the above is neither pj_AF_INET() or
+        // pj_AF_INET6()) then return 0
         //
         return AddressPtr();
     }
diff --git a/src/SRTPConfiguration.cpp b/src/SRTPConfiguration.cpp
index e2acc49..9ae53ae 100644
--- a/src/SRTPConfiguration.cpp
+++ b/src/SRTPConfiguration.cpp
@@ -24,7 +24,7 @@ SRTPConfigurationPtr AsteriskSCF::PJMediaRTP::SRTPConfiguration::create(const Ic
         const string& propertyPrefix)
 {
     string prefix(propertyPrefix);
-    if (!prefix.empty() && *(--prefix.end()) != '.')
+    if (!prefix.empty() && prefix[prefix.length()-1] != '.')
     {
         prefix += '.';
     }
diff --git a/src/SessionAdapter.h b/src/SessionAdapter.h
index 0c550d1..d164bca 100644
--- a/src/SessionAdapter.h
+++ b/src/SessionAdapter.h
@@ -33,12 +33,13 @@ namespace PJMediaRTP
 class SessionAdapter;
 typedef boost::shared_ptr<SessionAdapter> SessionAdapterPtr;
 
-/**
- * By formalizing the interface between the session servant and the source and sink servants, we can
- * remove the physical compile time interdepencies. For the moment, this means that there will be
- * an indirect circular reference between the three entities. This is fine for the moment because
- * they are actually quite tightly coupled implementation-wise. e.g. setRemoteDetails propogates to the
- * source servant.
+/** 
+ * By formalizing the interface between the session servant and the source and
+ * sink servants, we can remove the physical compile time interdepencies. For
+ * the moment, this means that there will be an indirect circular reference
+ * between the three entities. This is fine for the moment because they are
+ * actually quite tightly coupled implementation-wise. e.g. setRemoteDetails
+ * propagates to the source servant.
  **/
 class SessionAdapter
 {
diff --git a/src/UDPTransport.cpp b/src/UDPTransport.cpp
index 18d9c17..4294c29 100644
--- a/src/UDPTransport.cpp
+++ b/src/UDPTransport.cpp
@@ -31,7 +31,19 @@ UDPTransportPtr AsteriskSCF::PJMediaRTP::UDPTransport::create(const PJMediaEndpo
 {
     const Ice::Int minPort = configObject->getStartPort();
     const Ice::Int maxPort = configObject->getEndPort();
+    return createImpl(ep, configObject, minPort, maxPort, expectIPv6);
+}
 
+UDPTransportPtr AsteriskSCF::PJMediaRTP::UDPTransport::create(const PJMediaEndpointPtr& ep, 
+    const RTPConfigurationPtr& configObject, unsigned port, bool expectIPv6)
+{
+    return createImpl(ep, configObject, port, port + 1, expectIPv6);
+}
+
+UDPTransportPtr AsteriskSCF::PJMediaRTP::UDPTransport::createImpl(const PJMediaEndpointPtr& ep,
+    const RTPConfigurationPtr& configObject, unsigned minPort, unsigned maxPort,
+    bool expectIPv6)
+{
     int addressFamily = pj_AF_INET();
     string bindingAddress;
     if (expectIPv6)
@@ -68,38 +80,6 @@ UDPTransportPtr AsteriskSCF::PJMediaRTP::UDPTransport::create(const PJMediaEndpo
     throw InternalInitializationException("Unable to initialize UDP media transport");
 }
 
-UDPTransportPtr AsteriskSCF::PJMediaRTP::UDPTransport::create(const PJMediaEndpointPtr& ep, 
-    const RTPConfigurationPtr& configObject, unsigned port, bool expectIPv6)
-{
-    int addressFamily = pj_AF_INET();
-    string bindingAddress;
-    if (expectIPv6)
-    {
-        addressFamily = pj_AF_INET6();
-        bindingAddress = configObject->getBindIPv6Address();
-    }
-    else
-    {
-        bindingAddress = configObject->getBindIPv4Address();
-    }
-    pj_str_t pjBindAddress;
-    pj_strset(&pjBindAddress, (char*)bindingAddress.c_str(), bindingAddress.size());
-    pj_str_t* bindAddressPtr = 0;
-    if (!bindingAddress.empty())
-    {
-        bindAddressPtr = &pjBindAddress;
-    }
-
-    pjmedia_transport* transport;
-    pj_status_t result = pjmedia_transport_udp_create3(ep->endpoint(), addressFamily, "RTP", bindAddressPtr, 
-        port, 0, &transport);
-    if (success(result))
-    {
-        return UDPTransportPtr(new UDPTransport(transport));
-    }
-    throw InternalInitializationException("Unable to initialize UDP media transport");
-}
-
 UDPTransport::UDPTransport(pjmedia_transport* t) :
     PJMediaTransport(t)
 {
diff --git a/src/UDPTransport.h b/src/UDPTransport.h
index 6e50e93..57283af 100644
--- a/src/UDPTransport.h
+++ b/src/UDPTransport.h
@@ -56,6 +56,11 @@ public:
         bool expectIPv6); 
 
 private:
+
+    static  UDPTransportPtr createImpl(const PJMediaEndpointPtr& ep,
+        const RTPConfigurationPtr& configObject,
+        unsigned minPort, unsigned maxPort, bool expectIPv6);
+
     UDPTransport(pjmedia_transport* t);
 };
 

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list