Bug 1319445 - Don't use direct listener for audio in PeerConnection with full duplex. r=jesup,padenot
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 22 Nov 2016 17:56:16 +0100
changeset 329101 e7e9bc8280d2b96d10f844af4f30f566d0a7a560
parent 329100 1670628877e1b443492a8573202c3649e6fc0748
child 329102 0faa85ca0fcfde6982476917b2dd60ea5bec13e9
push id31198
push userkwierso@gmail.com
push dateThu, 12 Jan 2017 23:39:49 +0000
treeherdermozilla-central@721c28b39396 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup, padenot
bugs1319445
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1319445 - Don't use direct listener for audio in PeerConnection with full duplex. r=jesup,padenot MozReview-Commit-ID: 278Rrdzr3lQ
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -43,16 +43,17 @@
 #include "transportlayer.h"
 #include "transportlayerdtls.h"
 #include "transportlayerice.h"
 #include "runnable_utils.h"
 #include "libyuv/convert.h"
 #include "mozilla/SharedThreadPool.h"
 #if !defined(MOZILLA_EXTERNAL_LINKAGE)
 #include "mozilla/PeerIdentity.h"
+#include "mozilla/Preferences.h"
 #include "mozilla/TaskQueue.h"
 #endif
 #include "mozilla/gfx/Point.h"
 #include "mozilla/gfx/Types.h"
 #include "mozilla/UniquePtr.h"
 #include "mozilla/UniquePtrExtensions.h"
 #include "mozilla/Sprintf.h"
 
@@ -1453,21 +1454,32 @@ void MediaPipelineTransmit::AttachToTrac
   description_ += track_id;
   description_ += "]";
 
   // TODO(ekr@rtfm.com): Check for errors
   MOZ_MTLOG(ML_DEBUG, "Attaching pipeline to track "
             << static_cast<void *>(domtrack_) << " conduit type=" <<
             (conduit_->type() == MediaSessionConduit::AUDIO ?"audio":"video"));
 
-  // Register the Listener directly with the source if we can.
-  // We also register it as a non-direct listener so we fall back to that
-  // if installing the direct listener fails. As a direct listener we get access
-  // to direct unqueued (and not resampled) data.
-  domtrack_->AddDirectListener(listener_);
+#if !defined(MOZILLA_EXTERNAL_LINKAGE)
+  // With full duplex we don't risk having audio come in late to the MSG
+  // so we won't need a direct listener.
+  const bool enableDirectListener =
+    !Preferences::GetBool("media.navigator.audio.full_duplex", false);
+#else
+  const bool enableDirectListener = true;
+#endif
+
+  if (enableDirectListener) {
+    // Register the Listener directly with the source if we can.
+    // We also register it as a non-direct listener so we fall back to that
+    // if installing the direct listener fails. As a direct listener we get access
+    // to direct unqueued (and not resampled) data.
+    domtrack_->AddDirectListener(listener_);
+  }
   domtrack_->AddListener(listener_);
 
 #ifndef MOZILLA_INTERNAL_API
   // this enables the unit tests that can't fiddle with principals and the like
   listener_->SetEnabled(true);
 #endif
 }