[prev in list] [next in list] [prev in thread] [next in thread] 

List:       semsdev
Subject:    [Semsdev] git:master: b/f: fixes gaps in outgoing RTP stream if receiving side fails or DTMF are rec
From:       Raphael Coeffic <rco () iptel ! org>
Date:       2012-05-11 11:00:56
Message-ID: 20120511110056.9C8C3EF8074 () rimmer ! ryngle ! com
[Download RAW message or body]

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


Author: Raphael Coeffic <rco@iptel.org>
Committer: Raphael Coeffic <rco@iptel.org>
Date:   Wed Apr 25 17:25:08 2012 +0200

b/f: fixes gaps in outgoing RTP stream if receiving side fails or DTMF are received.

---

 core/AmRtpAudio.cpp |   59 ++++++++++++++++++++++++++-------------------------
 1 files changed, 30 insertions(+), 29 deletions(-)

diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp
index 9d02c7f..5fd13e2 100644
--- a/core/AmRtpAudio.cpp
+++ b/core/AmRtpAudio.cpp
@@ -166,8 +166,34 @@ int AmRtpAudio::receive(unsigned long long system_ts)
     size = AmRtpStream::receive((unsigned char*)samples,
 				(unsigned int)AUDIO_BUFFER_SIZE, rtp_ts,
 				new_payload);
-    if(size <= 0)
+    if(size <= 0) {
+
+      switch(size){
+
+      case 0: break;
+	
+      case RTP_DTMF:
+      case RTP_UNKNOWN_PL:
+      case RTP_PARSE_ERROR:
+        continue;
+
+      case RTP_TIMEOUT:
+        //FIXME: postRequest(new SchedRequest(AmMediaProcessor::RemoveSession,s));
+        // post to the session (FIXME: is session always set? seems to be...)
+        session->postEvent(new AmRtpTimeoutEvent());
+        return -1;
+
+      case RTP_BUFFER_SIZE:
+      default:
+        ERROR("AmRtpStream::receive() returned %i\n",size);
+        //FIXME: postRequest(new SchedRequest(AmMediaProcessor::ClearSession,s));
+        //       or AmMediaProcessor::instance()->clearSession(session);
+        return -1;
+        break;
+      }
+      
       break;
+    }
 
     if (// don't process if we don't need to
 	// ignore CN
@@ -218,35 +244,10 @@ int AmRtpAudio::get(unsigned long long system_ts, unsigned \
char* buffer,  if (!(receiving || getPassiveMode())) return 0; // like nothing \
received  
   int ret = receive(system_ts);
-  if (!active) return 0;
-
-  if(ret < 0){
-    switch(ret){
+  if(ret < 0)
+    return ret; // like nothing received?
 
-      case RTP_DTMF:
-      case RTP_UNKNOWN_PL:
-      case RTP_PARSE_ERROR:
-        return 0; // like nothing received
-        break;
-
-      case RTP_TIMEOUT:
-        //FIXME: postRequest(new SchedRequest(AmMediaProcessor::RemoveSession,s));
-        // post to the session (FIXME: is session always set? seems to be...)
-        session->postEvent(new AmRtpTimeoutEvent());
-        return -1;
-        break;
-
-      case RTP_BUFFER_SIZE:
-      default:
-        ERROR("AmRtpAudio::receive() returned %i\n",ret);
-        //FIXME: postRequest(new SchedRequest(AmMediaProcessor::ClearSession,s));
-        //       or AmMediaProcessor::instance()->clearSession(session);
-        return -1;
-        break;
-    }
-
-    return 0; // like nothing received?
-  }
+  if (!active) return 0;
 
   unsigned int user_ts = scaleSystemTS(system_ts);
 

_______________________________________________
Semsdev mailing list
Semsdev@lists.iptel.org
http://lists.iptel.org/mailman/listinfo/semsdev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic