Skip to content
Snippets Groups Projects
Commit e75f2f1b authored by Leo Ma's avatar Leo Ma
Browse files

Enable AEC and AGC


Signed-off-by: default avatarLeo Ma <begeekmyfriend@gmail.com>
parent 6c445147
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -3,19 +3,22 @@ package net.ossrs.yasea;
import android.content.Context;
import android.media.AudioManager;
import android.media.AudioRecord;
import android.media.audiofx.AcousticEchoCanceler;
import android.media.audiofx.AutomaticGainControl;
import com.github.faucamp.simplertmp.RtmpHandler;
import com.seu.magicfilter.utils.MagicFilterType;
import java.io.File;
import java.io.IOException;
/**
* Created by Leo Ma on 2016/7/25.
*/
public class SrsPublisher {
private AudioRecord mic;
private static AudioRecord mic;
private static AcousticEchoCanceler aec;
private static AutomaticGainControl agc;
private boolean aloop = false;
private Thread aworker;
Loading
Loading
@@ -67,6 +70,20 @@ public class SrsPublisher {
return;
}
if (AcousticEchoCanceler.isAvailable()) {
aec = AcousticEchoCanceler.create(mic.getAudioSessionId());
if (aec != null) {
aec.setEnabled(true);
}
}
if (AutomaticGainControl.isAvailable()) {
agc = AutomaticGainControl.create(mic.getAudioSessionId());
if (agc != null) {
agc.setEnabled(true);
}
}
if (!mCameraView.startCamera()) {
mEncoder.stop();
return;
Loading
Loading
@@ -237,6 +254,18 @@ public class SrsPublisher {
mic.release();
mic = null;
}
if (aec != null) {
aec.setEnabled(false);
aec.release();
aec = null;
}
if (agc != null) {
agc.setEnabled(false);
agc.release();
agc = null;
}
}
public void switchMute() {
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment