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