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

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Mon Mar 18 16:18:00 2013 +0100

zrtp: do not buffer ZRTP packets if ZRTP has not been compiled in.

The packets are still relayed if rtp-relay is enabled.

---

 core/AmRtpPacket.cpp |    1 +
 core/AmRtpPacket.h   |    1 +
 core/AmRtpStream.cpp |    8 ++++++++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/core/AmRtpPacket.cpp b/core/AmRtpPacket.cpp
index 5ac6559..8cbb46c 100644
--- a/core/AmRtpPacket.cpp
+++ b/core/AmRtpPacket.cpp
@@ -102,6 +102,7 @@ int AmRtpPacket::parse()
   sequence = ntohs(hdr->seq);
   timestamp = ntohl(hdr->ts);
   ssrc = ntohl(hdr->ssrc);
+  version = hdr->version;
 
   if (data_offset >= b_size) {
     ERROR("bad rtp packet (header size too big) !\n");
diff --git a/core/AmRtpPacket.h b/core/AmRtpPacket.h
index 8d111bd..c5c1ac4 100644
--- a/core/AmRtpPacket.h
+++ b/core/AmRtpPacket.h
@@ -52,6 +52,7 @@ public:
   unsigned short sequence;    
   unsigned int   timestamp;   
   unsigned int   ssrc;
+  unsigned char  version;
 
   struct timeval recv_time;
   struct sockaddr_storage addr;
diff --git a/core/AmRtpStream.cpp b/core/AmRtpStream.cpp
index 4be3695..9d57155 100644
--- a/core/AmRtpStream.cpp
+++ b/core/AmRtpStream.cpp
@@ -777,6 +777,14 @@ void AmRtpStream::bufferPacket(AmRtpPacket* p)
     }
   }
 
+#ifndef WITH_ZRTP
+  // throw away ZRTP packets 
+  if(p->version != RTP_VERSION) {
+      mem.freePacket(p);
+      return;
+  }
+#endif
+
   receive_mut.lock();
   // NOTE: useless, as DTMF events are pushed into 'rtp_ev_qu'
   // free packet on double packet for TS received

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

Reply via email to