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/media_stream_audio_processor.h" | 5 #include "content/renderer/media/media_stream_audio_processor.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 for (int i = 0; i < destination_->bus()->channels(); ++i) { | 204 for (int i = 0; i < destination_->bus()->channels(); ++i) { |
205 audio_source_intermediate_->SetChannelData( | 205 audio_source_intermediate_->SetChannelData( |
206 i, | 206 i, |
207 const_cast<float*>(source.channel(i))); | 207 const_cast<float*>(source.channel(i))); |
208 } | 208 } |
209 audio_source_intermediate_->set_frames(source.frames()); | 209 audio_source_intermediate_->set_frames(source.frames()); |
210 source_to_push = audio_source_intermediate_.get(); | 210 source_to_push = audio_source_intermediate_.get(); |
211 } | 211 } |
212 | 212 |
213 if (fifo_) { | 213 if (fifo_) { |
| 214 CHECK_LT(fifo_->frames(), destination_->bus()->frames()); |
214 next_audio_delay_ = audio_delay + | 215 next_audio_delay_ = audio_delay + |
215 fifo_->frames() * base::TimeDelta::FromSeconds(1) / sample_rate_; | 216 fifo_->frames() * base::TimeDelta::FromSeconds(1) / sample_rate_; |
216 fifo_->Push(source_to_push); | 217 fifo_->Push(source_to_push); |
217 } else { | 218 } else { |
| 219 CHECK(!data_available_); |
218 source_to_push->CopyTo(destination_->bus()); | 220 source_to_push->CopyTo(destination_->bus()); |
219 next_audio_delay_ = audio_delay; | 221 next_audio_delay_ = audio_delay; |
220 data_available_ = true; | 222 data_available_ = true; |
221 } | 223 } |
222 } | 224 } |
223 | 225 |
224 // Returns true if there are destination_frames() of data available to be | 226 // Returns true if there are destination_frames() of data available to be |
225 // consumed, and otherwise false. | 227 // consumed, and otherwise false. |
226 bool Consume(MediaStreamAudioBus** destination, | 228 bool Consume(MediaStreamAudioBus** destination, |
227 base::TimeDelta* audio_delay) { | 229 base::TimeDelta* audio_delay) { |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
708 if (echo_information_) { | 710 if (echo_information_) { |
709 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); | 711 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); |
710 } | 712 } |
711 | 713 |
712 // Return 0 if the volume hasn't been changed, and otherwise the new volume. | 714 // Return 0 if the volume hasn't been changed, and otherwise the new volume. |
713 return (agc->stream_analog_level() == volume) ? | 715 return (agc->stream_analog_level() == volume) ? |
714 0 : agc->stream_analog_level(); | 716 0 : agc->stream_analog_level(); |
715 } | 717 } |
716 | 718 |
717 } // namespace content | 719 } // namespace content |
OLD | NEW |