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

Unified Diff: media/audio/linux/alsa_input.cc

Issue 9570014: Move some generic functions to AudioManagerBase to be inherited by platform-specific AudioManager*** (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix the memory leak in the alsa unittests Created 8 years, 10 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
Index: media/audio/linux/alsa_input.cc
diff --git a/media/audio/linux/alsa_input.cc b/media/audio/linux/alsa_input.cc
index 101c1985ec494cee3d29ecb75c9d8ad8f26a612a..0fc66fdeb20df5f76ca489cdeb713b71bfe6aa72 100644
--- a/media/audio/linux/alsa_input.cc
+++ b/media/audio/linux/alsa_input.cc
@@ -247,25 +247,23 @@ void AlsaPcmInputStream::Stop() {
}
void AlsaPcmInputStream::Close() {
- scoped_ptr<AlsaPcmInputStream> self_deleter(this);
+ if (device_handle_) {
+ weak_factory_.InvalidateWeakPtrs(); // Cancel the next scheduled read.
+ int error = alsa_util::CloseDevice(wrapper_, device_handle_);
+ if (error < 0)
+ HandleError("PcmClose", error);
- // Check in case we were already closed or not initialized yet.
- if (!device_handle_)
- return;
+ if (mixer_handle_)
tommi (sloooow) - chröme 2012/03/05 14:28:28 where is mixer_handle_ set to NULL? ... I guess it
no longer working on chromium 2012/03/06 15:27:07 Done.
+ alsa_util::CloseMixer(wrapper_, mixer_handle_, device_name_);
- weak_factory_.InvalidateWeakPtrs(); // Cancel the next scheduled read.
- int error = alsa_util::CloseDevice(wrapper_, device_handle_);
- if (error < 0)
- HandleError("PcmClose", error);
-
- if (mixer_handle_)
- alsa_util::CloseMixer(wrapper_, mixer_handle_, device_name_);
+ audio_packet_.reset();
+ device_handle_ = NULL;
- audio_packet_.reset();
- device_handle_ = NULL;
+ if (callback_)
+ callback_->OnClose(this);
+ }
- if (callback_)
- callback_->OnClose(this);
+ audio_manager_->ReleaseInputStream(this);
}
double AlsaPcmInputStream::GetMaxVolume() {

Powered by Google App Engine
This is Rietveld 408576698