[webrtc] Only init WebRtcAec callbacks once.

This commit is contained in:
Fedor 2020-11-26 05:42:22 +02:00
parent b7459cf8ab
commit 270d402d1f
1 changed files with 21 additions and 17 deletions

View File

@ -23,6 +23,7 @@
#include <stddef.h> // size_t #include <stddef.h> // size_t
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include "webrtc/common_audio/ring_buffer.h" #include "webrtc/common_audio/ring_buffer.h"
#include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h"
@ -1573,33 +1574,36 @@ AecCore* WebRtcAec_CreateAec() {
#endif #endif
aec->extended_filter_enabled = 0; aec->extended_filter_enabled = 0;
// Assembly optimization static bool initted = false;
WebRtcAec_FilterFar = FilterFar; if (!initted) {
WebRtcAec_ScaleErrorSignal = ScaleErrorSignal; initted = true;
WebRtcAec_FilterAdaptation = FilterAdaptation; // Assembly optimization
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress; WebRtcAec_FilterFar = FilterFar;
WebRtcAec_ComfortNoise = ComfortNoise; WebRtcAec_ScaleErrorSignal = ScaleErrorSignal;
WebRtcAec_SubbandCoherence = SubbandCoherence; WebRtcAec_FilterAdaptation = FilterAdaptation;
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress;
WebRtcAec_ComfortNoise = ComfortNoise;
WebRtcAec_SubbandCoherence = SubbandCoherence;
#if defined(WEBRTC_ARCH_X86_FAMILY) #if defined(WEBRTC_ARCH_X86_FAMILY)
if (WebRtc_GetCPUInfo(kSSE2)) { if (WebRtc_GetCPUInfo(kSSE2)) {
WebRtcAec_InitAec_SSE2(); WebRtcAec_InitAec_SSE2();
} }
#endif #endif
#if defined(MIPS_FPU_LE) #if defined(MIPS_FPU_LE)
WebRtcAec_InitAec_mips(); WebRtcAec_InitAec_mips();
#endif #endif
#if defined(WEBRTC_ARCH_ARM_NEON) #if defined(WEBRTC_ARCH_ARM_NEON)
WebRtcAec_InitAec_neon();
#elif defined(WEBRTC_DETECT_ARM_NEON)
if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
WebRtcAec_InitAec_neon(); WebRtcAec_InitAec_neon();
} #elif defined(WEBRTC_DETECT_ARM_NEON)
if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) {
WebRtcAec_InitAec_neon();
}
#endif #endif
aec_rdft_init();
aec_rdft_init(); }
return aec; return aec;
} }