Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(825)

Side by Side Diff: media/audio/audio_output_stream_sink.cc

Issue 2452183003: Revert of Make more media APIs aware of |delay| and |delay_timestamp| (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/audio_output_device_unittest.cc ('k') | media/audio/clockless_audio_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/audio/audio_output_device_unittest.cc ('k') | media/audio/clockless_audio_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698