Bug 1277284 - Reset the volume when starting a new audio stream for a MediaStreamGraph. r?jesup draft
authorPaul Adenot <paul@paul.cx>
Thu, 02 Jun 2016 15:46:17 +0200
changeset 374445 b2d8dc3c56a1d411ebeb6f2db9aa489c531a8340
parent 374444 8dc1e37613b3ceeb1ed3ef524d658cbb3326aec4
child 375075 3cbabb5591e96b28f7527b2c950a349fa7c3519b
push id20022
push userpaul@paul.cx
push dateThu, 02 Jun 2016 13:46:39 +0000
reviewersjesup
bugs1277284
milestone49.0a1
Bug 1277284 - Reset the volume when starting a new audio stream for a MediaStreamGraph. r?jesup This prevents having the volume set to zero in some cases. MozReview-Commit-ID: 4JSCDcd7jmT
dom/media/GraphDriver.cpp
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -621,16 +621,19 @@ AudioCallbackDriver::Init()
         cubeb_stream_init(CubebUtils::GetCubebContext(), &stream,
                           "AudioCallbackDriver",
                           input_id,
                           mGraphImpl->mInputWanted ? &input : nullptr,
                           output_id,
                           mGraphImpl->mOutputWanted ? &output : nullptr, latency,
                           DataCallback_s, StateCallback_s, this) == CUBEB_OK) {
       mAudioStream.own(stream);
+      int rv = cubeb_stream_set_volume(mAudioStream, CubebUtils::GetVolumeScale());
+      NS_WARN_IF_FALSE(rv == CUBEB_OK,
+          "Could not set the audio stream volume in GraphDriver.cpp");
     } else {
 #ifdef MOZ_WEBRTC
       StaticMutexAutoUnlock unlock(AudioInputCubeb::Mutex());
 #endif
       NS_WARNING("Could not create a cubeb stream for MediaStreamGraph, falling back to a SystemClockDriver");
       // Fall back to a driver using a normal thread.
       MonitorAutoLock lock(GraphImpl()->GetMonitor());
       SetNextDriver(new SystemClockDriver(GraphImpl()));