Closed Bug 2006276 Opened 1 month ago Closed 13 days ago

Video playback stalls or desynchronizes when resuming if an AudioContext-based volume booster extension is active

Categories

(Core :: Audio/Video: Playback, defect, P1)

Firefox 147
defect

Tracking

()

VERIFIED FIXED
148 Branch
Tracking Status
firefox-esr115 --- unaffected
firefox-esr140 --- unaffected
firefox146 --- unaffected
firefox147 --- verified
firefox148 --- verified

People

(Reporter: k, Assigned: karlt)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0

Steps to reproduce:

  1. Launch Firefox (I have reproduced this on 147 Beta and 148 Nightly).
  2. Install a volume booster add-on or userscript that likely utilizes the AudioContext (Web Audio API).
    Examples include:
  3. Visit a video streaming site (e.g., YouTube).
    (Note: If using the "600% Sound Volume" add-on, adjust the slider to activate the effect.)
  4. Play a video.
  5. Pause the video.
  6. Resume playback.

Actual results:

The video playback glitches for several seconds. Specifically, one of the following occurs:

  1. Audio plays, but the video frame remains frozen. After several seconds, the video frame suddenly jumps to the current audio position (skipping the frames in between).
  2. Both audio and video remain frozen, but the seekbar/timestamp continues to progress. After several seconds, playback starts normally from the current timestamp.

Expected results:

Playback should resume immediately and smoothly without any freezing or resynchronization.

Additional Information

  • Regression: The issue appears to be a regression starting with Firefox 147 Beta.
    • Works correctly: Firefox 146 (Release and Beta).
    • Broken: Firefox 147 Beta and 148 Nightly.

The Bugbug bot thinks this bug should belong to the 'Core::Audio/Video: Playback' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Audio/Video: Playback
Product: Firefox → Core

Thank you for the report. Would you be able to use mozregression to bisect to find the change the triggered this, please?
mozregression --good 146 --bad 147 --profile-persistence reuse

Flags: needinfo?(k)
Keywords: regression

