Remove Legacy ADM from AppRTC mobile

The Legacy ADM has remained to be available for testing. Now we are
ready to move on to using only the Java ADM.

Bug: webrtc:7452
Change-Id: Ic95b04b933e165f3c16b587a44384a2c965ef16c
Reviewed-on: https://webrtc-review.googlesource.com/c/123921
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Commit-Queue: Paulina Hensman <phensman@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26852}
This commit is contained in:
Paulina Hensman
2019-02-22 16:31:28 +01:00
committed by Commit Bot
parent 0bf4c29852
commit 22dab11270
9 changed files with 7 additions and 127 deletions

View File

@ -135,7 +135,6 @@ if (is_android) {
deps = [ deps = [
":AppRTCMobile_resources", ":AppRTCMobile_resources",
"../modules/audio_device:audio_device_java",
"../rtc_base:base_java", "../rtc_base:base_java",
"../sdk/android:audio_api_java", "../sdk/android:audio_api_java",
"../sdk/android:base_java", "../sdk/android:base_java",
@ -911,7 +910,6 @@ if (is_android) {
requires_android = true requires_android = true
deps = [ deps = [
":webrtc_unity_java", ":webrtc_unity_java",
"../modules/audio_device:audio_device_java",
"../rtc_base:base_java", "../rtc_base:base_java",
"../sdk/android:libjingle_peerconnection_java", "../sdk/android:libjingle_peerconnection_java",
"../sdk/android:libjingle_peerconnection_metrics_default_java", "../sdk/android:libjingle_peerconnection_metrics_default_java",

View File

@ -218,8 +218,4 @@
<string name="pref_enable_rtceventlog_key">enable_rtceventlog_key</string> <string name="pref_enable_rtceventlog_key">enable_rtceventlog_key</string>
<string name="pref_enable_rtceventlog_title">Enable RtcEventLog.</string> <string name="pref_enable_rtceventlog_title">Enable RtcEventLog.</string>
<string name="pref_enable_rtceventlog_default">false</string> <string name="pref_enable_rtceventlog_default">false</string>
<string name="pref_use_legacy_audio_device_key">use_legacy_audio_device_key</string>
<string name="pref_use_legacy_audio_device_title">Use legacy audio device.</string>
<string name="pref_use_legacy_audio_device_default">false</string>
</resources> </resources>

View File

@ -165,11 +165,6 @@
android:dialogTitle="@string/pref_speakerphone_dlg" android:dialogTitle="@string/pref_speakerphone_dlg"
android:entries="@array/speakerphone" android:entries="@array/speakerphone"
android:entryValues="@array/speakerphoneValues" /> android:entryValues="@array/speakerphoneValues" />
<CheckBoxPreference
android:key="@string/pref_use_legacy_audio_device_key"
android:title="@string/pref_use_legacy_audio_device_title"
android:defaultValue="@string/pref_use_legacy_audio_device_default" />
</PreferenceCategory> </PreferenceCategory>
<PreferenceCategory <PreferenceCategory

View File

@ -120,8 +120,6 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
public static final String EXTRA_NEGOTIATED = "org.appspot.apprtc.NEGOTIATED"; public static final String EXTRA_NEGOTIATED = "org.appspot.apprtc.NEGOTIATED";
public static final String EXTRA_ID = "org.appspot.apprtc.ID"; public static final String EXTRA_ID = "org.appspot.apprtc.ID";
public static final String EXTRA_ENABLE_RTCEVENTLOG = "org.appspot.apprtc.ENABLE_RTCEVENTLOG"; public static final String EXTRA_ENABLE_RTCEVENTLOG = "org.appspot.apprtc.ENABLE_RTCEVENTLOG";
public static final String EXTRA_USE_LEGACY_AUDIO_DEVICE =
"org.appspot.apprtc.USE_LEGACY_AUDIO_DEVICE";
private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1; private static final int CAPTURE_PERMISSION_REQUEST_CODE = 1;
@ -326,8 +324,7 @@ public class CallActivity extends Activity implements AppRTCClient.SignalingEven
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false), intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_AGC, false),
intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false), intent.getBooleanExtra(EXTRA_DISABLE_BUILT_IN_NS, false),
intent.getBooleanExtra(EXTRA_DISABLE_WEBRTC_AGC_AND_HPF, false), intent.getBooleanExtra(EXTRA_DISABLE_WEBRTC_AGC_AND_HPF, false),
intent.getBooleanExtra(EXTRA_ENABLE_RTCEVENTLOG, false), intent.getBooleanExtra(EXTRA_ENABLE_RTCEVENTLOG, false), dataChannelParameters);
intent.getBooleanExtra(EXTRA_USE_LEGACY_AUDIO_DEVICE, false), dataChannelParameters);
commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false); commandLineRun = intent.getBooleanExtra(EXTRA_CMDLINE, false);
int runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0); int runTimeMs = intent.getIntExtra(EXTRA_RUNTIME, 0);

