Bug 917794: make packet filter for RTP vs RTCP match webrtc.org impl r?pkerr draft
authorRandell Jesup <rjesup@jesup.org>
Wed, 03 Feb 2016 18:01:07 -0500
changeset 328697 8332de47e901dc0cf74cddc1a7c74782ef47a1bb
parent 328605 271f1c468692223aecd0562c58f7f2ef07dccc0a
child 328745 20a6c7912947ad330f232f22eb9f2db071b97f0a
push id10393
push userrjesup@wgate.com
push dateWed, 03 Feb 2016 23:01:59 +0000
reviewerspkerr
bugs917794
milestone47.0a1
Bug 917794: make packet filter for RTP vs RTCP match webrtc.org impl r?pkerr
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -603,38 +603,42 @@ void MediaPipeline::RtcpPacketReceived(T
 }
 
 bool MediaPipeline::IsRtp(const unsigned char *data, size_t len) {
   if (len < 2)
     return false;
 
   // Check if this is a RTCP packet. Logic based on the types listed in
   // media/webrtc/trunk/src/modules/rtp_rtcp/source/rtp_utility.cc
-
-  // Anything outside this range is RTP.
-  if ((data[1] < 192) || (data[1] > 207))
-    return true;
+  // and needs to conform with RFC 5761 (RTP/RTCP Mux)
 
-  if (data[1] == 192)  // FIR
-    return false;
+  // Anything outside this range is RTP, and this catches them first
+  if ((data[1] < 192) || (data[1] > 207)) {
+    return true;
+  }
 
-  if (data[1] == 193)  // NACK, but could also be RTP. This makes us sad
-    return true;       // but it's how webrtc.org behaves.
+  if (data[1] == 192) { // RFC 2032 FIR
+    return false;
+  }
 
-  if (data[1] == 194)
+  if (data[1] == 193 || data[1] == 194) { // RFC 2032 NACK and SMPTETC -- not supported
     return true;
+  }
 
-  if (data[1] == 195)  // IJ.
+  if (data[1] == 195) { // IJ (Extended Intra-Jitter RFC 5450)
     return false;
+  }
 
-  if ((data[1] > 195) && (data[1] < 200))  // the > 195 is redundant
+  if ((data[1] > 195) && (data[1] < 200)) { // the > 195 is redundant
     return true;
+  }
 
-  if ((data[1] >= 200) && (data[1] <= 207))  // SR, RR, SDES, BYE,
-    return false;                            // APP, RTPFB, PSFB, XR
+  if ((data[1] >= 200) && (data[1] <= 207)) { // SR, RR, SDES, BYE,
+    return false;                             // APP, RTPFB, PSFB, XR
+  }
 
   MOZ_ASSERT(false);  // Not reached, belt and suspenders.
   return true;
 }
 
 void MediaPipeline::PacketReceived(TransportLayer *layer,
                                    const unsigned char *data,
                                    size_t len) {