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

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: changed the GetMaxOutputStreamsAllowed Created 8 years, 9 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..994c065d4c4fad260468bb1edfe764509bc62a0f 100644
--- a/media/audio/linux/alsa_input.cc
+++ b/media/audio/linux/alsa_input.cc
@@ -247,25 +247,25 @@ 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_)
+ 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;
+ mixer_handle_ = NULL;
+ mixer_element_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