Closed Bug 1237414 Opened 4 years ago Closed 4 years ago

Threadrace when starting/stopping cubeb for AudioCallbackDrivers

Categories

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

defect

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox46 --- fixed

People

(Reporter: jesup, Assigned: jesup)

Details

Attachments

(1 file)

AsyncCubebOperation (used for Init and Shutdown of drivers) spawns a new thread at every operation.  This is expensive (on Windows), and more importantly the code relies on Shutdown of a previous driver before another driver starts (i.e. reliable serialization).  Spawning a thread-per-operation does not provide such a guarantee.

The right solution is to use a SharedThreadPool (or even plain nsThreadPool) with a single thread max.  It will shut down idle threads and restart them as needed.
Rank: 10
Attachment #8704805 - Flags: review?(padenot) → review+
I had to back this (and everything else from this push) out for causing various crashes on WinXP. They all seem to mention "winmm_stream_init" or "cubeb_winmm.c".

https://treeherder.mozilla.org/logviewer.html#?job_id=20232505&repo=mozilla-inbound
https://hg.mozilla.org/integration/mozilla-inbound/rev/e33cecf8d2a5
https://hg.mozilla.org/mozilla-central/rev/7da3fd66093c
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
You need to log in before you can comment on or make changes to this bug.