Closed Bug 636894 Opened 15 years ago Closed 15 years ago

Audio 'MozAudioAvailable' event timing behaving poorly

Categories

(Core :: Audio/Video, defect)

x86_64
macOS
defect
Not set
major

Tracking

()

VERIFIED FIXED

People

(Reporter: cj, Assigned: kinetik)

References

()

Details

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0b12pre) Gecko/20110220 Firefox/4.0b12pre Build Identifier: 4.0b12pre (2011-02-21) The Audio events in build 4.0b12pre (2011-02-20) run smoothly at the given URL, however if you use a build after that, such as 4.0b12pre (2011-02-21) or later the event timing is running strangely. It's causing anything that relies on having the audio sync'd (almost every audio demo written so far) to behave as if the data is arriving in quick bursts, effectively making the framerate look very low for anything depending on that information. Some additional broken URLs are: BeatDetektor demos, i.e.: http://cubicvr.org/CubicVR.js/bd3/BeatDetektor3HD.html Most of the demos on: http://vocamus.net/dave/?p=1188 The city visualizer section of: http://videos.mozilla.org/serv/mozhacks/flight-of-the-navigator/ and many, many more including the Audio API team's currently unreleased no-comply demo. Reproducible: Always Steps to Reproduce: 1. Go to http://www.audioscene.org/scene-files/ccliffe/AudioTiming/debug.html with a build from on or before February 20th. 2. Observe the counters incrementing smoothly. 3. Grab a build from after February 20th 4. Observe the counters incrementing in jerky non-linear steps Actual Results: Builds before the 21st are fine, anything after the timer is behaving strangely Expected Results: Both should behave the same
Fairly sure this is a result of the AUDIO_DURATION_MS change in bug 634787. Waiting for a build to confirm.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Additional test that calculates the event timing offset and average independently using Date(), not perfect but might help: http://www.audioscene.org/scene-files/ccliffe/AudioTiming/debug2.html
I modified the testcase to save the last 30 delta times between MozAudioAvailable firing. I think this reveals that AUDIO_DURATION_MS is the cause of the regression. Current trunk: recentDelays: [10, 8, 9, 8, 8, 93, 14, 10, 8, 9, 8, 101, 15, 9, 9, 8, 9, 8, 92, 15, 9, 9, 8, 8, 101, 19, 9, 9, 8, 9] With AUDIO_DURATION_MS back to 40ms: recentDelays: [16, 26, 12, 22, 24, 16, 22, 14, 38, 16, 18, 28, 9, 33, 14, 26, 12, 30, 38, 13, 25, 13, 27, 40, 9, 31, 9, 31, 9, 31] With patch backed out: recentDelays: [40, 15, 32, 10, 23, 11, 29, 40, 14, 26, 11, 28, 13, 29, 39, 10, 29, 8, 34, 38, 9, 31, 9, 31, 8, 32, 40, 11, 29, 9]
Attached patch patch v0Splinter Review
Short term fix: revert the AUDIO_DURATION_MS part of bug 634787. It's worth revisiting that change later (post FF4) to see if we can still reduce the overhead for normal playback (~27% to ~14% CPU in a debug build, probably less in optimized), but we'll need to look at decoupling the audio event dispatch stuff so that it doesn't regress like this bug demonstrates.
Assignee: nobody → kinetik
Status: NEW → ASSIGNED
Attachment #515286 - Flags: review?(roc)
Attachment #515286 - Flags: approval2.0?
Blocks: 634787
Bug 636941 for the post-FF4 attempt at this.
Comment on attachment 515286 [details] [diff] [review] patch v0 r+ before a?, please!
Attachment #515286 - Flags: approval2.0?
Attachment #515286 - Flags: approval2.0?
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Verified FIXED in Firefox 4.0rc1.
Status: RESOLVED → VERIFIED
Depends on: 650193
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: