From f012888dd8e8a1051d221b03c8dce06f788d38c9 Mon Sep 17 00:00:00 2001 From: Paul Adenot Date: Mon, 23 Jan 2017 11:36:58 +0100 Subject: [PATCH] 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 | 7 +++---- dom/media/GraphDriver.cpp | 6 ++---- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 1406df4a7085..671854030c43 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -354,10 +354,9 @@ AudioStream::Init(uint32_t aNumChannels, uint32_t aRate, 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()); } diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 626896b88241..708621bae2de 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -639,10 +639,8 @@ AudioCallbackDriver::Init() 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 latencyPref = CubebUtils::GetCubebMSGLatencyInFrames(); if (latencyPref) {