Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "media/audio/audio_output_stream_sink.h" | 5 #include "media/audio/audio_output_stream_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 base::AutoLock al(callback_lock_); | 50 base::AutoLock al(callback_lock_); |
| 51 active_render_callback_ = render_callback_; | 51 active_render_callback_ = render_callback_; |
| 52 audio_task_runner_->PostTask( | 52 audio_task_runner_->PostTask( |
| 53 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoPlay, this)); | 53 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoPlay, this)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool AudioOutputStreamSink::SetVolume(double volume) { | 56 bool AudioOutputStreamSink::SetVolume(double volume) { |
| 57 audio_task_runner_->PostTask( | 57 audio_task_runner_->PostTask( |
| 58 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume)); | 58 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume)); |
| 59 return true; | 59 return true; |
| 60 }; | 60 } |
| 61 | |
| 62 void AudioOutputStreamSink::SwitchOutputDevice( | |
| 63 const std::string& device_id, | |
| 64 const GURL& security_origin, | |
| 65 const base::Callback<void(int)>& callback) { } | |
|
miu
2015/06/03 21:01:01
All the other default method implementations run t
| |
| 66 | |
| 61 | 67 |
| 62 int AudioOutputStreamSink::OnMoreData(AudioBus* dest, | 68 int AudioOutputStreamSink::OnMoreData(AudioBus* dest, |
| 63 uint32 total_bytes_delay) { | 69 uint32 total_bytes_delay) { |
| 64 // Note: Runs on the audio thread created by the OS. | 70 // Note: Runs on the audio thread created by the OS. |
| 65 base::AutoLock al(callback_lock_); | 71 base::AutoLock al(callback_lock_); |
| 66 if (!active_render_callback_) | 72 if (!active_render_callback_) |
| 67 return 0; | 73 return 0; |
| 68 | 74 |
| 69 return active_render_callback_->Render( | 75 return active_render_callback_->Render( |
| 70 dest, total_bytes_delay * 1000.0 / params_.GetBytesPerSecond()); | 76 dest, total_bytes_delay * 1000.0 / params_.GetBytesPerSecond()); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 DCHECK(audio_task_runner_->BelongsToCurrentThread()); | 123 DCHECK(audio_task_runner_->BelongsToCurrentThread()); |
| 118 stream_->SetVolume(volume); | 124 stream_->SetVolume(volume); |
| 119 } | 125 } |
| 120 | 126 |
| 121 void AudioOutputStreamSink::ClearCallback() { | 127 void AudioOutputStreamSink::ClearCallback() { |
| 122 base::AutoLock al(callback_lock_); | 128 base::AutoLock al(callback_lock_); |
| 123 active_render_callback_ = NULL; | 129 active_render_callback_ = NULL; |
| 124 } | 130 } |
| 125 | 131 |
| 126 } // namepace media | 132 } // namepace media |
| OLD | NEW |