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

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2887693002: Avoid render resampling when there is no need for render signal analysis. (Closed)
Patch Set: Rebase and fixes of issues occurring on some platforms Created 3 years, 7 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 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 formats_.api_format.reverse_input_stream().num_frames(), 464 formats_.api_format.reverse_input_stream().num_frames(),
465 formats_.api_format.reverse_output_stream().num_channels(), 465 formats_.api_format.reverse_output_stream().num_channels(),
466 formats_.api_format.reverse_output_stream().num_frames()); 466 formats_.api_format.reverse_output_stream().num_frames());
467 } else { 467 } else {
468 render_.render_converter.reset(nullptr); 468 render_.render_converter.reset(nullptr);
469 } 469 }
470 } else { 470 } else {
471 render_.render_audio.reset(nullptr); 471 render_.render_audio.reset(nullptr);
472 render_.render_converter.reset(nullptr); 472 render_.render_converter.reset(nullptr);
473 } 473 }
474
474 capture_.capture_audio.reset( 475 capture_.capture_audio.reset(
475 new AudioBuffer(formats_.api_format.input_stream().num_frames(), 476 new AudioBuffer(formats_.api_format.input_stream().num_frames(),
476 formats_.api_format.input_stream().num_channels(), 477 formats_.api_format.input_stream().num_channels(),
477 capture_nonlocked_.capture_processing_format.num_frames(), 478 capture_nonlocked_.capture_processing_format.num_frames(),
478 capture_audiobuffer_num_channels, 479 capture_audiobuffer_num_channels,
479 formats_.api_format.output_stream().num_frames())); 480 formats_.api_format.output_stream().num_frames()));
480 481
481 public_submodules_->echo_cancellation->Initialize( 482 public_submodules_->echo_cancellation->Initialize(
482 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(), 483 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(),
483 num_proc_channels()); 484 num_proc_channels());
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() == 590 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
590 kSampleRate8kHz) { 591 kSampleRate8kHz) {
591 render_processing_rate = kSampleRate8kHz; 592 render_processing_rate = kSampleRate8kHz;
592 } else { 593 } else {
593 render_processing_rate = 594 render_processing_rate =
594 std::max(render_processing_rate, static_cast<int>(kSampleRate16kHz)); 595 std::max(render_processing_rate, static_cast<int>(kSampleRate16kHz));
595 } 596 }
596 597
597 // Always downmix the render stream to mono for analysis. This has been 598 // Always downmix the render stream to mono for analysis. This has been
598 // demonstrated to work well for AEC in most practical scenarios. 599 // demonstrated to work well for AEC in most practical scenarios.
599 formats_.render_processing_format = StreamConfig(render_processing_rate, 1); 600 if (submodule_states_.RenderMultiBandSubModulesActive()) {
601 formats_.render_processing_format = StreamConfig(render_processing_rate, 1);
602 } else {
603 formats_.render_processing_format = StreamConfig(
604 formats_.api_format.reverse_input_stream().sample_rate_hz(),
605 formats_.api_format.reverse_input_stream().num_channels());
peah-webrtc 2017/05/19 08:07:46 This change was needed for this to work properly f
ivoc 2017/05/19 08:24:22 Acknowledged.
606 }
600 607
601 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() == 608 if (capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
602 kSampleRate32kHz || 609 kSampleRate32kHz ||
603 capture_nonlocked_.capture_processing_format.sample_rate_hz() == 610 capture_nonlocked_.capture_processing_format.sample_rate_hz() ==
604 kSampleRate48kHz) { 611 kSampleRate48kHz) {
605 capture_nonlocked_.split_rate = kSampleRate16kHz; 612 capture_nonlocked_.split_rate = kSampleRate16kHz;
606 } else { 613 } else {
607 capture_nonlocked_.split_rate = 614 capture_nonlocked_.split_rate =
608 capture_nonlocked_.capture_processing_format.sample_rate_hz(); 615 capture_nonlocked_.capture_processing_format.sample_rate_hz();
609 } 616 }
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 render_buffer->SplitIntoFrequencyBands(); 1460 render_buffer->SplitIntoFrequencyBands();
1454 } 1461 }
1455 1462
1456 #if WEBRTC_INTELLIGIBILITY_ENHANCER 1463 #if WEBRTC_INTELLIGIBILITY_ENHANCER
1457 if (capture_nonlocked_.intelligibility_enabled) { 1464 if (capture_nonlocked_.intelligibility_enabled) {
1458 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( 1465 public_submodules_->intelligibility_enhancer->ProcessRenderAudio(
1459 render_buffer); 1466 render_buffer);
1460 } 1467 }
1461 #endif 1468 #endif
1462 1469
1463 QueueBandedRenderAudio(render_buffer); 1470 if (submodule_states_.RenderMultiBandSubModulesActive()) {
peah-webrtc 2017/05/19 08:07:46 This change was needed as with the changes in this
ivoc 2017/05/19 08:24:22 Acknowledged.
1471 QueueBandedRenderAudio(render_buffer);
1472 }
1473
1464 // TODO(peah): Perform the queueing ínside QueueRenderAudiuo(). 1474 // TODO(peah): Perform the queueing ínside QueueRenderAudiuo().
1465 if (private_submodules_->echo_canceller3) { 1475 if (private_submodules_->echo_canceller3) {
1466 private_submodules_->echo_canceller3->AnalyzeRender(render_buffer); 1476 private_submodules_->echo_canceller3->AnalyzeRender(render_buffer);
1467 } 1477 }
1468 1478
1469 if (submodule_states_.RenderMultiBandProcessingActive() && 1479 if (submodule_states_.RenderMultiBandProcessingActive() &&
1470 SampleRateSupportsMultiBand( 1480 SampleRateSupportsMultiBand(
1471 formats_.render_processing_format.sample_rate_hz())) { 1481 formats_.render_processing_format.sample_rate_hz())) {
1472 render_buffer->MergeFrequencyBands(); 1482 render_buffer->MergeFrequencyBands();
1473 } 1483 }
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
2012 previous_agc_level(0), 2022 previous_agc_level(0),
2013 echo_path_gain_change(false) {} 2023 echo_path_gain_change(false) {}
2014 2024
2015 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 2025 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
2016 2026
2017 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 2027 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
2018 2028
2019 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 2029 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
2020 2030
2021 } // namespace webrtc 2031 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698