Closed Bug 1567949 Opened 6 years ago Closed 6 years ago

Implement `AudioDestinationNode.channelCount` correctly

Categories

(Core :: Web Audio, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox70 --- wontfix
firefox71 --- wontfix
firefox72 --- fixed

People

(Reporter: padenot, Assigned: padenot)

References

Details

Attachments

(14 files, 3 obsolete files)

47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review
47 bytes, text/x-phabricator-request
Details | Review

This has the following parts:

  • Defaults the channelCount to 2 regardless of the hardware. This is what the spec says, in fact.
  • Map the channel count to well known channel topologies. It would be best if non-mapped channels was supported, but it does not seem to be the case. For Firefox, this means that 1 would be mono, 2 would be stereo, etc. For now, we always use the UNDEFINED layout, that is correct because it means independent discrete channels, but we've seen drivers that don't like it. This should fix bug 1563906.
  • When outputChannel is set on a particular AudioDestinationNode, change the number of output channel the graph outputs to, and perform upmix on the other AudioContext, like we do for input.
See Also: → 1418113

Bugbug thinks this bug is a enhancement, but please change it back in case of error.

Type: defect → enhancement
Type: enhancement → defect
See Also: → 1572884
Attachment #9103250 - Attachment description: Bug 1567949 - Don't change the channel count when it's not necessary. r?pehrsons → Bug 1567949 - Don't change the channel count when it's not necessary. r?pehrsons
See Also: → 1435598

This is in line with the meaning of channelCount in the Web Audio API
specification.

It is now the channel count of the underlying chunks or 0 of there are no
segment (but this should be avoided, so the non-fatal assert is kept).

An assert is added to make sure there are no segments with varying number of
chunks.

This is the big part:

  • Methods are added to register/unregister an audio output, and to unregister
    all audio output for a stream. The previous way of determining what track to
    output is removed.
  • Information about audio output stream now lives on the graph itself, and not
    at multiple locations.
  • PlayAudio is refactored slightly but largely untouched
  • AudioOutputChannelCount now works in a way that is similar to its input
    counterpart: it's the maximum of the channel count that needs to be output.

This channel count solely depends on what the graph is doing, it's not static
anymore.

Not stricly needed but easy to do now.

Attachment #9103251 - Attachment is obsolete: true
Attachment #9106604 - Attachment is obsolete: true
Attachment #9106601 - Attachment description: Bug 1567949 - Expose the number of inputs channels of an AudioNode, on the audio rendering thread side. r?pehrsons → Bug 1567949 - Expose the number of input channels of an AudioNode, on the audio rendering thread side. r?pehrsons
Attachment #9103599 - Attachment is obsolete: true
Attachment #9106602 - Attachment description: Bug 1567949 - Clarify the semantics of AudioSegment::ChannelCount. r?pehrsons → Bug 1567949 - Clarify the semantics of AudioSegment::ChannelCount, and rename it. r?pehrsons

This is because the resampler is used from a different file and also because
there was a stray #include "AudioStream.h" that was bringing in a bunch of
stuff.

It is technically possible to have different channel count per chunk, so we
should reinitialize the resampler when that happens. This is a bit awkward
because the rates are on the track, but the data is in the chunks, and the track
cannot access the chunks, so we have to plumb the resampler state down.

Pushed by padenot@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5eb0391b5e39 Default to 2 channels when creating an AudioContext. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/1b8eab609e03 Don't change the channel count when it's not necessary. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/dcbf81da8664 Pass an output channel count to new AudioCallbackDriver. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/b6f5857fef14 Don't use a global for the key in AudioDestinationNode.cpp, nullptr is fine. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/9155420178fc Expose the number of input channels of an AudioNode, on the audio rendering thread side. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/52fdc0e5fea1 Clarify the semantics of AudioSegment::ChannelCount, and rename it. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/95dc6464704f Don't create/destroy audio outputs during processing, use graph messages to register/unregisters audio outputs instead. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/fd7b69523a09 Prevent using an AudioCallbackDriver when not necessary. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/3602937f5807 Pass in a well known channel mapping based on the number of channels to cubeb in AudioCallbackDriver. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/126c112142c7 Start testing AudioDestinationNode in WPT. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/566a2c6f21db Add a mochitest of a MediaElement playing a MediaSource with a varying number of channels, routed to an AudioContext. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/c68d34ef1005 Fix some includes. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/1bed49fa4f66 Move resampler setup one layer down to be able to set the channel count per chunk. r=pehrsons https://hg.mozilla.org/integration/autoland/rev/d4d413229820 When the audio output channel count of an output changes, try switching to a new driver with the appropriate number of channels. r=pehrsons
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/20339 for changes under testing/web-platform/tests
Upstream web-platform-tests status checks passed, PR will merge once commit reaches central.

Since the status are different for nightly and release, what's the status for beta?
For more information, please visit auto_nag documentation.

Upstream PR merged by moz-wptsync-bot
Regressions: 1598101
See Also: → 1633769
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: