Closed Bug 675839 Opened 13 years ago Closed 13 years ago

Linux libsydneyaudio backend updates playback position infrequently

Categories

(Core :: Audio/Video, defect)

All
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla8

People

(Reporter: cajbir, Assigned: cajbir)

References

Details

(Whiteboard: [inbound])

Attachments

(1 file, 1 obsolete file)

The libsydneyaudio backend for linux writes a largish chunk of audio at a time in a block call to Alsa. This is followed by an update of the internal number of bytes read. The large granularity of the write and update causes issues when media playback attempts to read the playback position to find the current time.

An example of this is in bug 648595 when an end fragment is specified for media. If a check is made to see if the media has reached an end time just before the end time is reached, the next check can have the audio time quite a bit in advance of the desired end time due to the large granularity of the playback position increments.
Blocks: 648595
Attached patch Fix (obsolete) — Splinter Review
Perform the blocking write in a loop in smaller increments, updating the playback position after each successful small write.
Assignee: nobody → chris.double
Status: NEW → ASSIGNED
Attachment #549996 - Flags: review?(kinetik)
Comment on attachment 549996 [details] [diff] [review]
Fix

Review of attachment 549996 [details] [diff] [review]:
-----------------------------------------------------------------

::: media/libsydneyaudio/src/sydney_audio_alsa.c
@@ +252,4 @@
>    while(nframes>0) {
>      if (s->resumed) {
>        avail = snd_pcm_avail_update(s->output_unit);
> +      avail = avail < 64 ? avail : 64;

This undoes the workaround added in bug 573924.

@@ +267,5 @@
>          return SA_ERROR_SYSTEM;
>        }
>      } else {
>        nframes -= frames;
> +      size_t bytes = snd_pcm_frames_to_bytes(s->output_unit, frames);

Declare |bytes| at the top of a block to avoid compiler warnings.
Attachment #549996 - Flags: review?(kinetik) → review-
Attached patch FixSplinter Review
Address review comments.
Attachment #549996 - Attachment is obsolete: true
Attachment #550013 - Flags: review?(kinetik)
Attachment #550013 - Flags: review?(kinetik) → review+
http://hg.mozilla.org/mozilla-central/rev/512bcdfdb77f
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla8
Looks like this actually worked around the bug we were hitting in alsa causing audio-writes to not return, causing timeouts on Tinderbox. There have been no such intermittent timeouts on Linux boxes on Tinderbox on the branches with this changeset landed. This then fixes (at least) these random orange bugs:

[Bug 573161] Intermittent timeout in test_progress.html, test_reactivate.html, test_replay_metadata.html, and test_seek.html on Linux
[Bug 591790] Frequent timeouts in test_buffered.html, test_bug465498.html, test_bug495145.html, test_framebuffer.html, followed by a "4 test timeouts, giving up."
[Bug 610931] Intermittent test_bug495145.html | Test timed out followed by shutdown timeout
[Bug 620721] Intermittent test_timeupdate_small_files.html | Test timed out. followed by shutdown timeout
[Bug 666092] Frequent timeouts in test_replay_metadata.html, test_seek.html, test_seek_out_of_range.html and test_timeupdate_small_files.html followed by a "4 test timeouts, giving up"
[Bug 666271] Frequent timeouts in test_bug495145.html, test_framebuffer.html, test_load_source.html and test_new_audio.html followed by a "4 test timeouts, giving up"

This significantly drops the media orange count. Way to go doublec!
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: