Module: sems
Branch: master
Commit: 12f56bd354ed4c19e11f107617bd340e7086b5e2
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=12f56bd354ed4c19e11f107617bd340e7086b5e2

Author: Václav Kubart <[email protected]>
Committer: Václav Kubart <[email protected]>
Date:   Mon Jun 25 15:31:53 2012 +0200

non-audio media: propagate attributes and connection address when RTP relaying 
is active

Attempt to use original connection address and attributes when RTP relay is
active and non-audio/non-RTP streams are present in received SDP.

Should cause that non-audio media are sent directly between both remotes
instead of being more or less ignored.

Tested just with simulator.

---

 core/AmB2BMedia.cpp |   11 ++++++++++-
 core/AmSdp.cpp      |   13 ++++++++-----
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/core/AmB2BMedia.cpp b/core/AmB2BMedia.cpp
index ca972e9..040499e 100644
--- a/core/AmB2BMedia.cpp
+++ b/core/AmB2BMedia.cpp
@@ -507,6 +507,8 @@ void AmB2BMedia::replaceConnectionAddress(AmSdp 
&parser_sdp, bool a_leg, const s
   static const string void_addr("0.0.0.0");
   mutex.lock();
 
+  SdpConnection orig_conn = parser_sdp.conn; // needed for the 'quick 
workaround' for non-audio media
+
   // place relay_address in connection address
   if (!parser_sdp.conn.address.empty() && (parser_sdp.conn.address != 
void_addr)) {
     parser_sdp.conn.address = relay_address;
@@ -521,7 +523,14 @@ void AmB2BMedia::replaceConnectionAddress(AmSdp 
&parser_sdp, bool a_leg, const s
   for (; (it != parser_sdp.media.end()) && (streams != audio.end()) ; ++it) {
   
     // FIXME: only audio streams are handled for now
-    if (it->type != MT_AUDIO) continue;
+    if (it->type != MT_AUDIO) {
+      // quick workaround to allow direct connection of non-audio streams (i.e.
+      // those which are not relayed or transcoded): propagate connection
+      // address - might work but need not (to be tested with real clients
+      // instead of simulators)
+      if (it->conn.address.empty()) it->conn = orig_conn;
+      continue;
+    }
 
     if(it->port) { // if stream active
       if (!it->conn.address.empty() && (parser_sdp.conn.address != void_addr)) 
{
diff --git a/core/AmSdp.cpp b/core/AmSdp.cpp
index 73493ca..55e1ed1 100644
--- a/core/AmSdp.cpp
+++ b/core/AmSdp.cpp
@@ -265,8 +265,9 @@ void AmSdp::print(string& body) const
       
       out_buf += "m=" + media_t_2_str(media_it->type) + " " + 
int2str(media_it->port) + " " + transport_p_2_str(media_it->transport);
 
+      string options;
+
       if (media_it->transport == TP_RTPAVP || media_it->transport == 
TP_RTPSAVP) {
-       string options;
        for(std::vector<SdpPayload>::const_iterator pl_it = 
media_it->payloads.begin();
            pl_it != media_it->payloads.end(); pl_it++) {
 
@@ -291,6 +292,12 @@ void AmSdp::print(string& body) const
          }
          
        }
+      }
+      else {
+        // for other transports (UDP/UDPTL) just print out fmt
+        out_buf += " " + media_it->fmt;
+        // ... and continue with c=, attributes, ...
+      }
 
       if (!media_it->conn.address.empty())
         out_buf += "\r\nc=IN IP4 "+media_it->conn.address;
@@ -336,10 +343,6 @@ void AmSdp::print(string& body) const
       case SdpMedia::DirBoth:  out_buf += "a=direction:both\r\n"; break;
       case SdpMedia::DirUndefined: break;
       }
-    } else {
-        // for other transports (UDP/UDPTL) just print out fmt
-        out_buf += " " + media_it->fmt + "\r\n";
-      }
   }
 
   body = out_buf;

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to