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

Side by Side Diff: content/renderer/media/media_stream_audio_processor.cc

Issue 1357013006: Add detection for repeated audio in capturing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: on andrew's comment Created 5 years, 2 months 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
OLDNEW
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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 DCHECK(processed_data); 291 DCHECK(processed_data);
292 DCHECK(capture_delay); 292 DCHECK(capture_delay);
293 DCHECK(new_volume); 293 DCHECK(new_volume);
294 294
295 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData"); 295 TRACE_EVENT0("audio", "MediaStreamAudioProcessor::ProcessAndConsumeData");
296 296
297 MediaStreamAudioBus* process_bus; 297 MediaStreamAudioBus* process_bus;
298 if (!capture_fifo_->Consume(&process_bus, capture_delay)) 298 if (!capture_fifo_->Consume(&process_bus, capture_delay))
299 return false; 299 return false;
300 300
301 // Detect bit-exact repetition of audio present in the captured audio.
302 // We detect only one channel.
303 audio_repetition_detector_.Detect(process_bus->bus()->channel(0),
304 process_bus->bus()->frames(),
305 1, // number of channels
306 input_format_.sample_rate());
307
301 // Use the process bus directly if audio processing is disabled. 308 // Use the process bus directly if audio processing is disabled.
302 MediaStreamAudioBus* output_bus = process_bus; 309 MediaStreamAudioBus* output_bus = process_bus;
303 *new_volume = 0; 310 *new_volume = 0;
304 if (audio_processing_) { 311 if (audio_processing_) {
305 output_bus = output_bus_.get(); 312 output_bus = output_bus_.get();
306 *new_volume = ProcessData(process_bus->channel_ptrs(), 313 *new_volume = ProcessData(process_bus->channel_ptrs(),
307 process_bus->bus()->frames(), *capture_delay, 314 process_bus->bus()->frames(), *capture_delay,
308 volume, key_pressed, output_bus->channel_ptrs()); 315 volume, key_pressed, output_bus->channel_ptrs());
309 } 316 }
310 317
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 if (echo_information_) { 687 if (echo_information_) {
681 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation()); 688 echo_information_.get()->UpdateAecDelayStats(ap->echo_cancellation());
682 } 689 }
683 690
684 // Return 0 if the volume hasn't been changed, and otherwise the new volume. 691 // Return 0 if the volume hasn't been changed, and otherwise the new volume.
685 return (agc->stream_analog_level() == volume) ? 692 return (agc->stream_analog_level() == volume) ?
686 0 : agc->stream_analog_level(); 693 0 : agc->stream_analog_level();
687 } 694 }
688 695
689 } // namespace content 696 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698