Closed Bug 1346880 Opened 7 years ago Closed 4 years ago

Sound is briefly audible in tab even if the tab is muted

Categories

(Core :: Web Audio, defect, P3)

43 Branch
defect

Tracking

()

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: 684sigma, Assigned: alwu)

References

Details

Attachments

(9 files, 1 obsolete file)

560 bytes, application/x-javascript
Details
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
I have a problem with Firefox Beta 52. It also happens in ESR 45.
Sometimes sound is briefly audible in tab even if the tab is muted (Ctrl+M).
It happens unpredictably, however, I noticed one specific scenario when it happens

1. Open http://lagged.com/play/352/ , wait until advertisement finishes
2. Enable sound in the game
3. Disable sound in the game, mute tab, enable sound in the game

Result: Sound is briefly audible
Expected: NO SOUND

Other examples
http://lagged.com/play/352/
http://lagged.com/play/535/
http://lagged.com/play/571/
See Also: → 1346872
Status: UNCONFIRMED → NEW
Has STR: --- → yes
Ever confirmed: true
Summary: Sound is briefly audible in tab even if the tab is muted (sometimes) → Sound is briefly audible in tab even if the tab is muted
Version: 45 Branch → 43 Branch
jw, can you look at this or forward it to someone?  thanks
Component: Audio/Video → Audio/Video: Playback
Flags: needinfo?(jwwang)
Looks like an audio channel/indicator issue.
Assignee: nobody → alwu
Flags: needinfo?(jwwang)
An easier way to reproduce the bug:

1. Open https://mdn.github.io/webaudio-examples/decode-audio-data/
2. Execute attached JavaScript code
3. Click "Play" button on the page. When audio starts, click "Reconnect" button on the page.
4. Click "Mute" button on the page
5. Mute tab, click "Unmute" button on the page, unmute tab.
See Also: → 1354992
Jean-Yves - I can repro this on Windows and Linux. It seems odd that there is a similar Flash relate issue. Can you investigate this issue?
Flags: needinfo?(jyavenard)
Priority: -- → P1
After checking, the audio channel part works well, it indeed mute the AudioDestinationNode in [1]. We set the |aMute=true|, so finally the volume of the audio output would be zero.

I think it might be web audio's bug?

[1] https://goo.gl/owmIPF
Assignee: alwu → nobody
can't repro...
Flags: needinfo?(jyavenard)
Per comment5, change module to web audio.
Component: Audio/Video: Playback → Web Audio
I can't repro on Linux. Alastor, can you still repro ?
Flags: needinfo?(alwu)
Yes, I can still reproduce this issue with Nightly 57.0a1 on OSX 10.11.4 and Windows7.
If it's platform dependency problem, maybe it's related with cubeb?
Flags: needinfo?(alwu)
ah I can repro somehow I was not following the instructions accurately. I can also repro on Linux.
Mass change P1->P2 to align with new Mozilla triage process
Priority: P1 → P2
Moving to p3 because no activity for at least 1 year(s).
See https://github.com/mozilla/bug-handling/blob/master/policy/triage-bugzilla.md#how-do-you-triage for more information
Priority: P2 → P3

Same issue when watching ChannelOne from mixer.com and the hosted channel switches.

Full context for comprehension of the above lingo:

  • Mixer is a streaming platform similar to twitch
  • A channel is the stream of a given user
  • Hosting a channel is a feature that means mirroring their content on another channel
  • ChannelOne is a channel run by mixer themselves which hosts other channels 24/7 and switches to a different one every 15 minutes or so.

It doesn’t happen on every switch but it happens maybe once an hour.

I can reproduce this deterministically on lichess.

Windows 10 (up-to-date, 1903 build 18362.476) in Firefox 70.0.1 (64-bit) and I just confirmed the behavior happens in Nightly as well.

Step 1:
Visit https://lichess.org/analysis/standard

Step 2:
Mute tab (CTRL M), confirm that muted icon appears on the right of the tab.

Step 3:
Make a valid chess move. A clicking sound will happen once the piece is moved. Make more valid chess moves. No more sounds from here on.

If you un-mute and mute the tab again, the similar behavior of only the first move making sound will recur.

Ah superb, I can repro now, will fix. Thank you very much.

Assignee: nobody → padenot

I can reproduce on Firefox 78, with a clean profile on Linux:

  1. Visit https://findtheinvisiblecow.com
  2. Mute the tab
  3. Click "Start game"

The sound is audible for a fraction of a second when you click "start game".

I can't find time to have a look at this. Can you have a look?

