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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Fri Apr 20 12:02:39 2012 +0200

b/f: avoid switching to transcoding for unhandled payloads

---

 core/AmRtpAudio.cpp  |   11 +++++++++--
 core/AmRtpStream.cpp |    7 +++++--
 2 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp
index b9894ea..01cc633 100644
--- a/core/AmRtpAudio.cpp
+++ b/core/AmRtpAudio.cpp
@@ -201,6 +201,12 @@ int AmRtpAudio::receive(unsigned long long system_ts)
     playout_buffer->write(wallclock_ts, adjusted_rtp_ts,
                          (ShortSample*)((unsigned char *)samples),
                          PCM16_B2S(size), begin_talk);
+
+    if(!active) {
+      DBG("switching to active-mode\t(ts=%u;stream=%p)\n",
+         rtp_ts,this);
+      active = true;
+    }
   }
   return size;
 }
@@ -209,9 +215,10 @@ int AmRtpAudio::get(unsigned long long system_ts, unsigned 
char* buffer,
                    int output_sample_rate, unsigned int nb_samples)
 {
   if (!(receiving || getPassiveMode())) return 0; // like nothing received
-  if (!active) return 0;
-    
+
   int ret = receive(system_ts);
+  if (!active) return 0;
+
   if(ret < 0){
     switch(ret){
 
diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp
index fac718d..4016416 100644
--- a/core/AmRtpStream.cpp
+++ b/core/AmRtpStream.cpp
@@ -721,7 +721,11 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
 
   if (relay_enabled) {
     if (relay_payloads.get(p->payload)) {
-      active = false;
+      if(active){
+       DBG("switching to relay-mode\t(ts=%u;stream=%p)\n",
+           p->timestamp,this);
+       active = false;
+      }
       handleSymmetricRtp(p);
 
       if (NULL != relay_stream) {
@@ -731,7 +735,6 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
       return;
     }
   }
-  active = true;
 
   receive_mut.lock();
   // free packet on double packet for TS received

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

Reply via email to