Bug 1332905 - For mono or stereo in AudioStream.cpp until the rest of the code is multichannel-aware. r=achronop a=tomcat
authorPaul Adenot <paul@paul.cx>
Mon, 23 Jan 2017 11:36:58 +0100
changeset 377906 36486fdc3813ef7943ae5b07b4128866d1938a6c
parent 377905 38db7f01d45d75547b026fbc9d739fe90e93675c
child 377907 f80dc9fc34680105b714a49b4704bb843f5f7004
child 379619 0b284d45431ef73097cb313ec9b1390bb5cbba24
child 379664 f0a51d9d7c23a22e43a19e6826f84cf16926bb36
child 391133 69800debbe54f118693ad697b823ad7266232957
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersachronop, tomcat
bugs1332905
milestone53.0a1
first release with
nightly linux32
36486fdc3813 / 53.0a1 / 20170123125947 / files
nightly linux64
36486fdc3813 / 53.0a1 / 20170123125947 / files
nightly mac
36486fdc3813 / 53.0a1 / 20170123030211 / files
nightly win32
36486fdc3813 / 53.0a1 / 20170123030211 / files
nightly win64
36486fdc3813 / 53.0a1 / 20170123030211 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1332905 - For mono or stereo in AudioStream.cpp until the rest of the code is multichannel-aware. r=achronop a=tomcat MozReview-Commit-ID: 5eqBlPnHVk2
dom/media/AudioStream.cpp
dom/media/GraphDriver.cpp
--- a/dom/media/AudioStream.cpp
+++ b/dom/media/AudioStream.cpp
@@ -349,20 +349,19 @@ AudioStream::Init(uint32_t aNumChannels,
 
   cubeb* cubebContext = CubebUtils::GetCubebContext();
   if (!cubebContext) {
     NS_WARNING("Can't get cubeb context!");
     CubebUtils::ReportCubebStreamInitFailure(true);
     return NS_ERROR_DOM_MEDIA_CUBEB_INITIALIZATION_ERR;
   }
 
-  cubeb_channel_layout layout;
-  int r = cubeb_get_preferred_channel_layout(cubebContext, &layout);
-  MOZ_ASSERT(r == CUBEB_OK || r == CUBEB_ERROR_NOT_SUPPORTED);
-  params.layout = (r == CUBEB_OK) ? layout : CUBEB_LAYOUT_UNDEFINED;
+  // The DecodedAudioDataSink forces mono or stereo for now.
+  params.layout = params.channels == 1 ? CUBEB_LAYOUT_MONO
+                                       : CUBEB_LAYOUT_STEREO;
 
   return OpenCubeb(cubebContext, params, startTime, CubebUtils::GetFirstStream());
 }
 
 nsresult
 AudioStream::OpenCubeb(cubeb* aContext, cubeb_stream_params& aParams,
                        TimeStamp aStartTime, bool aIsFirst)
 {
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -634,20 +634,18 @@ AudioCallbackDriver::Init()
 
   output.channels = mGraphImpl->AudioChannelCount();
   if (AUDIO_OUTPUT_FORMAT == AUDIO_FORMAT_S16) {
     output.format = CUBEB_SAMPLE_S16NE;
   } else {
     output.format = CUBEB_SAMPLE_FLOAT32NE;
   }
 
-  cubeb_channel_layout layout;
-  int r = cubeb_get_preferred_channel_layout(cubebContext, &layout);
-  MOZ_ASSERT(r == CUBEB_OK || r == CUBEB_ERROR_NOT_SUPPORTED);
-  output.layout = (r == CUBEB_OK) ? layout : CUBEB_LAYOUT_UNDEFINED;
+  // Graphs are always stereo for now.
+  output.layout = CUBEB_LAYOUT_STEREO;
 
   Maybe<uint32_t> latencyPref = CubebUtils::GetCubebMSGLatencyInFrames();
   if (latencyPref) {
     latency_frames = latencyPref.value();
   } else {
     if (cubeb_get_min_latency(cubebContext, output, &latency_frames) != CUBEB_OK) {
       NS_WARNING("Could not get minimal latency from cubeb.");
       return false;