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

Unified Diff: media/audio/win/audio_low_latency_output_win.cc

Issue 10866015: Don't leak render thread on Stop(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: #include. Created 8 years, 4 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/win/audio_low_latency_output_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 2b270c179f0d3f53250b260c5e8bb899497ff7ab..78c823f9acbe3d3f17bf84733a0118184751a312 100644
--- a/media/audio/win/audio_low_latency_output_win.cc
+++ b/media/audio/win/audio_low_latency_output_win.cc
@@ -329,7 +329,6 @@ WASAPIAudioOutputStream::WASAPIAudioOutputStream(AudioManagerWin* manager,
: com_init_(ScopedCOMInitializer::kMTA),
creating_thread_id_(base::PlatformThread::CurrentId()),
manager_(manager),
- render_thread_(NULL),
opened_(false),
started_(false),
restart_rendering_mode_(false),
@@ -528,7 +527,8 @@ void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) {
// Create and start the thread that will drive the rendering by waiting for
// render events.
- render_thread_ = new base::DelegateSimpleThread(this, "wasapi_render_thread");
+ render_thread_.reset(
+ new base::DelegateSimpleThread(this, "wasapi_render_thread"));
render_thread_->Start();
if (!render_thread_->HasBeenStarted()) {
DLOG(ERROR) << "Failed to start WASAPI render thread.";
@@ -540,7 +540,7 @@ void WASAPIAudioOutputStream::Start(AudioSourceCallback* callback) {
if (FAILED(hr)) {
SetEvent(stop_render_event_.Get());
render_thread_->Join();
- render_thread_ = NULL;
+ render_thread_.reset();
HandleError(hr);
return;
}
@@ -566,10 +566,10 @@ void WASAPIAudioOutputStream::Stop() {
}
// Wait until the thread completes and perform cleanup.
- if (render_thread_) {
+ if (render_thread_.get()) {
SetEvent(stop_render_event_.Get());
render_thread_->Join();
- render_thread_ = NULL;
+ render_thread_.reset();
}
// Flush all pending data and reset the audio clock stream position to 0.
« no previous file with comments | « media/audio/win/audio_low_latency_output_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698