View File

@ -434,10 +434,6 @@ public class ConnectActivity extends Activity {
CallActivity.EXTRA_ENABLE_RTCEVENTLOG, R.string.pref_enable_rtceventlog_default, CallActivity.EXTRA_ENABLE_RTCEVENTLOG, R.string.pref_enable_rtceventlog_default,
useValuesFromIntent); useValuesFromIntent);
boolean useLegacyAudioDevice = sharedPrefGetBoolean(R.string.pref_use_legacy_audio_device_key,
CallActivity.EXTRA_USE_LEGACY_AUDIO_DEVICE, R.string.pref_use_legacy_audio_device_default,
useValuesFromIntent);
// Get datachannel options // Get datachannel options
boolean dataChannelEnabled = sharedPrefGetBoolean(R.string.pref_enable_datachannel_key, boolean dataChannelEnabled = sharedPrefGetBoolean(R.string.pref_enable_datachannel_key,
CallActivity.EXTRA_DATA_CHANNEL_ENABLED, R.string.pref_enable_datachannel_default, CallActivity.EXTRA_DATA_CHANNEL_ENABLED, R.string.pref_enable_datachannel_default,
@ -492,8 +488,6 @@ public class ConnectActivity extends Activity {
intent.putExtra(CallActivity.EXTRA_ENABLE_RTCEVENTLOG, rtcEventLogEnabled); intent.putExtra(CallActivity.EXTRA_ENABLE_RTCEVENTLOG, rtcEventLogEnabled);
intent.putExtra(CallActivity.EXTRA_CMDLINE, commandLineRun); intent.putExtra(CallActivity.EXTRA_CMDLINE, commandLineRun);
intent.putExtra(CallActivity.EXTRA_RUNTIME, runTimeMs); intent.putExtra(CallActivity.EXTRA_RUNTIME, runTimeMs);
intent.putExtra(CallActivity.EXTRA_USE_LEGACY_AUDIO_DEVICE, useLegacyAudioDevice);
intent.putExtra(CallActivity.EXTRA_DATA_CHANNEL_ENABLED, dataChannelEnabled); intent.putExtra(CallActivity.EXTRA_DATA_CHANNEL_ENABLED, dataChannelEnabled);
if (dataChannelEnabled) { if (dataChannelEnabled) {

View File

@ -75,14 +75,6 @@ import org.webrtc.audio.AudioDeviceModule;
import org.webrtc.audio.JavaAudioDeviceModule; import org.webrtc.audio.JavaAudioDeviceModule;
import org.webrtc.audio.JavaAudioDeviceModule.AudioRecordErrorCallback; import org.webrtc.audio.JavaAudioDeviceModule.AudioRecordErrorCallback;
import org.webrtc.audio.JavaAudioDeviceModule.AudioTrackErrorCallback; import org.webrtc.audio.JavaAudioDeviceModule.AudioTrackErrorCallback;
import org.webrtc.audio.LegacyAudioDeviceModule;
import org.webrtc.voiceengine.WebRtcAudioManager;
import org.webrtc.voiceengine.WebRtcAudioRecord;
import org.webrtc.voiceengine.WebRtcAudioRecord.AudioRecordStartErrorCode;
import org.webrtc.voiceengine.WebRtcAudioRecord.WebRtcAudioRecordErrorCallback;
import org.webrtc.voiceengine.WebRtcAudioTrack;
import org.webrtc.voiceengine.WebRtcAudioTrack.AudioTrackStartErrorCode;
import org.webrtc.voiceengine.WebRtcAudioUtils;
/** /**
* Peer connection client implementation. * Peer connection client implementation.
@ -232,7 +224,6 @@ public class PeerConnectionClient {
public final boolean disableBuiltInNS; public final boolean disableBuiltInNS;
public final boolean disableWebRtcAGCAndHPF; public final boolean disableWebRtcAGCAndHPF;
public final boolean enableRtcEventLog; public final boolean enableRtcEventLog;
public final boolean useLegacyAudioDevice;
private final DataChannelParameters dataChannelParameters; private final DataChannelParameters dataChannelParameters;
public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback, boolean tracing, public PeerConnectionParameters(boolean videoCallEnabled, boolean loopback, boolean tracing,
@ -241,7 +232,7 @@ public class PeerConnectionClient {
String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean saveInputAudioToFile, String audioCodec, boolean noAudioProcessing, boolean aecDump, boolean saveInputAudioToFile,
boolean useOpenSLES, boolean disableBuiltInAEC, boolean disableBuiltInAGC, boolean useOpenSLES, boolean disableBuiltInAEC, boolean disableBuiltInAGC,
boolean disableBuiltInNS, boolean disableWebRtcAGCAndHPF, boolean enableRtcEventLog, boolean disableBuiltInNS, boolean disableWebRtcAGCAndHPF, boolean enableRtcEventLog,
boolean useLegacyAudioDevice, DataChannelParameters dataChannelParameters) { DataChannelParameters dataChannelParameters) {
this.videoCallEnabled = videoCallEnabled; this.videoCallEnabled = videoCallEnabled;
this.loopback = loopback; this.loopback = loopback;
this.tracing = tracing; this.tracing = tracing;
@ -263,7 +254,6 @@ public class PeerConnectionClient {
this.disableBuiltInNS = disableBuiltInNS; this.disableBuiltInNS = disableBuiltInNS;
this.disableWebRtcAGCAndHPF = disableWebRtcAGCAndHPF; this.disableWebRtcAGCAndHPF = disableWebRtcAGCAndHPF;
this.enableRtcEventLog = enableRtcEventLog; this.enableRtcEventLog = enableRtcEventLog;
this.useLegacyAudioDevice = useLegacyAudioDevice;
this.dataChannelParameters = dataChannelParameters; this.dataChannelParameters = dataChannelParameters;
} }
} }
@ -430,9 +420,7 @@ public class PeerConnectionClient {
} }
} }
final AudioDeviceModule adm = peerConnectionParameters.useLegacyAudioDevice final AudioDeviceModule adm = createJavaAudioDevice();
? createLegacyAudioDevice()
: createJavaAudioDevice();
// Create peer connection factory. // Create peer connection factory.
if (options != null) { if (options != null) {
@ -462,80 +450,6 @@ public class PeerConnectionClient {
adm.release(); adm.release();
} }
AudioDeviceModule createLegacyAudioDevice() {
// Enable/disable OpenSL ES playback.
if (!peerConnectionParameters.useOpenSLES) {
Log.d(TAG, "Disable OpenSL ES audio even if device supports it");
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true /* enable */);
} else {
Log.d(TAG, "Allow OpenSL ES audio if device supports it");
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false);
}
if (peerConnectionParameters.disableBuiltInAEC) {
Log.d(TAG, "Disable built-in AEC even if device supports it");
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
} else {
Log.d(TAG, "Enable built-in AEC if device supports it");
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(false);
}
if (peerConnectionParameters.disableBuiltInNS) {
Log.d(TAG, "Disable built-in NS even if device supports it");
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(true);
} else {
Log.d(TAG, "Enable built-in NS if device supports it");
WebRtcAudioUtils.setWebRtcBasedNoiseSuppressor(false);
}
WebRtcAudioRecord.setOnAudioSamplesReady(saveRecordedAudioToFile);
// Set audio record error callbacks.
WebRtcAudioRecord.setErrorCallback(new WebRtcAudioRecordErrorCallback() {
@Override
public void onWebRtcAudioRecordInitError(String errorMessage) {
Log.e(TAG, "onWebRtcAudioRecordInitError: " + errorMessage);
reportError(errorMessage);
}
@Override
public void onWebRtcAudioRecordStartError(
AudioRecordStartErrorCode errorCode, String errorMessage) {
Log.e(TAG, "onWebRtcAudioRecordStartError: " + errorCode + ". " + errorMessage);
reportError(errorMessage);
}
@Override
public void onWebRtcAudioRecordError(String errorMessage) {
Log.e(TAG, "onWebRtcAudioRecordError: " + errorMessage);
reportError(errorMessage);
}
});
WebRtcAudioTrack.setErrorCallback(new WebRtcAudioTrack.ErrorCallback() {
@Override
public void onWebRtcAudioTrackInitError(String errorMessage) {
Log.e(TAG, "onWebRtcAudioTrackInitError: " + errorMessage);
reportError(errorMessage);
}
@Override
public void onWebRtcAudioTrackStartError(
AudioTrackStartErrorCode errorCode, String errorMessage) {
Log.e(TAG, "onWebRtcAudioTrackStartError: " + errorCode + ". " + errorMessage);
reportError(errorMessage);
}
@Override
public void onWebRtcAudioTrackError(String errorMessage) {
Log.e(TAG, "onWebRtcAudioTrackError: " + errorMessage);
reportError(errorMessage);
}
});
return new LegacyAudioDeviceModule();
}
AudioDeviceModule createJavaAudioDevice() { AudioDeviceModule createJavaAudioDevice() {
// Enable/disable OpenSL ES playback. // Enable/disable OpenSL ES playback.
if (!peerConnectionParameters.useOpenSLES) { if (!peerConnectionParameters.useOpenSLES) {

View File

@ -22,15 +22,12 @@ import java.io.OutputStream;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import org.webrtc.audio.JavaAudioDeviceModule; import org.webrtc.audio.JavaAudioDeviceModule;
import org.webrtc.audio.JavaAudioDeviceModule.SamplesReadyCallback; import org.webrtc.audio.JavaAudioDeviceModule.SamplesReadyCallback;
import org.webrtc.voiceengine.WebRtcAudioRecord;
import org.webrtc.voiceengine.WebRtcAudioRecord.WebRtcAudioRecordSamplesReadyCallback;
/** /**
* Implements the AudioRecordSamplesReadyCallback interface and writes * Implements the AudioRecordSamplesReadyCallback interface and writes
* recorded raw audio samples to an output file. * recorded raw audio samples to an output file.
*/ */
public class RecordedAudioToFileController public class RecordedAudioToFileController implements SamplesReadyCallback {
implements SamplesReadyCallback, WebRtcAudioRecordSamplesReadyCallback {
private static final String TAG = "RecordedAudioToFile"; private static final String TAG = "RecordedAudioToFile";
private static final long MAX_FILE_SIZE_IN_BYTES = 58348800L; private static final long MAX_FILE_SIZE_IN_BYTES = 58348800L;
@ -106,13 +103,6 @@ public class RecordedAudioToFileController
Log.d(TAG, "Opened file for recording: " + fileName); Log.d(TAG, "Opened file for recording: " + fileName);
} }
// Called when new audio samples are ready.
@Override
public void onWebRtcAudioRecordSamplesReady(WebRtcAudioRecord.AudioSamples samples) {
onWebRtcAudioRecordSamplesReady(new JavaAudioDeviceModule.AudioSamples(samples.getAudioFormat(),
samples.getChannelCount(), samples.getSampleRate(), samples.getData()));
}
// Called when new audio samples are ready. // Called when new audio samples are ready.
@Override @Override
public void onWebRtcAudioRecordSamplesReady(JavaAudioDeviceModule.AudioSamples samples) { public void onWebRtcAudioRecordSamplesReady(JavaAudioDeviceModule.AudioSamples samples) {

View File

@ -62,7 +62,6 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
private String keyprefDataProtocol; private String keyprefDataProtocol;
private String keyprefNegotiated; private String keyprefNegotiated;
private String keyprefDataId; private String keyprefDataId;
private String keyprefUseLegacyAudioDevice;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
@ -106,7 +105,6 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
keyPrefDisplayHud = getString(R.string.pref_displayhud_key); keyPrefDisplayHud = getString(R.string.pref_displayhud_key);
keyPrefTracing = getString(R.string.pref_tracing_key); keyPrefTracing = getString(R.string.pref_tracing_key);
keyprefEnabledRtcEventLog = getString(R.string.pref_enable_rtceventlog_key); keyprefEnabledRtcEventLog = getString(R.string.pref_enable_rtceventlog_key);
keyprefUseLegacyAudioDevice = getString(R.string.pref_use_legacy_audio_device_key);
// Display the fragment as the main content. // Display the fragment as the main content.
settingsFragment = new SettingsFragment(); settingsFragment = new SettingsFragment();
@ -164,7 +162,6 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
updateSummaryB(sharedPreferences, keyPrefDisplayHud); updateSummaryB(sharedPreferences, keyPrefDisplayHud);
updateSummaryB(sharedPreferences, keyPrefTracing); updateSummaryB(sharedPreferences, keyPrefTracing);
updateSummaryB(sharedPreferences, keyprefEnabledRtcEventLog); updateSummaryB(sharedPreferences, keyprefEnabledRtcEventLog);
updateSummaryB(sharedPreferences, keyprefUseLegacyAudioDevice);
if (!Camera2Enumerator.isSupported(this)) { if (!Camera2Enumerator.isSupported(this)) {
Preference camera2Preference = settingsFragment.findPreference(keyprefCamera2); Preference camera2Preference = settingsFragment.findPreference(keyprefCamera2);
@ -242,8 +239,7 @@ public class SettingsActivity extends Activity implements OnSharedPreferenceChan
|| key.equals(keyprefEnableDataChannel) || key.equals(keyprefEnableDataChannel)
|| key.equals(keyprefOrdered) || key.equals(keyprefOrdered)
|| key.equals(keyprefNegotiated) || key.equals(keyprefNegotiated)
|| key.equals(keyprefEnabledRtcEventLog) || key.equals(keyprefEnabledRtcEventLog)) {
|| key.equals(keyprefUseLegacyAudioDevice)) {
updateSummaryB(sharedPreferences, key); updateSummaryB(sharedPreferences, key);
} else if (key.equals(keyprefSpeakerphone)) { } else if (key.equals(keyprefSpeakerphone)) {
updateSummaryList(sharedPreferences, key); updateSummaryList(sharedPreferences, key);

View File

@ -309,7 +309,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
false, /* saveInputAudioToFile */ false, /* saveInputAudioToFile */
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */, false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
false /* disableBuiltInNS */, false /* disableWebRtcAGC */, false /* enableRtcEventLog */, false /* disableBuiltInNS */, false /* disableWebRtcAGC */, false /* enableRtcEventLog */,
false /* useLegacyAudioDevice */, null /* dataChannelParameters */); null /* dataChannelParameters */);
} }
private VideoCapturer createCameraCapturer(boolean captureToTexture) { private VideoCapturer createCameraCapturer(boolean captureToTexture) {
@ -346,7 +346,7 @@ public class PeerConnectionClientTest implements PeerConnectionEvents {
false, /* saveInputAudioToFile */ false, /* saveInputAudioToFile */
false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */, false /* useOpenSLES */, false /* disableBuiltInAEC */, false /* disableBuiltInAGC */,
false /* disableBuiltInNS */, false /* disableWebRtcAGC */, false /* enableRtcEventLog */, false /* disableBuiltInNS */, false /* disableWebRtcAGC */, false /* enableRtcEventLog */,
false /* useLegacyAudioDevice */, null /* dataChannelParameters */); null /* dataChannelParameters */);
} }
@Before @Before