Index: media/audio/win/audio_low_latency_output_win.cc |
diff --git a/media/audio/win/audio_low_latency_output_win.cc b/media/audio/win/audio_low_latency_output_win.cc |
index 8ad7f79d9d26ee427870f5b7c2780b829ca01fda..3dbb7d6b0b559e8c9fc61ea602857818c6b0929c 100644 |
--- a/media/audio/win/audio_low_latency_output_win.cc |
+++ b/media/audio/win/audio_low_latency_output_win.cc |
@@ -281,6 +281,12 @@ |
this, "wasapi_render_thread", |
base::SimpleThread::Options(base::ThreadPriority::REALTIME_AUDIO))); |
render_thread_->Start(); |
+ if (!render_thread_->HasBeenStarted()) { |
+ LOG(ERROR) << "Failed to start WASAPI render thread."; |
+ StopThread(); |
+ callback->OnError(this); |
+ return; |
+ } |
// Start streaming data between the endpoint buffer and the audio engine. |
HRESULT hr = audio_client_->Start(); |
@@ -633,9 +639,11 @@ |
void WASAPIAudioOutputStream::StopThread() { |
if (render_thread_) { |
- // Wait until the thread completes and perform cleanup. |
- SetEvent(stop_render_event_.Get()); |
- render_thread_->Join(); |
+ if (render_thread_->HasBeenStarted()) { |
+ // Wait until the thread completes and perform cleanup. |
+ SetEvent(stop_render_event_.Get()); |
+ render_thread_->Join(); |
+ } |
render_thread_.reset(); |