From 918c2d2884fd75a3d1359141f7cb57f4711d5951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?whalensun=28=E5=AD=99=E4=BC=9F=29?= <532125505@qq.com> Date: Tue, 30 Jan 2024 10:08:08 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9AutomaticGainControl=E5=92=8CAcousticE?= =?UTF-8?q?choCanceler=E5=AE=9E=E4=BE=8B=E6=B7=BB=E5=8A=A0=E5=88=A4?= =?UTF-8?q?=E7=A9=BA=E4=BF=9D=E6=8A=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ifdbc224355cd8c91d1e563f5f41787818368537c --- .../video/link/util/audio/AudioRecordUtil.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sdk/video-link-android/src/main/java/com/tencent/iot/video/link/util/audio/AudioRecordUtil.java b/sdk/video-link-android/src/main/java/com/tencent/iot/video/link/util/audio/AudioRecordUtil.java index 5dce097ac..45baf260e 100644 --- a/sdk/video-link-android/src/main/java/com/tencent/iot/video/link/util/audio/AudioRecordUtil.java +++ b/sdk/video-link-android/src/main/java/com/tencent/iot/video/link/util/audio/AudioRecordUtil.java @@ -487,8 +487,12 @@ private boolean initAEC(int audioSession) { return false; } canceler = AcousticEchoCanceler.create(audioSession); - canceler.setEnabled(true); - return canceler.getEnabled(); + if (canceler != null) { + canceler.setEnabled(true); + return canceler.getEnabled(); + } else { + return false; + } } public boolean isDevicesSupportAGC() { return AutomaticGainControl.isAvailable(); @@ -503,8 +507,12 @@ private boolean initAGC(int audioSession) { return false; } control = AutomaticGainControl.create(audioSession); - control.setEnabled(true); - return control.getEnabled(); + if (control != null) { + control.setEnabled(true); + return control.getEnabled(); + } else { + return false; + } } private byte[] onReadPlayerPlayPcm(int length) {