Bug 1172397 - Check for Conduit/Type mismatch on every frame. r=jesup, r=bwc, a=sledru
authorAndreas Pehrson <pehrsons@gmail.com>
Mon, 08 Jun 2015 14:43:48 +0800
changeset 260546 66409cad985ce58c6bc85f23f1e5e4fa57e46ee9
parent 260545 701ae8e6a25da019618093e1b7d86e21a2da74df
child 260547 d5d5e1ab76e8ef4f4694bfd7d673858aae8ac566
push id68
push userryanvm@gmail.com
push dateThu, 18 Jun 2015 14:25:13 +0000
treeherdermozilla-esr38@d5d5e1ab76e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, bwc, sledru
bugs1172397
milestone38.0.1
Bug 1172397 - Check for Conduit/Type mismatch on every frame. r=jesup, r=bwc, a=sledru
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -889,29 +889,29 @@ NewData(MediaStreamGraph* graph, TrackID
         StreamTime offset,
         uint32_t events,
         const MediaSegment& media) {
   if (!active_) {
     MOZ_MTLOG(ML_DEBUG, "Discarding packets because transport not ready");
     return;
   }
 
-  if (track_id_ != TRACK_INVALID) {
-    if (tid != track_id_) {
-      return;
-    }
-  } else if (conduit_->type() !=
-             (media.GetType() == MediaSegment::AUDIO ? MediaSessionConduit::AUDIO :
-                                                       MediaSessionConduit::VIDEO)) {
-    // Ignore data in case we have a muxed stream
+  if (conduit_->type() !=
+      (media.GetType() == MediaSegment::AUDIO ? MediaSessionConduit::AUDIO :
+                                                MediaSessionConduit::VIDEO)) {
+    // Ignore data of wrong kind in case we have a muxed stream
     return;
-  } else {
+  }
+
+  if (track_id_ == TRACK_INVALID) {
     // Don't lock during normal media flow except on first sample
     MutexAutoLock lock(mMutex);
     track_id_ = track_id_external_ = tid;
+  } else if (tid != track_id_) {
+    return;
   }
 
   // TODO(ekr@rtfm.com): For now assume that we have only one
   // track type and it's destined for us
   // See bug 784517
   if (media.GetType() == MediaSegment::AUDIO) {
     AudioSegment* audio = const_cast<AudioSegment *>(
         static_cast<const AudioSegment *>(&media));