Closed Bug 1419378 Opened 8 years ago Closed 8 years ago

Return failure in AudioCallbackDriver::Init when out channels is 0

Categories

(Core :: Audio/Video: MediaStreamGraph, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: achronop, Assigned: achronop)

Details

Attachments

(1 file)

In AudioCallbackDriver the mOutputChannels are set during during Init() method. The value is queried from MSG corresponding method which can return 0. Right now we hide the error by resetting to 1 when we get a 0 [1]. This is wrong, it would be better to return error instead of resetting the value. [1] https://searchfox.org/mozilla-central/source/dom/media/GraphDriver.cpp#618
Rank: 25
Priority: -- → P3
Comment on attachment 8930449 [details] Bug 1419378 - Fail before stream init when output number of channels is zero. https://reviewboard.mozilla.org/r/201602/#review207892 ::: dom/media/GraphDriver.cpp:622 (Diff revision 1) > // Query and set the number of channels this AudioCallbackDriver will use. > - mOutputChannels = std::max<uint32_t>(1, mGraphImpl->AudioChannelCount()); > + mOutputChannels = mGraphImpl->AudioChannelCount(); > + if (!mOutputChannels) { > + LOG(LogLevel::Warning, ("Output number of channels is 0.")); > + return false; > + } How is that better? Have you tested that this changes things? I think you should do something like: https://searchfox.org/mozilla-central/source/dom/media/GraphDriver.cpp#693
Attachment #8930449 - Flags: review?(padenot) → review-
Assignee: nobody → achronop
Comment on attachment 8930449 [details] Bug 1419378 - Fail before stream init when output number of channels is zero. https://reviewboard.mozilla.org/r/201602/#review208184 ::: dom/media/GraphDriver.cpp:622 (Diff revision 1) > // Query and set the number of channels this AudioCallbackDriver will use. > - mOutputChannels = std::max<uint32_t>(1, mGraphImpl->AudioChannelCount()); > + mOutputChannels = mGraphImpl->AudioChannelCount(); > + if (!mOutputChannels) { > + LOG(LogLevel::Warning, ("Output number of channels is 0.")); > + return false; > + } It is better because we do attempt to open a device that reported zero number of channels. Right now we arbitary use mono in that case. Added the fallback to SystemClockDriver which creates an infinite loop of retries. I am not sure how useful it is to retry with zero number of channels. Is there a better way to report that error?
Well, maybe a device will be plugged in?
Comment on attachment 8930449 [details] Bug 1419378 - Fail before stream init when output number of channels is zero. https://reviewboard.mozilla.org/r/201602/#review208858
Attachment #8930449 - Flags: review?(padenot) → review+
Pushed by achronop@gmail.com: https://hg.mozilla.org/integration/autoland/rev/e114b48a4e78 Fail before stream init when output number of channels is zero. r=padenot
Pushed by achronop@gmail.com: https://hg.mozilla.org/integration/autoland/rev/bde36d0fa2eb Fail before stream init when output number of channels is zero. r=padenot
Rebased version pushed.
Flags: needinfo?(achronop)
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: