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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 audio_task_runner_->PostTask( | 69 audio_task_runner_->PostTask( |
70 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume)); | 70 FROM_HERE, base::Bind(&AudioOutputStreamSink::DoSetVolume, this, volume)); |
71 return true; | 71 return true; |
72 } | 72 } |
73 | 73 |
74 OutputDevice* AudioOutputStreamSink::GetOutputDevice() { | 74 OutputDevice* AudioOutputStreamSink::GetOutputDevice() { |
75 return nullptr; | 75 return nullptr; |
76 } | 76 } |
77 | 77 |
78 int AudioOutputStreamSink::OnMoreData(AudioBus* dest, | 78 int AudioOutputStreamSink::OnMoreData(AudioBus* dest, |
79 uint32 total_bytes_delay) { | 79 uint32_t total_bytes_delay, |
| 80 uint32_t frames_skipped) { |
80 // Note: Runs on the audio thread created by the OS. | 81 // Note: Runs on the audio thread created by the OS. |
81 base::AutoLock al(callback_lock_); | 82 base::AutoLock al(callback_lock_); |
82 if (!active_render_callback_) | 83 if (!active_render_callback_) |
83 return 0; | 84 return 0; |
84 | 85 |
85 return active_render_callback_->Render( | 86 return active_render_callback_->Render( |
86 dest, total_bytes_delay * 1000.0 / active_params_.GetBytesPerSecond()); | 87 dest, total_bytes_delay * 1000.0 / active_params_.GetBytesPerSecond(), 0); |
87 } | 88 } |
88 | 89 |
89 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { | 90 void AudioOutputStreamSink::OnError(AudioOutputStream* stream) { |
90 // Note: Runs on the audio thread created by the OS. | 91 // Note: Runs on the audio thread created by the OS. |
91 base::AutoLock al(callback_lock_); | 92 base::AutoLock al(callback_lock_); |
92 if (active_render_callback_) | 93 if (active_render_callback_) |
93 active_render_callback_->OnRenderError(); | 94 active_render_callback_->OnRenderError(); |
94 } | 95 } |
95 | 96 |
96 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { | 97 void AudioOutputStreamSink::DoStart(const AudioParameters& params) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 DCHECK(audio_task_runner_->BelongsToCurrentThread()); | 139 DCHECK(audio_task_runner_->BelongsToCurrentThread()); |
139 stream_->SetVolume(volume); | 140 stream_->SetVolume(volume); |
140 } | 141 } |
141 | 142 |
142 void AudioOutputStreamSink::ClearCallback() { | 143 void AudioOutputStreamSink::ClearCallback() { |
143 base::AutoLock al(callback_lock_); | 144 base::AutoLock al(callback_lock_); |
144 active_render_callback_ = NULL; | 145 active_render_callback_ = NULL; |
145 } | 146 } |
146 | 147 |
147 } // namepace media | 148 } // namepace media |
OLD | NEW |