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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Thu Jun 16 13:56:18 2011 +0200

b/f: fixes issue with dynamic payloads id (thanks to Emil)

---

 core/AmRtpAudio.cpp  |   12 ------------
 core/AmRtpStream.cpp |   11 ++++++++---
 2 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp
index f7b55b9..310512d 100644
--- a/core/AmRtpAudio.cpp
+++ b/core/AmRtpAudio.cpp
@@ -189,20 +189,8 @@ int AmRtpAudio::setCurrentPayload(int payload)
   else {
     return 0;
   }
-
-  // int res = 
-  //   ((AmAudioRtpFormat *) fmt.get())->setCurrentPayload(payload);
-  // if (!res) {
-  //   amci_codec_t* codec = fmt->getCodec();
-  //   use_default_plc = !(codec && codec->plc);
-  // }
-  // return res;
 }
 
-//int AmRtpAudio::getCurrentPayload() {
-  //return ((AmAudioRtpFormat *) fmt.get())->getCurrentPayload();
-//}
-
 unsigned int AmRtpAudio::conceal_loss(unsigned int ts_diff, unsigned char 
*buffer)
 {
   int s=0;
diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp
index a8c64e2..56f5ef0 100644
--- a/core/AmRtpStream.cpp
+++ b/core/AmRtpStream.cpp
@@ -325,8 +325,12 @@ int AmRtpStream::send( unsigned int ts, unsigned char* 
buffer, unsigned int size
   if(!size)
     return -1;
 
-  return compile_and_send(payload, false, ts, buffer, size);
-
+  PayloadMappingTable::iterator it = pl_map.find(payload);
+  if ((it == pl_map.end()) || (it->second.remote_pt < 0)) {
+    return -1;
+  }
+  
+  return compile_and_send(it->second.remote_pt, false, ts, buffer, size);
 }
 
 int AmRtpStream::send_raw( char* packet, unsigned int length )
@@ -595,7 +599,7 @@ int AmRtpStream::init(AmPayloadProviderInterface* 
payload_provider,
 
   // second pass on remote SDP
   sdp_it = remote_media.payloads.begin();
-  while(sdp_it != remote_media.payloads.begin()) {
+  while(sdp_it != remote_media.payloads.end()) {
 
     PayloadMappingTable::iterator pmt_it = pl_map.end();
     if(sdp_it->encoding_name.empty()){ // must be a static payload
@@ -615,6 +619,7 @@ int AmRtpStream::init(AmPayloadProviderInterface* 
payload_provider,
     if(pmt_it != pl_map.end()){
       pmt_it->second.remote_pt = sdp_it->payload_type;
     }
+    ++sdp_it;
   }
 
   //TODO: support mute, on_hold & sendrecv/sendonly/recvonly/inactive

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

Reply via email to