Flags: needinfo?(alwu)

Sure, I will check this after finishing other works I'm doing, keep NI.

Severity: normal → S2
Pushed by padenot@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/4e7a614b30f8
Always initialize an AudioChannelAgent when initializing an AudioContext. r=alwu
https://hg.mozilla.org/integration/autoland/rev/7c0018c583b5
Test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices. r=pehrsons,alwu

Backed out for causing audio failures

Backout link: https://hg.mozilla.org/integration/autoland/rev/4ff89c0769c4adbdaf8a4adc516cf76a49c78c27

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception%2Crunning%2Cpending%2Crunnable&revision=7c0018c583b5d9ba143f57bb4107389970361cc6

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=318991273&repo=autoland&lineNumber=3044

TEST-PASS | dom/base/test/browser_timeout_throttling_with_audio_playback.js | Got the correct timeout (10) -
[task 2020-10-19T09:30:03.991Z] 09:30:03 INFO - Console message: [JavaScript Error: "TypeError: can't access property "audioPlaybackStopped", browser is null" {file: "resource://gre/actors/AudioPlaybackParent.jsm" line: 24}]
[task 2020-10-19T09:30:03.991Z] 09:30:03 INFO - receiveMessage@resource://gre/actors/AudioPlaybackParent.jsm:24:9
[task 2020-10-19T09:30:03.992Z] 09:30:03 INFO -
[task 2020-10-19T09:30:03.992Z] 09:30:03 INFO - Console message: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "http://mochi.test:8888/browser/dom/base/test/empty.html" line: 0}]
[task 2020-10-19T09:30:03.992Z] 09:30:03 INFO - Console message: [JavaScript Error: "The character encoding of the HTML document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the page must be declared in the document or in the transfer protocol." {file: "http://mochi.test:8888/browser/dom/base/test/file_webaudio_startstop.html" line: 0}]
[task 2020-10-19T09:30:03.993Z] 09:30:03 INFO - Buffered messages finished
[task 2020-10-19T09:30:03.993Z] 09:30:03 INFO - TEST-UNEXPECTED-FAIL | dom/base/test/browser_timeout_throttling_with_audio_playback.js | Test timed out -
[task 2020-10-19T09:30:03.994Z] 09:30:03 INFO - GECKO(2058) | MEMORY STAT | vsize 3375MB | residentFast 313MB | heapAllocated 86MB
[task 2020-10-19T09:30:03.994Z] 09:30:03 INFO - TEST-OK | dom/base/test/browser_timeout_throttling_with_audio_playback.js | took 45012ms
[task 2020-10-19T09:30:03.996Z] 09:30:03 INFO - Not taking screenshot here: see the one that was previously logged
[task 2020-10-19T09:30:03.996Z] 09:30:03 INFO - TEST-UNEXPECTED-FAIL | dom/base/test/browser_timeout_throttling_with_audio_playback.js | Found a tab after previous test timed out: http://mochi.test:8888/browser/dom/base/test/file_webaudio_startstop.html -
[task 2020-10-19T09:30:03.997Z] 09:30:03 INFO - checking window state
[task 2020-10-19T09:30:03.997Z] 09:30:03 INFO - TEST-START | dom/base/test/browser_use_counters.js

Flags: needinfo?(padenot)
Blocks: 1672169
Blocks: 1672170
Flags: needinfo?(padenot)
Flags: needinfo?(alwu)
Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/60a7c181809b
part1 : keep AudioChannelAgent alive all the time for not offline context. r=padenot
https://hg.mozilla.org/integration/autoland/rev/c5234d9f7e94
part2 : consider output volume for engine when it determines the audible state. r=padenot
https://hg.mozilla.org/integration/autoland/rev/784fd3ab527d
part3 : add a browser sound indicator test for web audio audibility. r=padenot
https://hg.mozilla.org/integration/autoland/rev/21632db91729
part4 : modify current tests. r=padenot
https://hg.mozilla.org/integration/autoland/rev/17088afb6337
Test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices. r=pehrsons,alwu

Backed out for failures on browser_ProcessPriorityManager.js

backout: https://hg.mozilla.org/integration/autoland/rev/f697ed1b844e9fb929c202a6a2f32b92d9fb9567

push: https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=17088afb6337349d8b9d9f1ce06398ae1bf02706&selectedTaskRun=Eg2UxvJ9QB6ib9PVN25rRQ.0

failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=319473422&repo=autoland&lineNumber=3103

