| OLD | NEW |
| 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 Loading... |
| 328 WriteTask(); | 328 WriteTask(); |
| 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 | |
| 341 TransitionTo(kIsStopped); | 338 TransitionTo(kIsStopped); |
| 342 } | 339 } |
| 343 | 340 |
| 344 void AlsaPcmOutputStream::SetVolume(double volume) { | 341 void AlsaPcmOutputStream::SetVolume(double volume) { |
| 345 DCHECK(IsOnAudioThread()); | 342 DCHECK(IsOnAudioThread()); |
| 346 | 343 |
| 347 volume_ = static_cast<float>(volume); | 344 volume_ = static_cast<float>(volume); |
| 348 } | 345 } |
| 349 | 346 |
| 350 void AlsaPcmOutputStream::GetVolume(double* volume) { | 347 void AlsaPcmOutputStream::GetVolume(double* volume) { |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 } | 801 } |
| 805 | 802 |
| 806 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 803 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 807 // release ownership of the currently registered callback. | 804 // release ownership of the currently registered callback. |
| 808 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 805 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
| 809 DCHECK(IsOnAudioThread()); | 806 DCHECK(IsOnAudioThread()); |
| 810 source_callback_ = callback; | 807 source_callback_ = callback; |
| 811 } | 808 } |
| 812 | 809 |
| 813 } // namespace media | 810 } // namespace media |
| OLD | NEW |