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 uint32_t frames_delayed = | 96 return active_render_callback_->Render(delay, delay_timestamp, |
97 AudioTimestampHelper::TimeToFrames(delay, active_params_.sample_rate()); | 97 prior_frames_skipped, dest); |
98 | |
99 return active_render_callback_->Render(dest, frames_delayed, | |
100 prior_frames_skipped); | |
101 } | 98 } |
102 | 99 |
103 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { | 100 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { |
104 // Note: Runs on the audio thread created by the OS. | 101 // Note: Runs on the audio thread created by the OS. |
105 base::AutoLock al(callback_lock_); | 102 base::AutoLock al(callback_lock_); |
106 if (active_render_callback_) | 103 if (active_render_callback_) |
107 active_render_callback_->OnRenderError(); | 104 active_render_callback_->OnRenderError(); |
108 } | 105 } |
109 | 106 |
110 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { | 107 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 DCHECK(audio_task_runner_->BelongsToCurrentThread()); | 149 DCHECK(audio_task_runner_->BelongsToCurrentThread()); |
153 stream_->SetVolume(volume); | 150 stream_->SetVolume(volume); |
154 } | 151 } |
155 | 152 |
156 void AudioOutputStreamSink::ClearCallback() { | 153 void AudioOutputStreamSink::ClearCallback() { |
157 base::AutoLock al(callback_lock_); | 154 base::AutoLock al(callback_lock_); |
158 active_render_callback_ = NULL; | 155 active_render_callback_ = NULL; |
159 } | 156 } |
160 | 157 |
161 } // namespace media | 158 } // namespace media |
OLD | NEW |