Chromium Code Reviews| 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 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 327 if (!stop_stream_) | 327 if (!stop_stream_) |
| 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 // Finish playing samples and pause the pcm. | |
|
scherkus (not reviewing)
2012/05/24 17:57:28
nit: we're pretty generous with vertical whitespac
| |
| 338 wrapper_->PcmDrain(playback_handle_); | |
| 337 | 339 |
| 338 TransitionTo(kIsStopped); | 340 TransitionTo(kIsStopped); |
| 339 } | 341 } |
| 340 | 342 |
| 341 void AlsaPcmOutputStream::SetVolume(double volume) { | 343 void AlsaPcmOutputStream::SetVolume(double volume) { |
| 342 DCHECK(IsOnAudioThread()); | 344 DCHECK(IsOnAudioThread()); |
| 343 | 345 |
| 344 volume_ = static_cast<float>(volume); | 346 volume_ = static_cast<float>(volume); |
| 345 } | 347 } |
| 346 | 348 |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 803 } | 805 } |
| 804 | 806 |
| 805 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to | 807 // Changes the AudioSourceCallback to proxy calls to. Pass in NULL to |
| 806 // release ownership of the currently registered callback. | 808 // release ownership of the currently registered callback. |
| 807 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { | 809 void AlsaPcmOutputStream::set_source_callback(AudioSourceCallback* callback) { |
| 808 DCHECK(IsOnAudioThread()); | 810 DCHECK(IsOnAudioThread()); |
| 809 source_callback_ = callback; | 811 source_callback_ = callback; |
| 810 } | 812 } |
| 811 | 813 |
| 812 } // namespace media | 814 } // namespace media |
| OLD | NEW |