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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Tue Apr 24 12:09:33 2012 +0200

avoid double insertion of streams into the RTP receiver.

---

 core/AmB2BMedia.cpp    |    8 ++++++--
 core/AmRtpReceiver.cpp |    7 +++++++
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/core/AmB2BMedia.cpp b/core/AmB2BMedia.cpp
index 8a6920e..301d77e 100644
--- a/core/AmB2BMedia.cpp
+++ b/core/AmB2BMedia.cpp
@@ -173,14 +173,18 @@ void AudioStreamData::clear()
 
 void AudioStreamData::stopStreamProcessing()
 {
-  if (stream->hasLocalSocket())
+  if (stream->hasLocalSocket()){
+    DBG("remove stream [%p] from RTP receiver\n", stream);
     AmRtpReceiver::instance()->removeStream(stream->getLocalSocket());
+  }
 }
 
 void AudioStreamData::resumeStreamProcessing()
 {
-  if (stream->hasLocalSocket())
+  if (stream->hasLocalSocket()){
+    DBG("resume stream [%p] into RTP receiver\n",stream);
     AmRtpReceiver::instance()->addStream(stream->getLocalSocket(), stream);
+  }
 }
 
 void AudioStreamData::setStreamRelay(const SdpMedia &m, AmRtpStream *other)
diff --git a/core/AmRtpReceiver.cpp b/core/AmRtpReceiver.cpp
index 2ebaf1a..1b6ce0b 100644
--- a/core/AmRtpReceiver.cpp
+++ b/core/AmRtpReceiver.cpp
@@ -149,6 +149,13 @@ void AmRtpReceiverThread::addStream(int sd, AmRtpStream* 
stream)
 {
   streams_mut.lock();
 
+  if(streams.find(sd) != streams.end()) {
+    ERROR("trying to insert existing stream [%p] with sd=%i\n",
+         stream,sd);
+    streams_mut.unlock();
+    return;
+  }
+
   if(nfds >= MAX_RTP_SESSIONS){
     streams_mut.unlock();
     ERROR("maximum number of sessions reached (%i)\n",

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

Reply via email to