Module: sems
Branch: rco/transcoding
Commit: 9215da1eaca47e95799b9e87288640737cd9d64a
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=9215da1eaca47e95799b9e87288640737cd9d64a

Author: Raphael Coeffic <[email protected]>
Committer: Václav Kubart <[email protected]>
Date:   Tue Apr 17 11:56:02 2012 +0200

b/f: avoid to execute receive loop if the audio format is invalid.

---

 core/AmRtpAudio.cpp |    6 ++++++
 core/AmRtpStream.h  |   11 ++++++-----
 2 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/core/AmRtpAudio.cpp b/core/AmRtpAudio.cpp
index 59db091..ee4fbab 100644
--- a/core/AmRtpAudio.cpp
+++ b/core/AmRtpAudio.cpp
@@ -153,6 +153,12 @@ int AmRtpAudio::receive(unsigned long long system_ts)
   int size;
   unsigned int rtp_ts;
   int new_payload = -1;
+
+  if(!fmt.get()) {
+    DBG("audio format not initialized\n");
+    return RTP_ERROR;
+  }
+
   unsigned int wallclock_ts = scaleSystemTS(system_ts);
 
   while(true) {
diff --git a/core/AmRtpStream.h b/core/AmRtpStream.h
index 827e82b..833b6ca 100644
--- a/core/AmRtpStream.h
+++ b/core/AmRtpStream.h
@@ -48,11 +48,12 @@ using std::pair;
 
 // return values of AmRtpStream::receive
 #define RTP_EMPTY        0 // no rtp packet available
-#define RTP_PARSE_ERROR -1 // error while parsing rtp packet
-#define RTP_TIMEOUT     -2 // last received packet is too old
-#define RTP_DTMF        -3 // dtmf packet has been received
-#define RTP_BUFFER_SIZE -4 // buffer overrun
-#define RTP_UNKNOWN_PL  -5 // unknown payload
+#define RTP_ERROR       -1 // generic error
+#define RTP_PARSE_ERROR -2 // error while parsing rtp packet
+#define RTP_TIMEOUT     -3 // last received packet is too old
+#define RTP_DTMF        -4 // dtmf packet has been received
+#define RTP_BUFFER_SIZE -5 // buffer overrun
+#define RTP_UNKNOWN_PL  -6 // unknown payload
 
 
 /**

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

Reply via email to