Closed Bug 623818 Opened 11 years ago Closed 11 years ago
Audio stuttering playing Wave on certain sound configurations
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.
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.
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: 11 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.