canplaythrough can fire more than once

NEW
Unassigned

Status

()

Core
Audio/Video: Playback
7 years ago
2 years ago

People

(Reporter: humph, Unassigned)

Tracking

Trunk
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
Created attachment 550114 [details]
HTML test case with inline WAV as dataurl

I'm getting multiple canplaythrough events fired for the attached test case.  I'm not sure if this is corruption in the wav file (it plays fine in all wav-enabled browsers and other audio apps), or something we're doing wrong.  Even if I alter this test case to use a regular file instead of a dataurl, it fires twice.  Happens in nightly and ff5.
This seems to be a bug caused by mismatched definitions of what HAVE_ENOUGH_DATA is.  It's fired when we have downloaded the entire resource irrespective of the decode queue state, resulting in a later transition away and back to HAVE_ENOUGH_DATA as the decode queues fill.

Given a small enough file/fast enough download, FirstFrameLoaded is called with aResourceLoaded==PR_TRUE.  This causes a transition from HAVE_METADATA to HAVE_ENOUGH_DATA and canplaythrough is fired.

DecodeLoop calls UpdateReadyState, where HaveFutureAudioData returns false due to the audio queue being empty.  This results in NextFrameUnavailable transitioning the ready state from HAVE_ENOUGH_DATA to HAVE_CURRENT_DATA.

DecodeLoop calls UpdateReadyState, where HaveFutureAudioData returns true.  NextFrameAvailable transitions the ready state from HAVE_CURRENT_DATA to HAVE_ENOUGH_DATA and canplaythrough is fired.
Component: Audio/Video → Audio/Video: Playback
You need to log in before you can comment on or make changes to this bug.