OLD | NEW |
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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 #define RETURN_ON_ERR(expr) \ | 52 #define RETURN_ON_ERR(expr) \ |
53 do { \ | 53 do { \ |
54 int err = (expr); \ | 54 int err = (expr); \ |
55 if (err != kNoError) { \ | 55 if (err != kNoError) { \ |
56 return err; \ | 56 return err; \ |
57 } \ | 57 } \ |
58 } while (0) | 58 } while (0) |
59 | 59 |
60 namespace webrtc { | 60 namespace webrtc { |
| 61 |
| 62 const int AudioProcessing::kNativeSampleRatesHz[] = { |
| 63 AudioProcessing::kSampleRate8kHz, |
| 64 AudioProcessing::kSampleRate16kHz, |
| 65 #ifdef WEBRTC_ARCH_ARM_FAMILY |
| 66 AudioProcessing::kSampleRate32kHz}; |
| 67 #else |
| 68 AudioProcessing::kSampleRate32kHz, |
| 69 AudioProcessing::kSampleRate48kHz}; |
| 70 #endif // WEBRTC_ARCH_ARM_FAMILY |
| 71 const size_t AudioProcessing::kNumNativeSampleRates = |
| 72 arraysize(AudioProcessing::kNativeSampleRatesHz); |
| 73 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: |
| 74 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; |
| 75 |
61 namespace { | 76 namespace { |
62 | 77 |
63 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { | 78 static bool LayoutHasKeyboard(AudioProcessing::ChannelLayout layout) { |
64 switch (layout) { | 79 switch (layout) { |
65 case AudioProcessing::kMono: | 80 case AudioProcessing::kMono: |
66 case AudioProcessing::kStereo: | 81 case AudioProcessing::kStereo: |
67 return false; | 82 return false; |
68 case AudioProcessing::kMonoAndKeyboard: | 83 case AudioProcessing::kMonoAndKeyboard: |
69 case AudioProcessing::kStereoAndKeyboard: | 84 case AudioProcessing::kStereoAndKeyboard: |
70 return true; | 85 return true; |
71 } | 86 } |
72 | 87 |
73 assert(false); | 88 assert(false); |
74 return false; | 89 return false; |
75 } | 90 } |
| 91 |
| 92 bool is_multi_band(int sample_rate_hz) { |
| 93 return sample_rate_hz == AudioProcessing::kSampleRate32kHz || |
| 94 sample_rate_hz == AudioProcessing::kSampleRate48kHz; |
| 95 } |
| 96 |
| 97 int ClosestNativeRate(int min_proc_rate) { |
| 98 for (int rate : AudioProcessing::kNativeSampleRatesHz) { |
| 99 if (rate >= min_proc_rate) { |
| 100 return rate; |
| 101 } |
| 102 } |
| 103 return AudioProcessing::kMaxNativeSampleRateHz; |
| 104 } |
| 105 |
76 } // namespace | 106 } // namespace |
77 | 107 |
78 // Throughout webrtc, it's assumed that success is represented by zero. | 108 // Throughout webrtc, it's assumed that success is represented by zero. |
79 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); | 109 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); |
80 | 110 |
81 struct AudioProcessingImpl::ApmPublicSubmodules { | 111 struct AudioProcessingImpl::ApmPublicSubmodules { |
82 ApmPublicSubmodules() {} | 112 ApmPublicSubmodules() {} |
83 // Accessed externally of APM without any lock acquired. | 113 // Accessed externally of APM without any lock acquired. |
84 std::unique_ptr<EchoCancellationImpl> echo_cancellation; | 114 std::unique_ptr<EchoCancellationImpl> echo_cancellation; |
85 std::unique_ptr<EchoControlMobileImpl> echo_control_mobile; | 115 std::unique_ptr<EchoControlMobileImpl> echo_control_mobile; |
(...skipping 11 matching lines...) Expand all Loading... |
97 }; | 127 }; |
98 | 128 |
99 struct AudioProcessingImpl::ApmPrivateSubmodules { | 129 struct AudioProcessingImpl::ApmPrivateSubmodules { |
100 explicit ApmPrivateSubmodules(Beamformer<float>* beamformer) | 130 explicit ApmPrivateSubmodules(Beamformer<float>* beamformer) |
101 : beamformer(beamformer) {} | 131 : beamformer(beamformer) {} |
102 // Accessed internally from capture or during initialization | 132 // Accessed internally from capture or during initialization |
103 std::unique_ptr<Beamformer<float>> beamformer; | 133 std::unique_ptr<Beamformer<float>> beamformer; |
104 std::unique_ptr<AgcManagerDirect> agc_manager; | 134 std::unique_ptr<AgcManagerDirect> agc_manager; |
105 }; | 135 }; |
106 | 136 |
107 const int AudioProcessing::kNativeSampleRatesHz[] = { | |
108 AudioProcessing::kSampleRate8kHz, | |
109 AudioProcessing::kSampleRate16kHz, | |
110 #ifdef WEBRTC_ARCH_ARM_FAMILY | |
111 AudioProcessing::kSampleRate32kHz}; | |
112 #else | |
113 AudioProcessing::kSampleRate32kHz, | |
114 AudioProcessing::kSampleRate48kHz}; | |
115 #endif // WEBRTC_ARCH_ARM_FAMILY | |
116 const size_t AudioProcessing::kNumNativeSampleRates = | |
117 arraysize(AudioProcessing::kNativeSampleRatesHz); | |
118 const int AudioProcessing::kMaxNativeSampleRateHz = AudioProcessing:: | |
119 kNativeSampleRatesHz[AudioProcessing::kNumNativeSampleRates - 1]; | |
120 | |
121 AudioProcessing* AudioProcessing::Create() { | 137 AudioProcessing* AudioProcessing::Create() { |
122 Config config; | 138 Config config; |
123 return Create(config, nullptr); | 139 return Create(config, nullptr); |
124 } | 140 } |
125 | 141 |
126 AudioProcessing* AudioProcessing::Create(const Config& config) { | 142 AudioProcessing* AudioProcessing::Create(const Config& config) { |
127 return Create(config, nullptr); | 143 return Create(config, nullptr); |
128 } | 144 } |
129 | 145 |
130 AudioProcessing* AudioProcessing::Create(const Config& config, | 146 AudioProcessing* AudioProcessing::Create(const Config& config, |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 return kBadNumberChannelsError; | 355 return kBadNumberChannelsError; |
340 } | 356 } |
341 | 357 |
342 if (capture_nonlocked_.beamformer_enabled && | 358 if (capture_nonlocked_.beamformer_enabled && |
343 num_in_channels != capture_.array_geometry.size()) { | 359 num_in_channels != capture_.array_geometry.size()) { |
344 return kBadNumberChannelsError; | 360 return kBadNumberChannelsError; |
345 } | 361 } |
346 | 362 |
347 formats_.api_format = config; | 363 formats_.api_format = config; |
348 | 364 |
349 // We process at the closest native rate >= min(input rate, output rate). | 365 capture_nonlocked_.fwd_proc_format = StreamConfig(ClosestNativeRate(std::min( |
350 const int min_proc_rate = | 366 formats_.api_format.input_stream().sample_rate_hz(), |
351 std::min(formats_.api_format.input_stream().sample_rate_hz(), | 367 formats_.api_format.output_stream().sample_rate_hz()))); |
352 formats_.api_format.output_stream().sample_rate_hz()); | |
353 int fwd_proc_rate; | |
354 for (size_t i = 0; i < kNumNativeSampleRates; ++i) { | |
355 fwd_proc_rate = kNativeSampleRatesHz[i]; | |
356 if (fwd_proc_rate >= min_proc_rate) { | |
357 break; | |
358 } | |
359 } | |
360 | 368 |
361 capture_nonlocked_.fwd_proc_format = StreamConfig(fwd_proc_rate); | 369 int rev_proc_rate = ClosestNativeRate(std::min( |
362 | 370 formats_.api_format.reverse_input_stream().sample_rate_hz(), |
363 // We normally process the reverse stream at 16 kHz. Unless... | 371 formats_.api_format.reverse_output_stream().sample_rate_hz())); |
364 int rev_proc_rate = kSampleRate16kHz; | 372 // If the forward sample rate is 8 kHz, the reverse stream is also processed |
| 373 // at this rate. |
365 if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate8kHz) { | 374 if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate8kHz) { |
366 // ...the forward stream is at 8 kHz. | |
367 rev_proc_rate = kSampleRate8kHz; | 375 rev_proc_rate = kSampleRate8kHz; |
368 } else { | 376 } else { |
369 if (formats_.api_format.reverse_input_stream().sample_rate_hz() == | 377 rev_proc_rate = std::max(rev_proc_rate, static_cast<int>(kSampleRate16kHz)); |
370 kSampleRate32kHz) { | |
371 // ...or the input is at 32 kHz, in which case we use the splitting | |
372 // filter rather than the resampler. | |
373 rev_proc_rate = kSampleRate32kHz; | |
374 } | |
375 } | 378 } |
376 | 379 |
377 // Always downmix the reverse stream to mono for analysis. This has been | 380 // Always downmix the reverse stream to mono for analysis. This has been |
378 // demonstrated to work well for AEC in most practical scenarios. | 381 // demonstrated to work well for AEC in most practical scenarios. |
379 formats_.rev_proc_format = StreamConfig(rev_proc_rate, 1); | 382 formats_.rev_proc_format = StreamConfig(rev_proc_rate, 1); |
380 | 383 |
381 if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate32kHz || | 384 if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate32kHz || |
382 capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate48kHz) { | 385 capture_nonlocked_.fwd_proc_format.sample_rate_hz() == kSampleRate48kHz) { |
383 capture_nonlocked_.split_rate = kSampleRate16kHz; | 386 capture_nonlocked_.split_rate = kSampleRate16kHz; |
384 } else { | 387 } else { |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM); | 623 debug_dump_.capture.event_msg->set_type(audioproc::Event::STREAM); |
621 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); | 624 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); |
622 const size_t data_size = | 625 const size_t data_size = |
623 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; | 626 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; |
624 msg->set_input_data(frame->data_, data_size); | 627 msg->set_input_data(frame->data_, data_size); |
625 } | 628 } |
626 #endif | 629 #endif |
627 | 630 |
628 capture_.capture_audio->DeinterleaveFrom(frame); | 631 capture_.capture_audio->DeinterleaveFrom(frame); |
629 RETURN_ON_ERR(ProcessStreamLocked()); | 632 RETURN_ON_ERR(ProcessStreamLocked()); |
630 capture_.capture_audio->InterleaveTo(frame, | 633 capture_.capture_audio->InterleaveTo(frame, output_copy_needed()); |
631 output_copy_needed(is_data_processed())); | |
632 | 634 |
633 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP | 635 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP |
634 if (debug_dump_.debug_file->Open()) { | 636 if (debug_dump_.debug_file->Open()) { |
635 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); | 637 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); |
636 const size_t data_size = | 638 const size_t data_size = |
637 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; | 639 sizeof(int16_t) * frame->samples_per_channel_ * frame->num_channels_; |
638 msg->set_output_data(frame->data_, data_size); | 640 msg->set_output_data(frame->data_, data_size); |
639 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 641 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
640 &debug_dump_.num_bytes_left_for_log_, | 642 &debug_dump_.num_bytes_left_for_log_, |
641 &crit_debug_, &debug_dump_.capture)); | 643 &crit_debug_, &debug_dump_.capture)); |
(...skipping 25 matching lines...) Expand all Loading... |
667 | 669 |
668 AudioBuffer* ca = capture_.capture_audio.get(); // For brevity. | 670 AudioBuffer* ca = capture_.capture_audio.get(); // For brevity. |
669 | 671 |
670 if (constants_.use_experimental_agc && | 672 if (constants_.use_experimental_agc && |
671 public_submodules_->gain_control->is_enabled()) { | 673 public_submodules_->gain_control->is_enabled()) { |
672 private_submodules_->agc_manager->AnalyzePreProcess( | 674 private_submodules_->agc_manager->AnalyzePreProcess( |
673 ca->channels()[0], ca->num_channels(), | 675 ca->channels()[0], ca->num_channels(), |
674 capture_nonlocked_.fwd_proc_format.num_frames()); | 676 capture_nonlocked_.fwd_proc_format.num_frames()); |
675 } | 677 } |
676 | 678 |
677 bool data_processed = is_data_processed(); | 679 if (fwd_analysis_needed()) { |
678 if (analysis_needed(data_processed)) { | |
679 ca->SplitIntoFrequencyBands(); | 680 ca->SplitIntoFrequencyBands(); |
680 } | 681 } |
681 | 682 |
682 if (capture_nonlocked_.beamformer_enabled) { | 683 if (capture_nonlocked_.beamformer_enabled) { |
683 private_submodules_->beamformer->ProcessChunk(*ca->split_data_f(), | 684 private_submodules_->beamformer->ProcessChunk(*ca->split_data_f(), |
684 ca->split_data_f()); | 685 ca->split_data_f()); |
685 ca->set_num_channels(1); | 686 ca->set_num_channels(1); |
686 } | 687 } |
687 | 688 |
688 public_submodules_->high_pass_filter->ProcessCaptureAudio(ca); | 689 public_submodules_->high_pass_filter->ProcessCaptureAudio(ca); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 public_submodules_->gain_control->is_enabled() && | 727 public_submodules_->gain_control->is_enabled() && |
727 (!capture_nonlocked_.beamformer_enabled || | 728 (!capture_nonlocked_.beamformer_enabled || |
728 private_submodules_->beamformer->is_target_present())) { | 729 private_submodules_->beamformer->is_target_present())) { |
729 private_submodules_->agc_manager->Process( | 730 private_submodules_->agc_manager->Process( |
730 ca->split_bands_const(0)[kBand0To8kHz], ca->num_frames_per_band(), | 731 ca->split_bands_const(0)[kBand0To8kHz], ca->num_frames_per_band(), |
731 capture_nonlocked_.split_rate); | 732 capture_nonlocked_.split_rate); |
732 } | 733 } |
733 RETURN_ON_ERR(public_submodules_->gain_control->ProcessCaptureAudio( | 734 RETURN_ON_ERR(public_submodules_->gain_control->ProcessCaptureAudio( |
734 ca, echo_cancellation()->stream_has_echo())); | 735 ca, echo_cancellation()->stream_has_echo())); |
735 | 736 |
736 if (synthesis_needed(data_processed)) { | 737 if (fwd_synthesis_needed()) { |
737 ca->MergeFrequencyBands(); | 738 ca->MergeFrequencyBands(); |
738 } | 739 } |
739 | 740 |
740 // TODO(aluebs): Investigate if the transient suppression placement should be | 741 // TODO(aluebs): Investigate if the transient suppression placement should be |
741 // before or after the AGC. | 742 // before or after the AGC. |
742 if (capture_.transient_suppressor_enabled) { | 743 if (capture_.transient_suppressor_enabled) { |
743 float voice_probability = | 744 float voice_probability = |
744 private_submodules_->agc_manager.get() | 745 private_submodules_->agc_manager.get() |
745 ? private_submodules_->agc_manager->voice_probability() | 746 ? private_submodules_->agc_manager->voice_probability() |
746 : 1.f; | 747 : 1.f; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
896 &debug_dump_.num_bytes_left_for_log_, | 897 &debug_dump_.num_bytes_left_for_log_, |
897 &crit_debug_, &debug_dump_.render)); | 898 &crit_debug_, &debug_dump_.render)); |
898 } | 899 } |
899 #endif | 900 #endif |
900 render_.render_audio->DeinterleaveFrom(frame); | 901 render_.render_audio->DeinterleaveFrom(frame); |
901 return ProcessReverseStreamLocked(); | 902 return ProcessReverseStreamLocked(); |
902 } | 903 } |
903 | 904 |
904 int AudioProcessingImpl::ProcessReverseStreamLocked() { | 905 int AudioProcessingImpl::ProcessReverseStreamLocked() { |
905 AudioBuffer* ra = render_.render_audio.get(); // For brevity. | 906 AudioBuffer* ra = render_.render_audio.get(); // For brevity. |
906 if (formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz) { | 907 if (rev_analysis_needed()) { |
907 ra->SplitIntoFrequencyBands(); | 908 ra->SplitIntoFrequencyBands(); |
908 } | 909 } |
909 | 910 |
910 if (constants_.intelligibility_enabled) { | 911 if (constants_.intelligibility_enabled) { |
911 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( | 912 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( |
912 ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate, | 913 ra->split_channels_f(kBand0To8kHz), capture_nonlocked_.split_rate, |
913 ra->num_channels()); | 914 ra->num_channels()); |
914 } | 915 } |
915 | 916 |
916 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra)); | 917 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessRenderAudio(ra)); |
917 RETURN_ON_ERR( | 918 RETURN_ON_ERR( |
918 public_submodules_->echo_control_mobile->ProcessRenderAudio(ra)); | 919 public_submodules_->echo_control_mobile->ProcessRenderAudio(ra)); |
919 if (!constants_.use_experimental_agc) { | 920 if (!constants_.use_experimental_agc) { |
920 RETURN_ON_ERR(public_submodules_->gain_control->ProcessRenderAudio(ra)); | 921 RETURN_ON_ERR(public_submodules_->gain_control->ProcessRenderAudio(ra)); |
921 } | 922 } |
922 | 923 |
923 if (formats_.rev_proc_format.sample_rate_hz() == kSampleRate32kHz && | 924 if (rev_synthesis_needed()) { |
924 is_rev_processed()) { | |
925 ra->MergeFrequencyBands(); | 925 ra->MergeFrequencyBands(); |
926 } | 926 } |
927 | 927 |
928 return kNoError; | 928 return kNoError; |
929 } | 929 } |
930 | 930 |
931 int AudioProcessingImpl::set_stream_delay_ms(int delay) { | 931 int AudioProcessingImpl::set_stream_delay_ms(int delay) { |
932 rtc::CritScope cs(&crit_capture_); | 932 rtc::CritScope cs(&crit_capture_); |
933 Error retval = kNoError; | 933 Error retval = kNoError; |
934 capture_.was_stream_delay_set = true; | 934 capture_.was_stream_delay_set = true; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1121 public_submodules_->echo_cancellation->is_enabled() || | 1121 public_submodules_->echo_cancellation->is_enabled() || |
1122 public_submodules_->echo_control_mobile->is_enabled() || | 1122 public_submodules_->echo_control_mobile->is_enabled() || |
1123 public_submodules_->gain_control->is_enabled()) { | 1123 public_submodules_->gain_control->is_enabled()) { |
1124 return true; | 1124 return true; |
1125 } | 1125 } |
1126 | 1126 |
1127 // The capture data is otherwise unchanged. | 1127 // The capture data is otherwise unchanged. |
1128 return false; | 1128 return false; |
1129 } | 1129 } |
1130 | 1130 |
1131 bool AudioProcessingImpl::output_copy_needed(bool is_data_processed) const { | 1131 bool AudioProcessingImpl::output_copy_needed() const { |
1132 // Check if we've upmixed or downmixed the audio. | 1132 // Check if we've upmixed or downmixed the audio. |
1133 return ((formats_.api_format.output_stream().num_channels() != | 1133 return ((formats_.api_format.output_stream().num_channels() != |
1134 formats_.api_format.input_stream().num_channels()) || | 1134 formats_.api_format.input_stream().num_channels()) || |
1135 is_data_processed || capture_.transient_suppressor_enabled); | 1135 is_data_processed() || capture_.transient_suppressor_enabled); |
1136 } | 1136 } |
1137 | 1137 |
1138 bool AudioProcessingImpl::synthesis_needed(bool is_data_processed) const { | 1138 bool AudioProcessingImpl::fwd_synthesis_needed() const { |
1139 return (is_data_processed && | 1139 return (is_data_processed() && |
1140 (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == | 1140 is_multi_band(capture_nonlocked_.fwd_proc_format.sample_rate_hz())); |
1141 kSampleRate32kHz || | |
1142 capture_nonlocked_.fwd_proc_format.sample_rate_hz() == | |
1143 kSampleRate48kHz)); | |
1144 } | 1141 } |
1145 | 1142 |
1146 bool AudioProcessingImpl::analysis_needed(bool is_data_processed) const { | 1143 bool AudioProcessingImpl::fwd_analysis_needed() const { |
1147 if (!is_data_processed && | 1144 if (!is_data_processed() && |
1148 !public_submodules_->voice_detection->is_enabled() && | 1145 !public_submodules_->voice_detection->is_enabled() && |
1149 !capture_.transient_suppressor_enabled) { | 1146 !capture_.transient_suppressor_enabled) { |
1150 // Only public_submodules_->level_estimator is enabled. | 1147 // Only public_submodules_->level_estimator is enabled. |
1151 return false; | 1148 return false; |
1152 } else if (capture_nonlocked_.fwd_proc_format.sample_rate_hz() == | 1149 } else if (is_multi_band( |
1153 kSampleRate32kHz || | 1150 capture_nonlocked_.fwd_proc_format.sample_rate_hz())) { |
1154 capture_nonlocked_.fwd_proc_format.sample_rate_hz() == | |
1155 kSampleRate48kHz) { | |
1156 // Something besides public_submodules_->level_estimator is enabled, and we | 1151 // Something besides public_submodules_->level_estimator is enabled, and we |
1157 // have super-wb. | 1152 // have super-wb. |
1158 return true; | 1153 return true; |
1159 } | 1154 } |
1160 return false; | 1155 return false; |
1161 } | 1156 } |
1162 | 1157 |
1163 bool AudioProcessingImpl::is_rev_processed() const { | 1158 bool AudioProcessingImpl::is_rev_processed() const { |
1164 return constants_.intelligibility_enabled; | 1159 return constants_.intelligibility_enabled; |
1165 } | 1160 } |
1166 | 1161 |
| 1162 bool AudioProcessingImpl::rev_synthesis_needed() const { |
| 1163 return (is_rev_processed() && |
| 1164 is_multi_band(formats_.rev_proc_format.sample_rate_hz())); |
| 1165 } |
| 1166 |
| 1167 bool AudioProcessingImpl::rev_analysis_needed() const { |
| 1168 return is_multi_band(formats_.rev_proc_format.sample_rate_hz()); |
| 1169 } |
| 1170 |
1167 bool AudioProcessingImpl::render_check_rev_conversion_needed() const { | 1171 bool AudioProcessingImpl::render_check_rev_conversion_needed() const { |
1168 return rev_conversion_needed(); | 1172 return rev_conversion_needed(); |
1169 } | 1173 } |
1170 | 1174 |
1171 bool AudioProcessingImpl::rev_conversion_needed() const { | 1175 bool AudioProcessingImpl::rev_conversion_needed() const { |
1172 return (formats_.api_format.reverse_input_stream() != | 1176 return (formats_.api_format.reverse_input_stream() != |
1173 formats_.api_format.reverse_output_stream()); | 1177 formats_.api_format.reverse_output_stream()); |
1174 } | 1178 } |
1175 | 1179 |
1176 void AudioProcessingImpl::InitializeExperimentalAgc() { | 1180 void AudioProcessingImpl::InitializeExperimentalAgc() { |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); | 1453 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); |
1450 | 1454 |
1451 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), | 1455 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), |
1452 &debug_dump_.num_bytes_left_for_log_, | 1456 &debug_dump_.num_bytes_left_for_log_, |
1453 &crit_debug_, &debug_dump_.capture)); | 1457 &crit_debug_, &debug_dump_.capture)); |
1454 return kNoError; | 1458 return kNoError; |
1455 } | 1459 } |
1456 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP | 1460 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP |
1457 | 1461 |
1458 } // namespace webrtc | 1462 } // namespace webrtc |
OLD | NEW |