[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Should have seen no process priority change for a browser at http://example.com/ - null == null -
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Browser at: about:blank transitioning to FOREGROUND
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Leaving test bound test_audio_background_tab
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Entering test bound test_audio_background_tab
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Browser at: about:blank transitioning to FOREGROUND
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Browser at: about:blank transitioning to BACKGROUND
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Console message: [JavaScript Error: "TypeError: can't access property "audioPlaybackStopped", browser is null" {file: "resource://gre/actors/AudioPlaybackParent.jsm" line: 24}]
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - receiveMessage@resource://gre/actors/AudioPlaybackParent.jsm:24:9
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO -
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Tabs should be running in separate processes. - 3336 != 11060 -
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Browser at: about:blank transitioning to FOREGROUND
[task 2020-10-22T23:13:33.985Z] 23:13:33 INFO - Browser at: http://example.com/ transitioning to BACKGROUND
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - Browser at: http://example.com/ transitioning to FOREGROUND
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Browser at about:blank reached expected priority: FOREGROUND - true == true -
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - Buffered messages finished
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - TEST-UNEXPECTED-FAIL | dom/ipc/tests/browser_ProcessPriorityManager.js | Should have seen no process priority change for a browser at http://example.com/ - "FOREGROUND" == null - JS frame :: chrome://mochitests/content/browser/dom/ipc/tests/browser_ProcessPriorityManager.js :: ensureNoPriorityChange :: line 106
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - Stack trace:
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - chrome://mochitests/content/browser/dom/ipc/tests/browser_ProcessPriorityManager.js:ensureNoPriorityChange:106
[task 2020-10-22T23:13:33.986Z] 23:13:33 INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Tabs should be running in separate processes. - 11060 != 3336 -

Flags: needinfo?(padenot)

Also failing on TV: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=319437223&repo=autoland&lineNumber=2164 with TEST-UNEXPECTED-FAIL | toolkit/content/tests/browser/browser_media_wakelock.js | Test timed out -

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

Hmm, I'm not sure that browser_ProcessPriorityManager.js issue is caused by me, because I've updated my codebase to latest central, and run that test on my local environment without having any of my patches. The failure still happened. Let me debug more to see what I can find.

Flags: needinfo?(alwu)

Ok, that test can only be tested on Windows, I was testing it on MacOS. I will move to my Windows machine and see what happened.

I can confirm browser_ProcessPriorityManager.js would still fail on the latest m-c on Windows without applying my patches, and I've checked the test itself, it's apparently not related with my change at all.

browser_media_wakelock.js also works well on my local environment. In the try result [1], we can see no above failures happened. I believe that was a false backout.

[1] https://treeherder.mozilla.org/#/jobs?repo=try&revision=f97efa49594b8c5fefe41923cf727802619c6f45&selectedTaskRun=BCbHEm6WTmeQAWna9kITIA.0

Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/086261148f93
part1 : keep AudioChannelAgent alive all the time for not offline context. r=padenot
https://hg.mozilla.org/integration/autoland/rev/5feb52637f9f
part2 : consider output volume for engine when it determines the audible state. r=padenot
https://hg.mozilla.org/integration/autoland/rev/0d4801868a6c
part3 : add a browser sound indicator test for web audio audibility. r=padenot
https://hg.mozilla.org/integration/autoland/rev/26d44e5e139d
part4 : modify current tests. r=padenot
https://hg.mozilla.org/integration/autoland/rev/5cf07d575830
Test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices. r=pehrsons,alwu

Hmm, on the autoland, we got another different problem from comment31 which is the browser_media_wakelock.js running to long [1]. I will file another bug to handle that issue.

https://treeherder.mozilla.org/#/jobs?repo=autoland&revision=5cf07d57583090a699a3a233f70756b7bd7e8b08&selectedTaskRun=YT17l8-_QI6pkAGpb0G5bg.0

Blocks: 1522361

Backed out 5 changesets (bug 1346880) for browser_ProcessPriorityManager.js failures.

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&group_state=expanded&selectedTaskRun=e-YUxRvcRL6Hl-seNlnIKw.0&searchStr=windows%2C10%2Cx64%2Casan%2Cmochitests%2Ctest-windows10-64-asan%2Fopt-mochitest-browser-chrome-e10s%2Cbc5&fromchange=c81c365a9616218b15035c19111a488b51252225&tochange=6e838289f9741e9ba7aaf7d58397adec92d15488

Backout link: https://hg.mozilla.org/integration/autoland/rev/6e838289f9741e9ba7aaf7d58397adec92d15488

Failure log: https://treeherder.mozilla.org/logviewer.html#/jobs?job_id=319592161&repo=autoland&lineNumber=4149

...
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - Browser at: about:blank transitioning to BACKGROUND
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - Console message: [JavaScript Error: "TypeError: can't access property "audioPlaybackStopped", browser is null" {file: "resource://gre/actors/AudioPlaybackParent.jsm" line: 24}]
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - receiveMessage@resource://gre/actors/AudioPlaybackParent.jsm:24:9
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - 
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Tabs should be running in separate processes. - 10548 != 10644 - 
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - Browser at: about:blank transitioning to FOREGROUND
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - Browser at: http://example.com/ transitioning to BACKGROUND
[task 2020-10-23T21:58:50.116Z] 21:58:50     INFO - Browser at: http://example.com/ transitioning to FOREGROUND
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Browser at about:blank reached expected priority: FOREGROUND - true == true - 
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - Buffered messages finished
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - TEST-UNEXPECTED-FAIL | dom/ipc/tests/browser_ProcessPriorityManager.js | Should have seen no process priority change for a browser at http://example.com/ - "FOREGROUND" == null - JS frame :: chrome://mochitests/content/browser/dom/ipc/tests/browser_ProcessPriorityManager.js :: ensureNoPriorityChange :: line 106
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - Stack trace:
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - chrome://mochitests/content/browser/dom/ipc/tests/browser_ProcessPriorityManager.js:ensureNoPriorityChange:106
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - TEST-PASS | dom/ipc/tests/browser_ProcessPriorityManager.js | Tabs should be running in separate processes. - 10644 != 10548 - 
[task 2020-10-23T21:58:50.117Z] 21:58:50     INFO - Browser at: about:blank transitioning to BACKGROUND
...
Flags: needinfo?(padenot)
Flags: needinfo?(padenot)

To prevent sheriff for cc paul for the backout again.

Assignee: padenot → alwu

So last Friday I indeed saw the failure happened on my m-c without applying any of my patches, and the fail part was test_video_background_tab which is not relevant with my patches. However, I ran the test again today, it didn't fail (?), even if I added my patches, the test still passed on my local environment, which is really weird...

Anyway, I will update new patches later to (1) fix the possible test timeout by refactoring browser_media_wakelock.js (bug 1522361) (2) fix the weird failure (which seems timing issue) for browser_ProcessPriorityManager.js.

Attachment #9179946 - Attachment is obsolete: true
Attachment #9181791 - Attachment description: Bug 1346880 - Test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices. r?pehrsons,alwu → Bug 1346880 - part5 : test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices.

Separate the media playback and web audio tests for wakelock, which can prevent running a time too long and hitting the error (bug 1522361) and increase test readability because some check conditions would only work for one side, which would be nonecessary for another side.

This patch would further improve the readability for wakelock test by doing following things.

  1. refactor getWakeLockState() and rename it to waitForExpectedWakeLockState()
    In the origin test, we have to create a wakelock sentinel object beforehand, and then call check() later, which is not really intuitive. Refactor that function to allow us to use it easier.

  2. use const variables to store the wakelock topic (audio-playing/video-playing)

  3. add a helper function ensureNeverAcquireVideoWakelock() to clearly indicate we won't accquire video wakelock for web audio

Pushed by alwu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/eb9c32faa3e6
part1 : keep AudioChannelAgent alive all the time for not offline context. r=padenot
https://hg.mozilla.org/integration/autoland/rev/a56fc7ee5a04
part2 : consider output volume for engine when it determines the audible state. r=padenot
https://hg.mozilla.org/integration/autoland/rev/0468d60ac301
part3 : add a browser sound indicator test for web audio audibility. r=padenot
https://hg.mozilla.org/integration/autoland/rev/4b4625dd460e
part4 : modify current tests. r=padenot
https://hg.mozilla.org/integration/autoland/rev/767598d1e453
part5 : test that a muted tab that plays audio via the Web Audio API is really muted using PulseAudio monitoring devices. r=pehrsons,alwu
https://hg.mozilla.org/integration/autoland/rev/4d9b9f483e03
part6 : separate media playback and web audio test for wakelock. r=padenot
https://hg.mozilla.org/integration/autoland/rev/62fe8bb937c2
part7 : further improve the readability for wakelock test. r=padenot
https://hg.mozilla.org/integration/autoland/rev/c938f6fd4656
part8 : ensure audio context is already running before doing next step. r=padenot
Regressions: 1674039
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: