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

Side by Side Diff: media/audio/linux/alsa_output.cc

Issue 542002: Retry 35837 linux: grab device name before closing it (Closed)
Patch Set: Created 10 years, 11 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/audio/linux/alsa_output_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // THREAD SAFETY 5 // THREAD SAFETY
6 // 6 //
7 // The AlsaPcmOutputStream object's internal state is accessed by two threads: 7 // The AlsaPcmOutputStream object's internal state is accessed by two threads:
8 // 8 //
9 // client thread - creates the object and calls the public APIs. 9 // client thread - creates the object and calls the public APIs.
10 // message loop thread - executes all the internal tasks including querying 10 // message loop thread - executes all the internal tasks including querying
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 // TODO(ajwong): Retry on certain errors? 749 // TODO(ajwong): Retry on certain errors?
750 LOG(WARNING) << "Unable to close audio device. Leaking handle."; 750 LOG(WARNING) << "Unable to close audio device. Leaking handle.";
751 } 751 }
752 return NULL; 752 return NULL;
753 } 753 }
754 754
755 return handle; 755 return handle;
756 } 756 }
757 757
758 bool AlsaPcmOutputStream::CloseDevice(snd_pcm_t* handle) { 758 bool AlsaPcmOutputStream::CloseDevice(snd_pcm_t* handle) {
759 std::string name = wrapper_->PcmName(handle);
759 int error = wrapper_->PcmClose(handle); 760 int error = wrapper_->PcmClose(handle);
760 if (error < 0) { 761 if (error < 0) {
761 LOG(ERROR) << "Cannot close audio device (" << wrapper_->PcmName(handle) 762 LOG(ERROR) << "Error closing audio device (" << name << "): "
762 << "): " << wrapper_->StrError(error); 763 << wrapper_->StrError(error);
763 return false; 764 return false;
764 } 765 }
765 766
766 return true; 767 return true;
767 } 768 }
768 769
769 snd_pcm_sframes_t AlsaPcmOutputStream::GetAvailableFrames() { 770 snd_pcm_sframes_t AlsaPcmOutputStream::GetAvailableFrames() {
770 DCHECK_EQ(MessageLoop::current(), message_loop_); 771 DCHECK_EQ(MessageLoop::current(), message_loop_);
771 772
772 if (stop_stream_) { 773 if (stop_stream_) {
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
948 } 949 }
949 950
950 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to 951 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to
951 // release ownership of the currently registered callback. 952 // release ownership of the currently registered callback.
952 void AlsaPcmOutputStream::SharedData::set_source_callback( 953 void AlsaPcmOutputStream::SharedData::set_source_callback(
953 AudioSourceCallback* callback) { 954 AudioSourceCallback* callback) {
954 DCHECK_EQ(MessageLoop::current(), state_transition_loop_); 955 DCHECK_EQ(MessageLoop::current(), state_transition_loop_);
955 AutoLock l(lock_); 956 AutoLock l(lock_);
956 source_callback_ = callback; 957 source_callback_ = callback;
957 } 958 }
OLDNEW
« no previous file with comments | « no previous file | media/audio/linux/alsa_output_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698