| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/webrtc_local_audio_source_provider.h" | 5 #include "content/renderer/media/webrtc_local_audio_source_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/renderer/render_thread_impl.h" | 8 #include "content/renderer/render_thread_impl.h" |
| 9 #include "media/base/audio_fifo.h" | 9 #include "media/base/audio_fifo.h" |
| 10 #include "media/base/audio_hardware_config.h" | 10 #include "media/base/audio_hardware_config.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 output_wrapper_->SetChannelData(i, audio_data[i]); | 123 output_wrapper_->SetChannelData(i, audio_data[i]); |
| 124 | 124 |
| 125 base::AutoLock auto_lock(lock_); | 125 base::AutoLock auto_lock(lock_); |
| 126 if (!audio_converter_) | 126 if (!audio_converter_) |
| 127 return; | 127 return; |
| 128 | 128 |
| 129 is_enabled_ = true; | 129 is_enabled_ = true; |
| 130 audio_converter_->Convert(output_wrapper_.get()); | 130 audio_converter_->Convert(output_wrapper_.get()); |
| 131 } | 131 } |
| 132 | 132 |
| 133 double WebRtcLocalAudioSourceProvider::ProvideInput( | 133 double WebRtcLocalAudioSourceProvider::ProvideInput(media::AudioBus* audio_bus, |
| 134 media::AudioBus* audio_bus, base::TimeDelta buffer_delay) { | 134 uint32_t frames_delayed) { |
| 135 if (fifo_->frames() >= audio_bus->frames()) { | 135 if (fifo_->frames() >= audio_bus->frames()) { |
| 136 fifo_->Consume(audio_bus, 0, audio_bus->frames()); | 136 fifo_->Consume(audio_bus, 0, audio_bus->frames()); |
| 137 } else { | 137 } else { |
| 138 audio_bus->Zero(); | 138 audio_bus->Zero(); |
| 139 DVLOG(1) << "WARNING: Underrun, FIFO has data " << fifo_->frames() | 139 DVLOG(1) << "WARNING: Underrun, FIFO has data " << fifo_->frames() |
| 140 << " samples but " << audio_bus->frames() | 140 << " samples but " << audio_bus->frames() |
| 141 << " samples are needed"; | 141 << " samples are needed"; |
| 142 } | 142 } |
| 143 | 143 |
| 144 return 1.0; | 144 return 1.0; |
| 145 } | 145 } |
| 146 | 146 |
| 147 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting( | 147 void WebRtcLocalAudioSourceProvider::SetSinkParamsForTesting( |
| 148 const media::AudioParameters& sink_params) { | 148 const media::AudioParameters& sink_params) { |
| 149 sink_params_ = sink_params; | 149 sink_params_ = sink_params; |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace content | 152 } // namespace content |
| OLD | NEW |