Closed Bug 1189197 Opened 4 years ago Closed 4 years ago

Race in bufferqueue_callback (cubeb_opensl.c)

Categories

(Core :: Audio/Video: MediaStreamGraph, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla42
Tracking Status
firefox42 --- fixed

People

(Reporter: jwwang, Assigned: jwwang)

References

Details

Attachments

(1 file)

This bug is explored by bug 1187817 (see bug 1187817 comment 18).

When opensl_stream_start is called, it is possible bufferqueue_callback is still in progress. Since opensl_stream_start calls bufferqueue_callback, bufferqueue_callback (which is not reentrant) will be entered from 2 threads and cause errors.

See bug 1187817 comment 19 ~ bug 1187817 comment 24 for more details.
Blocks: 1187817
Assignee: nobody → jwwang
Status: NEW → ASSIGNED
Attachment #8641462 - Flags: review?(kinetik)
The only problem left is, do we need to enqueue a silent frame each time resuming playback? I think not.

https://hg.mozilla.org/mozilla-central/file/2ddec2dedced/media/libcubeb/src/cubeb_opensl.c#l111

bufferqueue_callback ensure there is always at least one buffer in the queue. So whenever playback is resumed, there will always be a buffer to be consumed to kick off the buffer queue callback.
Comment on attachment 8641462 [details] [diff] [review]
1189197_fix_bufferqueue_callback_reentrant-v1.patch

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

Thanks, let's give this a shot!
Attachment #8641462 - Flags: review?(kinetik) → review+
Thanks for the review!
https://hg.mozilla.org/mozilla-central/rev/692828b8e47a
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla42
You need to log in before you can comment on or make changes to this bug.