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

Unified Diff: media/audio/audio_output_device.cc

Issue 2828233002: DCHECK that audio devices are stopped prior to destruction. (Closed)
Patch Set: More DCHECKs! Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_input_device_unittest.cc ('k') | media/audio/audio_output_device_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_device.cc
diff --git a/media/audio/audio_output_device.cc b/media/audio/audio_output_device.cc
index ae88ddef593699471a3f16b92dd18455234abe6e..e31a0f774148746ea51ab06490e45d7c3b35c1b6 100644
--- a/media/audio/audio_output_device.cc
+++ b/media/audio/audio_output_device.cc
@@ -96,7 +96,17 @@ void AudioOutputDevice::Initialize(const AudioParameters& params,
callback_ = callback;
}
-AudioOutputDevice::~AudioOutputDevice() {}
+AudioOutputDevice::~AudioOutputDevice() {
+#if DCHECK_IS_ON()
+ // Make sure we've stopped the stream properly before destructing |this|.
+ DCHECK(audio_thread_lock_.Try());
+ DCHECK_LE(state_, IDLE);
+ DCHECK(!audio_thread_);
+ DCHECK(!audio_callback_);
+ DCHECK(!stopping_hack_);
+ audio_thread_lock_.Release();
+#endif // DCHECK_IS_ON()
+}
void AudioOutputDevice::RequestDeviceAuthorization() {
task_runner()->PostTask(
« no previous file with comments | « media/audio/audio_input_device_unittest.cc ('k') | media/audio/audio_output_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698