Closed Bug 1524026 Opened 5 years ago Closed 5 years ago

Web audio didn't produce sound even if AudioContext is resumed from blocked

Categories

(Core :: Web Audio, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: alwu, Assigned: alwu)

References

(Blocks 1 open bug, )

Details

Attachments

(3 files)

Fork from bug1511117 comment1, after clicking a keyborad key, the site would call OscillatorNode.start() which would resume the AudioContext [1].

However, even the AudioContext has been resumed, I still can't hear any sound from web audio.

[1] https://searchfox.org/mozilla-central/rev/78cd247b5d7a08832f87d786541d3e2204842e8e/dom/media/webaudio/OscillatorNode.cpp#491

Hi, Paul,
Could you help me take a look for this issue?
Thank you!

Flags: needinfo?(padenot)

Have found the root cause, will upload a patch and update my analysis later.

Assignee: nobody → alwu
Flags: needinfo?(padenot)

The root cause is that there was a stream which wasn't resumed by the AudioContext because that stream was not belong to a Node, which resulted that AudioContext can't get it when calling GetAllStreams().

The stream is created by the AudioParam [1]. Therefore, this stream blocks other streams which were connected to the GainNode, which resulted that AudioContext didn't output any sound.

[1] https://searchfox.org/mozilla-central/rev/6e3cc153566f5f288ae768a2172385b8436d61dd/dom/media/webaudio/AudioParam.cpp#81

Priority: -- → P2

If the stream has not current AudioNode which means it's not controlled by AudioContext (like MediaRecorder's and AudioParam's stream) so their suspended count don't need to be adjusted by asking AudioContext. Therefore, we only change stream's suspended count when its node exists.

If we don't do so, the stream would have incorrect suspended count because AudioContext won't control the stream and have no way to resume it.

Attachment #9040595 - Attachment description: Bug 1524026 - do not change the suspend count of the stream which is not controlled by the AudioContext. → Bug 1516598 - to allow 'AudioContext::GetAllStreams()' to get helper streams.
Attachment #9040595 - Attachment description: Bug 1516598 - to allow 'AudioContext::GetAllStreams()' to get helper streams. → Bug 1516598 - part1 : to allow 'AudioContext::GetAllStreams()' to get helper streams.
Attachment #9040595 - Attachment description: Bug 1516598 - part1 : to allow 'AudioContext::GetAllStreams()' to get helper streams. → Bug 1524026 - part1 : to allow 'AudioContext::GetAllStreams()' to get helper streams.
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0f0f272b39ac
part1 : to allow 'AudioContext::GetAllStreams()' to get helper streams. r=padenot
https://hg.mozilla.org/integration/autoland/rev/986f3ebb901a
part 2 : add test. r=padenot,smaug
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
Depends on: 1527179
Depends on: 1526044
Regressions: 1545133
Regressions: 1544023
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: