Add aecdump support to AppRTCDemo
Review URL: https://codereview.webrtc.org/1514473008 Cr-Commit-Position: refs/heads/master@{#10985}
This commit is contained in:
@ -102,6 +102,11 @@
|
||||
<string name="pref_noaudioprocessing_dlg">Disable audio processing pipeline.</string>
|
||||
<string name="pref_noaudioprocessing_default">false</string>
|
||||
|
||||
<string name="pref_aecdump_key">aecdump_preference</string>
|
||||
<string name="pref_aecdump_title">Create aecdump.</string>
|
||||
<string name="pref_aecdump_dlg">Enable diagnostic audio recordings.</string>
|
||||
<string name="pref_aecdump_default">false</string>
|
||||
|
||||
<string name="pref_opensles_key">opensles_preference</string>
|
||||
<string name="pref_opensles_title">Use OpenSL ES for audio playback.</string>
|
||||
<string name="pref_opensles_dlg">Use OpenSL ES for audio playback.</string>
|
||||
|
||||
@ -101,6 +101,12 @@
|
||||
android:dialogTitle="@string/pref_noaudioprocessing_dlg"
|
||||
android:defaultValue="@string/pref_noaudioprocessing_default" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_aecdump_key"
|
||||
android:title="@string/pref_aecdump_title"
|
||||
android:dialogTitle="@string/pref_aecdump_dlg"
|
||||
android:defaultValue="@string/pref_aecdump_default" />
|
||||
|
||||
<CheckBoxPreference
|
||||
android:key="@string/pref_opensles_key"
|
||||
android:title="@string/pref_opensles_title"
|
||||
|
||||
@ -74,6 +74,8 @@ public class CallActivity extends Activity
|
||||
"org.appspot.apprtc.AUDIOCODEC";
|
||||
public static final String EXTRA_NOAUDIOPROCESSING_ENABLED =
|
||||
"org.appspot.apprtc.NOAUDIOPROCESSING";
|
||||
public static final String EXTRA_AECDUMP_ENABLED =
|
||||
"org.appspot.apprtc.AECDUMP";
|
||||
public static final String EXTRA_OPENSLES_ENABLED =
|
||||
"org.appspot.apprtc.OPENSLES";
|
||||
public static final String EXTRA_DISPLAY_HUD =
|
||||
@ -229,6 +231,7 @@ public class CallActivity extends Activity
|
||||
intent.getIntExtra(EXTRA_AUDIO_BITRATE, 0),
|
||||
intent.getStringExtra(EXTRA_AUDIOCODEC),
|
||||
intent.getBooleanExtra(EXTRA_NOAUDIOPROCESSING_ENABLED, false),
|
||||
intent.getBooleanExtra(EXTRA_AECDUMP_ENABLED, false),
|
||||
intent.getBooleanExtra(EXTRA_OPENSLES_ENABLED, false));
|
||||
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
|
||||
runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);
|
||||
|
||||
@ -67,6 +67,7 @@ public class ConnectActivity extends Activity {
|
||||
private String keyprefHwCodecAcceleration;
|
||||
private String keyprefCaptureToTexture;
|
||||
private String keyprefNoAudioProcessingPipeline;
|
||||
private String keyprefAecDump;
|
||||
private String keyprefOpenSLES;
|
||||
private String keyprefDisplayHud;
|
||||
private String keyprefTracing;
|
||||
@ -96,6 +97,7 @@ public class ConnectActivity extends Activity {
|
||||
keyprefAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
||||
keyprefAudioCodec = getString(R.string.pref_audiocodec_key);
|
||||
keyprefNoAudioProcessingPipeline = getString(R.string.pref_noaudioprocessing_key);
|
||||
keyprefAecDump = getString(R.string.pref_aecdump_key);
|
||||
keyprefOpenSLES = getString(R.string.pref_opensles_key);
|
||||
keyprefDisplayHud = getString(R.string.pref_displayhud_key);
|
||||
keyprefTracing = getString(R.string.pref_tracing_key);
|
||||
@ -266,6 +268,11 @@ public class ConnectActivity extends Activity {
|
||||
keyprefNoAudioProcessingPipeline,
|
||||
Boolean.valueOf(getString(R.string.pref_noaudioprocessing_default)));
|
||||
|
||||
// Check Disable Audio Processing flag.
|
||||
boolean aecDump = sharedPref.getBoolean(
|
||||
keyprefAecDump,
|
||||
Boolean.valueOf(getString(R.string.pref_aecdump_default)));
|
||||
|
||||
// Check OpenSL ES enabled flag.
|
||||
boolean useOpenSLES = sharedPref.getBoolean(
|
||||
keyprefOpenSLES,
|
||||
@ -353,6 +360,7 @@ public class ConnectActivity extends Activity {
|
||||
intent.putExtra(CallActivity.EXTRA_CAPTURETOTEXTURE_ENABLED, captureToTexture);
|
||||
intent.putExtra(CallActivity.EXTRA_NOAUDIOPROCESSING_ENABLED,
|
||||
noAudioProcessing);
|
||||
intent.putExtra(CallActivity.EXTRA_AECDUMP_ENABLED, aecDump);
|
||||
intent.putExtra(CallActivity.EXTRA_OPENSLES_ENABLED, useOpenSLES);
|
||||
intent.putExtra(CallActivity.EXTRA_AUDIO_BITRATE, audioStartBitrate);
|
||||
intent.putExtra(CallActivity.EXTRA_AUDIOCODEC, audioCodec);
|
||||
|
||||
@ -11,6 +11,7 @@
|
||||
package org.appspot.apprtc;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.util.Log;
|
||||
|
||||
import org.appspot.apprtc.AppRTCClient.SignalingParameters;
|
||||
@ -37,6 +38,8 @@ import org.webrtc.VideoSource;
|
||||
import org.webrtc.VideoTrack;
|
||||
import org.webrtc.voiceengine.WebRtcAudioManager;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Timer;
|
||||
@ -105,6 +108,7 @@ public class PeerConnectionClient {
|
||||
private MediaConstraints pcConstraints;
|
||||
private MediaConstraints videoConstraints;
|
||||
private MediaConstraints audioConstraints;
|
||||
private ParcelFileDescriptor aecDumpFileDescriptor;
|
||||
private MediaConstraints sdpMediaConstraints;
|
||||
private PeerConnectionParameters peerConnectionParameters;
|
||||
// Queued remote ICE candidates are consumed only after both local and
|
||||
@ -139,6 +143,7 @@ public class PeerConnectionClient {
|
||||
public final int audioStartBitrate;
|
||||
public final String audioCodec;
|
||||
public final boolean noAudioProcessing;
|
||||
public final boolean aecDump;
|
||||
public final boolean useOpenSLES;
|
||||
|
||||
public PeerConnectionParameters(
|
||||
@ -146,7 +151,7 @@ public class PeerConnectionClient {
|
||||
int videoWidth, int videoHeight, int videoFps, int videoStartBitrate,
|
||||
String videoCodec, boolean videoCodecHwAcceleration, boolean captureToTexture,
|
||||
int audioStartBitrate, String audioCodec,
|
||||
boolean noAudioProcessing, boolean useOpenSLES) {
|
||||
boolean noAudioProcessing, boolean aecDump, boolean useOpenSLES) {
|
||||
this.videoCallEnabled = videoCallEnabled;
|
||||
this.loopback = loopback;
|
||||
this.tracing = tracing;
|
||||
@ -160,6 +165,7 @@ public class PeerConnectionClient {
|
||||
this.audioStartBitrate = audioStartBitrate;
|
||||
this.audioCodec = audioCodec;
|
||||
this.noAudioProcessing = noAudioProcessing;
|
||||
this.aecDump = aecDump;
|
||||
this.useOpenSLES = useOpenSLES;
|
||||
}
|
||||
}
|
||||
@ -485,10 +491,26 @@ public class PeerConnectionClient {
|
||||
factory.createAudioSource(audioConstraints)));
|
||||
peerConnection.addStream(mediaStream);
|
||||
|
||||
if (peerConnectionParameters.aecDump) {
|
||||
try {
|
||||
aecDumpFileDescriptor = ParcelFileDescriptor.open(
|
||||
new File("/sdcard/Download/audio.aecdump"),
|
||||
ParcelFileDescriptor.MODE_READ_WRITE |
|
||||
ParcelFileDescriptor.MODE_CREATE |
|
||||
ParcelFileDescriptor.MODE_TRUNCATE);
|
||||
factory.startAecDump(aecDumpFileDescriptor.getFd());
|
||||
} catch(IOException e) {
|
||||
Log.e(TAG, "Can not open aecdump file", e);
|
||||
}
|
||||
}
|
||||
|
||||
Log.d(TAG, "Peer connection created.");
|
||||
}
|
||||
|
||||
private void closeInternal() {
|
||||
if (factory != null && peerConnectionParameters.aecDump) {
|
||||
factory.stopAecDump();
|
||||
}
|
||||
Log.d(TAG, "Closing peer connection.");
|
||||
statsTimer.cancel();
|
||||
if (peerConnection != null) {
|
||||
|
||||
@ -36,6 +36,7 @@ public class SettingsActivity extends Activity
|
||||
private String keyprefStartAudioBitrateValue;
|
||||
private String keyPrefAudioCodec;
|
||||
private String keyprefNoAudioProcessing;
|
||||
private String keyprefAecDump;
|
||||
private String keyprefOpenSLES;
|
||||
|
||||
private String keyPrefRoomServerUrl;
|
||||
@ -59,6 +60,7 @@ public class SettingsActivity extends Activity
|
||||
keyprefStartAudioBitrateValue = getString(R.string.pref_startaudiobitratevalue_key);
|
||||
keyPrefAudioCodec = getString(R.string.pref_audiocodec_key);
|
||||
keyprefNoAudioProcessing = getString(R.string.pref_noaudioprocessing_key);
|
||||
keyprefAecDump = getString(R.string.pref_aecdump_key);
|
||||
keyprefOpenSLES = getString(R.string.pref_opensles_key);
|
||||
|
||||
keyPrefRoomServerUrl = getString(R.string.pref_room_server_url_key);
|
||||
@ -95,6 +97,7 @@ public class SettingsActivity extends Activity
|
||||
setAudioBitrateEnable(sharedPreferences);
|
||||
updateSummary(sharedPreferences, keyPrefAudioCodec);
|
||||
updateSummaryB(sharedPreferences, keyprefNoAudioProcessing);
|
||||
updateSummaryB(sharedPreferences, keyprefAecDump);
|
||||
updateSummaryB(sharedPreferences, keyprefOpenSLES);
|
||||
|
||||
updateSummary(sharedPreferences, keyPrefRoomServerUrl);
|
||||
@ -130,6 +133,7 @@ public class SettingsActivity extends Activity
|
||||
|| key.equals(keyprefHwCodec)
|
||||
|| key.equals(keyprefCaptureToTexture)
|
||||
|| key.equals(keyprefNoAudioProcessing)
|
||||
|| key.equals(keyprefAecDump)
|
||||
|| key.equals(keyprefOpenSLES)
|
||||
|| key.equals(keyPrefDisplayHud)) {
|
||||
updateSummaryB(sharedPreferences, key);
|
||||
|
||||
@ -251,7 +251,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
|
||||
new PeerConnectionParameters(
|
||||
false, true, false, // videoCallEnabled, loopback, tracing.
|
||||
0, 0, 0, 0, "", true, false, // video codec parameters.
|
||||
0, "OPUS", false, false); // audio codec parameters.
|
||||
0, "OPUS", false, false, false); // audio codec parameters.
|
||||
return peerConnectionParameters;
|
||||
}
|
||||
|
||||
@ -261,7 +261,7 @@ public class PeerConnectionClientTest extends InstrumentationTestCase
|
||||
new PeerConnectionParameters(
|
||||
true, true, false, // videoCallEnabled, loopback, tracing.
|
||||
0, 0, 0, 0, videoCodec, true, captureToTexture, // video codec parameters.
|
||||
0, "OPUS", false, false); // audio codec parameters.
|
||||
0, "OPUS", false, false, false); // audio codec parameters.
|
||||
return peerConnectionParameters;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user