Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Issue 9534002: Stop the AudioDeviceThread when the IO loop goes away. (Closed)

Created:
8 years, 9 months ago by tommi (sloooow) - chröme
Modified:
8 years, 9 months ago
CC:
chromium-reviews, joi+watch-content_chromium.org, feature-media-reviews_chromium.org, jam, darin-cc_chromium.org
Visibility:
Public.

Description

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. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=124330

Patch Set 1 #

Patch Set 2 : Handle another edge case #

Total comments: 8

Patch Set 3 : Remove mutable. Stop thread synchronously if needed in ShutdownOnIOThread with IO exception. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+54 lines, -16 lines) Patch
M content/renderer/media/audio_device.cc View 1 2 3 chunks +11 lines, -0 lines 0 comments Download
M content/renderer/media/audio_device_thread.h View 1 2 3 chunks +12 lines, -7 lines 0 comments Download
M content/renderer/media/audio_device_thread.cc View 1 2 4 chunks +18 lines, -7 lines 0 comments Download
M content/renderer/media/audio_input_device.cc View 1 2 3 chunks +13 lines, -2 lines 0 comments Download

Messages

Total messages: 8 (0 generated)
tommi (sloooow) - chröme
8 years, 9 months ago (2012-02-29 14:38:06 UTC) #1
scherkus (not reviewing)
https://chromiumcodereview.appspot.com/9534002/diff/7001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): https://chromiumcodereview.appspot.com/9534002/diff/7001/content/renderer/media/audio_device.cc#newcode102 content/renderer/media/audio_device.cc:102: audio_thread_.Stop(MessageLoop::current()); remind me again.. what's the advantage to stopping ...
8 years, 9 months ago (2012-02-29 21:10:15 UTC) #2
tommi (sloooow) - chröme
https://chromiumcodereview.appspot.com/9534002/diff/7001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): https://chromiumcodereview.appspot.com/9534002/diff/7001/content/renderer/media/audio_device.cc#newcode102 content/renderer/media/audio_device.cc:102: audio_thread_.Stop(MessageLoop::current()); On 2012/02/29 21:10:15, scherkus wrote: > remind me ...
8 years, 9 months ago (2012-02-29 21:22:13 UTC) #3
scherkus (not reviewing)
cleared up a lot of my confusion over IM -- ping me again when you ...
8 years, 9 months ago (2012-02-29 21:40:53 UTC) #4
tommi (sloooow) - chröme
changes uploaded. mutable is gone and there's a single call to the synchronous Stop() + ...
8 years, 9 months ago (2012-02-29 22:00:14 UTC) #5
scherkus (not reviewing)
LGTM!
8 years, 9 months ago (2012-02-29 22:40:57 UTC) #6
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/tommi@chromium.org/9534002/15003
8 years, 9 months ago (2012-02-29 22:41:48 UTC) #7
commit-bot: I haz the power
8 years, 9 months ago (2012-03-01 01:57:09 UTC) #8
Change committed as 124330

Powered by Google App Engine
This is Rietveld 408576698