| 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 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 Loading... |
| 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 |
| OLD | NEW |