Bug 1319445 - Don't use direct listener for audio in PeerConnection with full duplex. r=jesup,padenot
☠☠ backed out by 5bdd39969d24 ☠ ☠
authorAndreas Pehrson <pehrsons@gmail.com>
Tue, 22 Nov 2016 17:56:16 +0100
changeset 328546 3c51f1d45483bdb0e962ca7b6201a590e70c42f9
parent 328545 330351fb8ba3af6c2f851f21856f4887e0f3a664
child 328547 eef566d8459a1d17f3677fc5bb4d9b15b9c451df
push id35809
push userpehrsons@gmail.com
push dateMon, 09 Jan 2017 15:29:31 +0000
treeherderautoland@3c51f1d45483 [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"
 
@@ -1449,21 +1450,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
 }