Skip to content

Commit

Permalink
对AutomaticGainControl和AcousticEchoCanceler实例添加判空保护
Browse files Browse the repository at this point in the history
Change-Id: Ifdbc224355cd8c91d1e563f5f41787818368537c
  • Loading branch information
SundoggyNew committed Jan 30, 2024
1 parent 2f4abe6 commit 4e7d44e
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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) {
Expand Down

0 comments on commit 4e7d44e

Please sign in to comment.