Chromium Code Reviews| 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() { |