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

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Thu May 19 13:57:38 CDT 2011


branch "nat-traversal" has been updated
       via  a3b4754ceedd12d7cef5c63fdc89a01978bb736a (commit)
      from  eae5bfb16008f4e09219cfef615488d5d6032514 (commit)

Summary of changes:
 src/PJMediaTransport.cpp |   24 +++++++++++++++++++-----
 src/PJMediaTransport.h   |    2 ++
 2 files changed, 21 insertions(+), 5 deletions(-)


- Log -----------------------------------------------------------------
commit a3b4754ceedd12d7cef5c63fdc89a01978bb736a
Author: Brent Eagles <beagles at digium.com>
Date:   Wed May 18 18:21:21 2011 -0230

    Added a bit of debug mode only tracing to help watch for issues. I'll convert
    to actual logging shortly.

diff --git a/src/PJMediaTransport.cpp b/src/PJMediaTransport.cpp
index 803c4c3..5280b4c 100644
--- a/src/PJMediaTransport.cpp
+++ b/src/PJMediaTransport.cpp
@@ -18,6 +18,9 @@
 #include <pjmedia.h>
 #include <pjlib.h>
 #include <string>
+#ifndef _NDEBUG
+#include <iostream>
+#endif
 
 using namespace std;
 using namespace AsteriskSCF::PJMediaRTP;
@@ -36,26 +39,37 @@ pjmedia_transport* PJMediaTransport::getTransport() const
 PJMediaTransport::PJMediaTransport(pjmedia_transport* t) :
     mTransport(t)
 {
+#ifndef _NDEBUG
+    //
+    // TODO: temporary
+    //
+    cerr << "Creating PJMediaTransport for " << getLocalAddressImpl()->toString() << endl;
+#endif
 }
 
 AddressPtr PJMediaTransport::localAddress() const
 {
+    return getLocalAddressImpl();
+}
+
+AddressPtr PJMediaTransport::remoteAddress() const
+{
     pjmedia_transport_info info;
     pjmedia_transport_info_init(&info);
     pjmedia_transport_get_info(mTransport, &info);
 
-    string address = pj_inet_ntoa(info.sock_info.rtp_addr_name.ipv4.sin_addr);
-    int port = pj_ntohs(info.sock_info.rtp_addr_name.ipv4.sin_port);
+    string address = pj_inet_ntoa(info.src_rtp_name.ipv4.sin_addr);
+    int port = pj_ntohs(info.src_rtp_name.ipv4.sin_port);
     return AddressPtr(new Address(address, port));
 }
 
-AddressPtr PJMediaTransport::remoteAddress() const
+AddressPtr PJMediaTransport::getLocalAddressImpl() const
 {
     pjmedia_transport_info info;
     pjmedia_transport_info_init(&info);
     pjmedia_transport_get_info(mTransport, &info);
 
-    string address = pj_inet_ntoa(info.src_rtp_name.ipv4.sin_addr);
-    int port = pj_ntohs(info.src_rtp_name.ipv4.sin_port);
+    string address = pj_inet_ntoa(info.sock_info.rtp_addr_name.ipv4.sin_addr);
+    int port = pj_ntohs(info.sock_info.rtp_addr_name.ipv4.sin_port);
     return AddressPtr(new Address(address, port));
 }
diff --git a/src/PJMediaTransport.h b/src/PJMediaTransport.h
index fea7ae7..2ff1da7 100644
--- a/src/PJMediaTransport.h
+++ b/src/PJMediaTransport.h
@@ -48,6 +48,8 @@ protected:
 
     PJMediaTransport(pjmedia_transport* t);
 
+    AsteriskSCF::Helpers::AddressPtr getLocalAddressImpl() const;
+
     //
     // Hidden and unimplemented.
     //

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


-- 
asterisk-scf/integration/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list