Closed Bug 623818 Opened 9 years ago Closed 9 years ago

Audio stuttering playing Wave on certain sound configurations

Categories

(Core :: Audio/Video, defect)

x86_64
Linux
defect
Not set

Tracking

()

VERIFIED FIXED
mozilla5

People

(Reporter: kinetik, Assigned: kinetik)

References

()

Details

Attachments

(1 file, 1 obsolete file)

The audio buffer refill logic in nsWaveStateMachine makes incorrect assumptions about playback behaviour, which can result in audio stuttering on certain sound configurations.

The first and second files in the linked URL reproduce this for me on Fedora 13.  Note that this bug was easier to reproduce (and more severe) before bug 616800 landed.
Attached patch patch v0 (obsolete) — Splinter Review
Change nsWaveStateMachine to write minimum write size chunks as quickly as possible (filling the entire backend buffer) and rely on short blocking writes rather than estimated sleep times to handle refill wake ups.  Modify GetTimeForPositionChange to use the audio stream playback position rather than the decoder read position.

Remove the "non-blocking" write handling code from nsAudioStream, it never worked very well, and the API is terrible.  The Wave backend was the last consumer.

Also removes some unnecessary code in sydney_audio_alsa.c and fixes a few warnings.
Attached patch patch v1Splinter Review
GetMinWriteSamples will return -1 on platforms where it's not implemented/necessary.  It's also possible for it to be a very small value (e.g. 1 sample), so change the previous patch to use the greater of 100ms or GetMinWriteSamples.  Also fix the setup in nsBuiltinDecoderStateMachine so that GetMinWriteSamples is only called once on platforms that don't implement it.
Attachment #501915 - Attachment is obsolete: true
Fixed with landing of new wave backend in bug 635649.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla2.2
Not reproducible using the attached test URL -- VERIFIED FIXED
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.