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

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

Issue 10413075: alsa_output: Drain and pause pcm when stopping. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: whitespace only. Created 8 years, 6 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // AlsaPcmOutputStream object is *not* thread-safe and should only be used 7 // AlsaPcmOutputStream object is *not* thread-safe and should only be used
8 // from the audio thread. We DCHECK on this assumption whenever we can. 8 // from the audio thread. We DCHECK on this assumption whenever we can.
9 // 9 //
10 // SEMANTICS OF Close() 10 // SEMANTICS OF Close()
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 ScheduleNextWrite(false); 328 ScheduleNextWrite(false);
329 } 329 }
330 } 330 }
331 331
332 void AlsaPcmOutputStream::Stop() { 332 void AlsaPcmOutputStream::Stop() {
333 DCHECK(IsOnAudioThread()); 333 DCHECK(IsOnAudioThread());
334 334
335 // Reset the callback, so that it is not called anymore. 335 // Reset the callback, so that it is not called anymore.
336 set_source_callback(NULL); 336 set_source_callback(NULL);
337 337
338 // Finish playing samples and pause the pcm.
339 wrapper_->PcmDrain(playback_handle_);
340
338 TransitionTo(kIsStopped); 341 TransitionTo(kIsStopped);
339 } 342 }
340 343
341 void AlsaPcmOutputStream::SetVolume(double volume) { 344 void AlsaPcmOutputStream::SetVolume(double volume) {
342 DCHECK(IsOnAudioThread()); 345 DCHECK(IsOnAudioThread());
343 346
344 volume_ = static_cast<float>(volume); 347 volume_ = static_cast<float>(volume);
345 } 348 }
346 349
347 void AlsaPcmOutputStream::GetVolume(double* volume) { 350 void AlsaPcmOutputStream::GetVolume(double* volume) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
803 } 806 }
804 807
805 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to 808 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to
806 // release ownership of the currently registered callback. 809 // release ownership of the currently registered callback.
807 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { 810 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) {
808 DCHECK(IsOnAudioThread()); 811 DCHECK(IsOnAudioThread());
809 source_callback_ = callback; 812 source_callback_ = callback;
810 } 813 }
811 814
812 } // namespace media 815 } // namespace media
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