| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 OutputDeviceInfo AudioOutputStreamSink::GetOutputDeviceInfo() { | 78 OutputDeviceInfo AudioOutputStreamSink::GetOutputDeviceInfo() { |
| 79 return OutputDeviceInfo(); | 79 return OutputDeviceInfo(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool AudioOutputStreamSink::CurrentThreadIsRenderingThread() { | 82 bool AudioOutputStreamSink::CurrentThreadIsRenderingThread() { |
| 83 NOTIMPLEMENTED(); | 83 NOTIMPLEMENTED(); |
| 84 return false; | 84 return false; |
| 85 } | 85 } |
| 86 | 86 |
| 87 int AudioOutputStreamSink::OnMoreData(base::TimeDelta delay, | 87 int AudioOutputStreamSink::OnMoreData(base::TimeDelta delay, |
| 88 base::TimeTicks delay_timestamp, | 88 base::TimeTicks /* delay_timestamp */, |
| 89 int prior_frames_skipped, | 89 int prior_frames_skipped, |
| 90 AudioBus* dest) { | 90 AudioBus* dest) { |
| 91 // Note: Runs on the audio thread created by the OS. | 91 // Note: Runs on the audio thread created by the OS. |
| 92 base::AutoLock al(callback_lock_); | 92 base::AutoLock al(callback_lock_); |
| 93 if (!active_render_callback_) | 93 if (!active_render_callback_) |
| 94 return 0; | 94 return 0; |
| 95 | 95 |
| 96 return active_render_callback_->Render(delay, delay_timestamp, | 96 uint32_t frames_delayed = |
| 97 prior_frames_skipped, dest); | 97 AudioTimestampHelper::TimeToFrames(delay, active_params_.sample_rate()); |
| 98 |
| 99 return active_render_callback_->Render(dest, frames_delayed, |
| 100 prior_frames_skipped); |
| 98 } | 101 } |
| 99 | 102 |
| 100 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { | 103 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { |
| 101 // Note: Runs on the audio thread created by the OS. | 104 // Note: Runs on the audio thread created by the OS. |
| 102 base::AutoLock al(callback_lock_); | 105 base::AutoLock al(callback_lock_); |
| 103 if (active_render_callback_) | 106 if (active_render_callback_) |
| 104 active_render_callback_->OnRenderError(); | 107 active_render_callback_->OnRenderError(); |
| 105 } | 108 } |
| 106 | 109 |
| 107 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { | 110 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 DCHECK(audio_task_runner_->BelongsToCurrentThread()); | 152 DCHECK(audio_task_runner_->BelongsToCurrentThread()); |
| 150 stream_->SetVolume(volume); | 153 stream_->SetVolume(volume); |
| 151 } | 154 } |
| 152 | 155 |
| 153 void AudioOutputStreamSink::ClearCallback() { | 156 void AudioOutputStreamSink::ClearCallback() { |
| 154 base::AutoLock al(callback_lock_); | 157 base::AutoLock al(callback_lock_); |
| 155 active_render_callback_ = NULL; | 158 active_render_callback_ = NULL; |
| 156 } | 159 } |
| 157 | 160 |
| 158 } // namespace media | 161 } // namespace media |
| OLD | NEW |