Apologies for the delay. This was my first time using mozregression (it's a great tool!), so it took me a while to get set up.

I ran mozregression, but it failed to bisect the merge commit (Unable to exploit the merge commit).

However, the regression range is identified as:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=8b434e72bd1e5995992c79398c5d4024c21383d4&tochange=88a09a47e50b681f0b673d5314113e2992f468e3

Looking at the pushlog, Bug 1771789 seems highly suspicious, as it involves changes to CubebInputStream and MediaStreamTrack, which could affect AudioContext behavior.

Suspected patches:

  • Andreas Pehrson β€” Bug 1771789 - Pass CubebInputStream the same CubebHandle used to enumerate its device id. r=padenot
  • Andreas Pehrson β€” Bug 1771789 - Make AudioInputProcessing::NumberOfChannels always valid. r=padenot,webrtc-reviewers,mjf
  • Andreas Pehrson β€” Bug 1771789 - Add and use an API for MediaStreamTrackSource cloning. r=jib
Flags: needinfo?(k)

That's very helpful, thanks. Possibly bug 1771789, but bug 1931328 is about A/V synchronization.

Blocks: media-triage
Regressed by: 1931328
Status: UNCONFIRMED → NEW
Ever confirmed: true

Next week is RC week for Fx147.
:jimm, any concerns with prioritizing an investigation in time for Fx147?
Bug 1998839 is riding the train with Fx147

Flags: needinfo?(jmathies)
Attached file testcase β€”

It is as if the video position is advancing while paused, so the effect is more obvious for longer pauses. On resume the audio resumes, but the video playback jumps and then is paused or stuttery until the audio catches up.

A logging profile is at https://share.firefox.dev/4jkeCYl

Looking at the MediaDecoderStateMachine thread, and searching the Marker Table for "odecoded,sink", both audio and video decoded frame times advance by the duration of the pause, but aClockTime passed to VideoSink::RenderVideoFrames() does not.

This bug would affect more situations that bug 1931328.
There would be risk in landing a fix for this, if we determine what the appropriate fix should be.
Given the time constraints, backing out https://hg.mozilla.org/mozilla-central/rev/f8c71c831710 and dependent changesets from bug 1931328 seems the best option at this stage.

https://treeherder.mozilla.org/jobs?repo=try&revision=2cdc18b26bcb764466a8b752656eb0886a2e3954

due to skips and freezes when resuming after playback pause.

Revert "Bug 1931328 - Account for playback rate when setting frame timestamps in DecodedStream. r=padenot"

This reverts commit 5df6a99098033eac5a05134437d4393200c8652b.

Revert "Bug 1931328 - Test the interpolated GetPosition in DecodedStream. r=padenot"

This reverts commit a8c2ffa3f7c13ce6533bc06c5bbe7ecb0bc7f90f.

Revert "Bug 1931328 - Allow for deterministic output time testing of DecodedStream. r=padenot"

This reverts commit 1a970ccb483397c434bd9f2a3d566d72b2444c82.

Revert "Bug 1931328 - Interpolate DecodedStream position based on current system time. r=padenot,webidl,smaug"

This reverts commit 6bc5f33ade36f71c360721f04c77744d662ace1b.

Assignee: nobody → karlt
Status: NEW → ASSIGNED

:karlt could you also put up a beta uplift request when ready?
I know the patch is still pending review, but at least if we have a beta uplift we can take it once the patch hits firefox-main.
It's too late for 147 beta builds, but we can take it before 147 goes to release.

Flags: needinfo?(karlt)

An awkward workaround is to drag the playback position back over the portion that was skipped.

Severity: -- → S3
Flags: needinfo?(karlt)
Priority: -- → P1

due to skips and freezes when resuming after playback pause.

Revert "Bug 1931328 - Account for playback rate when setting frame timestamps in DecodedStream. r=padenot"

This reverts commit 5df6a99098033eac5a05134437d4393200c8652b.

Revert "Bug 1931328 - Test the interpolated GetPosition in DecodedStream. r=padenot"

This reverts commit a8c2ffa3f7c13ce6533bc06c5bbe7ecb0bc7f90f.

Revert "Bug 1931328 - Allow for deterministic output time testing of DecodedStream. r=padenot"

This reverts commit 1a970ccb483397c434bd9f2a3d566d72b2444c82.

Revert "Bug 1931328 - Interpolate DecodedStream position based on current system time. r=padenot,webidl,smaug"

This reverts commit 6bc5f33ade36f71c360721f04c77744d662ace1b.

Original Revision: https://phabricator.services.mozilla.com/D277683

Attachment #9535301 - Flags: approval-mozilla-beta?

firefox-beta Uplift Approval Request

  • User impact if declined: Regression: skips and freezes when attempting to resume playback after pause, in some less common a/v playback designs.
  • Code covered by automated testing: no
  • Fix verified in Nightly: no
  • Needs manual QE test: no
  • Steps to reproduce for manual QE testing:
  • Risk associated with taking this patch: low
  • Explanation of risk level: Reverts to a previous state.
  • String changes made/needed: None
  • Is Android affected?: yes

The uplift request via Lando for D277683 fails with "source_revisions: Select a valid choice. 277683 is not one of the available choices."
moz-phab generated the uplift.

Attachment #9535221 - Attachment description: Bug 2006276 Revert DecodedStream position interpolation and dependent changesets r?#media-playback-reviewers,dmeehan → Bug 2006276 Revert DecodedStream position interpolation and dependent changesets r?#media-playback-reviewers
Pushed by ktomlinson@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/a8abdd1ff460 https://hg.mozilla.org/integration/autoland/rev/87b989c9180d Revert DecodedStream position interpolation and dependent changesets r=media-playback-reviewers,webidl,smaug,aosmond
Status: ASSIGNED → RESOLVED
Closed: 13 days ago
Resolution: --- → FIXED
Target Milestone: --- → 148 Branch
Attachment #9535301 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified fixed in the latest Nightly 148.0a1 on macOS.
The video glitch/desynchronization issue is resolved.

QA Whiteboard: [qa-ver-needed-c148/b147] [qa-triage-done-c148/b147]
Flags: qe-verify+

I was able to reproduce the issue on Mac12.6 using FF build 147.0b6.
Verified as fixed on Mac12.6/Win11 using FF builds 147.0 and 148.0a1(20260107160934).

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-ver-needed-c148/b147] [qa-triage-done-c148/b147] → [qa-ver-needed-c148/b147] [qa-triage-done-c148/b147][qa-ver-done-c148/b147]
Flags: qe-verify+
QA Contact: mchiorean
Flags: needinfo?(jmathies)
See Also: → 2008641
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: