Browse code

b/f: reactivate 'a=direction:...' support.

Raphael Coeffic authored on 13/12/2011 10:07:05
Showing 3 changed files
... ...
@@ -112,8 +112,7 @@ string SdpAttribute::print() const {
112 112
 // class AmSdp: Methods
113 113
 //
114 114
 AmSdp::AmSdp()
115
-  : version(0),
116
-    remote_active(false)
115
+  : version(0)
117 116
 {
118 117
   l_origin.user = "sems";
119 118
   l_origin.sessId = get_random();
... ...
@@ -126,8 +125,7 @@ AmSdp::AmSdp(const AmSdp& p_sdp_msg)
126 125
     l_origin(p_sdp_msg.l_origin),
127 126
     sessionName(p_sdp_msg.sessionName),
128 127
     conn(p_sdp_msg.conn),
129
-    media(p_sdp_msg.media),
130
-    remote_active(false)
128
+    media(p_sdp_msg.media)
131 129
 {
132 130
 }
133 131
 
... ...
@@ -275,7 +273,6 @@ void AmSdp::clear()
275 273
   conn = SdpConnection();
276 274
   attributes.clear();
277 275
   media.clear();
278
-  remote_active = false;
279 276
   l_origin = SdpOrigin();
280 277
 }
281 278
 
... ...
@@ -171,10 +171,6 @@ public:
171 171
   std::vector<SdpMedia> media;  // m= ... [a=rtpmap:...]+
172 172
   //TODO: t= lines
173 173
 
174
-  // Is remote host requesting 
175
-  // us to do passive RTP ?
176
-  bool remote_active;
177
-
178 174
   SdpOrigin        l_origin;      // local origin (o= )
179 175
     
180 176
   AmSdp();
... ...
@@ -1007,7 +1007,20 @@ bool AmSession::getSdpAnswer(const AmSdp& offer, AmSdp& answer)
1007 1007
   answer_media.port = RTPStream()->getLocalPort();
1008 1008
   answer_media.nports = 0;
1009 1009
   answer_media.transport = TP_RTPAVP;
1010
-  answer_media.dir = SdpMedia::DirBoth;
1010
+
1011
+  switch(m_it->dir){
1012
+  case SdpMedia::DirBoth:
1013
+    answer_media.dir = SdpMedia::DirBoth;
1014
+    break;
1015
+  case SdpMedia::DirActive:
1016
+    answer_media.dir = SdpMedia::DirPassive;
1017
+    break;
1018
+  case SdpMedia::DirPassive:
1019
+    answer_media.dir = SdpMedia::DirActive;
1020
+    break;
1021
+  }
1022
+
1023
+  RTPStream()->setPassiveMode(answer_media.dir == SdpMedia::DirPassive);
1011 1024
 
1012 1025
   // Calculate the intersection with the offered set of payloads
1013 1026