Stop the AudioDeviceThread when the IO loop goes away.
When shutting down, the pipeline code can take a long time to terminate. In some rare cases, the IO loop terminates before the pipeline thread and the audio device classes would attempt to use the io loop to perform tasks on. I checked in a candidate fix for this a couple of weeks ago which monitors the lifetime of the IO loop and uses MessageLoopProxy* instead of MessageLoop* to avoid issues with using the NULL loop. That fixes part of the problem. What was missing was also stopping the audio thread in this case since the IO thread will run teardown before the Pipeline thread calls AudioDevice::Stop(). In that period, the audio thread will still be running but the callback object has been deleted. Additionally, I'm adding a lock to guard the thread_ variable in AudioDeviceThread. Before I was relying on external synchronization in the AudioDevice and AudioInputDevice state machine. However, it doesn't hurt to go belt and suspenders although it might not look cool ;) BUG=115299 TEST=Follow repro steps in bug report. Review URL: http://codereview.chromium.org/9534002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124330 0039d316-1c4b-4281-b951-d872f2087c98
Showing
Please register or sign in to comment