Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable-18.1] webRtc v121.6167.0 followup #3668

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ import com.nextcloud.talk.viewmodels.CallRecordingViewModel.RecordingConfirmStop
import com.nextcloud.talk.viewmodels.CallRecordingViewModel.RecordingErrorState
import com.nextcloud.talk.viewmodels.CallRecordingViewModel.RecordingStartedState
import com.nextcloud.talk.viewmodels.CallRecordingViewModel.RecordingStartingState
import com.nextcloud.talk.webrtc.MagicWebRTCUtils
import com.nextcloud.talk.webrtc.WebRTCUtils
import com.nextcloud.talk.webrtc.PeerConnectionWrapper
import com.nextcloud.talk.webrtc.PeerConnectionWrapper.PeerConnectionObserver
import com.nextcloud.talk.webrtc.WebRtcAudioManager
Expand Down Expand Up @@ -727,7 +727,7 @@ class CallActivity : CallBaseActivity() {
cameraEnumerator = if (camera2EnumeratorIsSupported) {
Camera2Enumerator(this)
} else {
Camera1Enumerator(MagicWebRTCUtils.shouldEnableVideoHardwareAcceleration())
Camera1Enumerator(WebRTCUtils.shouldEnableVideoHardwareAcceleration())
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
package com.nextcloud.talk.application

import android.content.Context
import android.os.Build
import android.os.Build.VERSION.SDK_INT
import android.os.Build.VERSION_CODES.P
import android.util.Log
Expand Down Expand Up @@ -69,7 +68,6 @@ import com.nextcloud.talk.utils.NotificationUtils
import com.nextcloud.talk.utils.database.arbitrarystorage.ArbitraryStorageModule
import com.nextcloud.talk.utils.database.user.UserModule
import com.nextcloud.talk.utils.preferences.AppPreferences
import com.nextcloud.talk.webrtc.MagicWebRTCUtils
import com.vanniktech.emoji.EmojiManager
import com.vanniktech.emoji.google.GoogleEmojiProvider
import de.cotech.hw.SecurityKeyManager
Expand All @@ -79,8 +77,6 @@ import net.sqlcipher.database.SQLiteDatabaseHook
import okhttp3.OkHttpClient
import org.conscrypt.Conscrypt
import org.webrtc.PeerConnectionFactory
import org.webrtc.voiceengine.WebRtcAudioManager
import org.webrtc.voiceengine.WebRtcAudioUtils
import java.security.Security
import java.util.concurrent.TimeUnit
import javax.inject.Inject
Expand Down Expand Up @@ -132,14 +128,6 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
//region private methods
private fun initializeWebRtc() {
try {
if (MagicWebRTCUtils.HARDWARE_AEC_EXCLUDE_SET.contains(Build.MODEL)) {
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true)
}

if (!MagicWebRTCUtils.OPEN_SL_ES_INCLUDE_SET.contains(Build.MODEL)) {
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true)
}

PeerConnectionFactory.initialize(
PeerConnectionFactory.InitializationOptions.builder(this)
.createInitializationOptions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ private void onOfferOrAnswer(String type, String sdp) {
SessionDescription sessionDescriptionWithPreferredCodec;

boolean isAudio = false;
String sessionDescriptionStringWithPreferredCodec = MagicWebRTCUtils.preferCodec(sdp, "H264", isAudio);
String sessionDescriptionStringWithPreferredCodec = WebRTCUtils.preferCodec(sdp, "H264", isAudio);

sessionDescriptionWithPreferredCodec = new SessionDescription(
SessionDescription.Type.fromCanonicalForm(type),
Expand Down Expand Up @@ -574,7 +574,7 @@ public void onCreateSuccess(SessionDescription sessionDescription) {
ncMessagePayload.setType(type);

SessionDescription sessionDescriptionWithPreferredCodec;
String sessionDescriptionStringWithPreferredCodec = MagicWebRTCUtils.preferCodec
String sessionDescriptionStringWithPreferredCodec = WebRTCUtils.preferCodec
(sessionDescription.description,
"H264", false);
sessionDescriptionWithPreferredCodec = new SessionDescription(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,9 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class MagicWebRTCUtils {
public class WebRTCUtils {
private static final String TAG = "MagicWebRTCUtils";

/* AEC blacklist and SL_ES_WHITELIST are borrowed from Signal
https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java
*/
public static Set<String> HARDWARE_AEC_EXCLUDE_SET = new HashSet<String>() {{
add("D6503"); // Sony Xperia Z2 D6503
add("ONE A2005"); // OnePlus 2
add("MotoG3"); // Moto G (3rd Generation)
add("Nexus 6P"); // Nexus 6p
add("Pixel"); // Pixel
add("Pixel XL"); // Pixel XL
add("MI 4LTE"); // Xiami Mi4
add("Redmi Note 3"); // Redmi Note 3
add("Redmi Note 4"); // Redmi Note 4
add("SM-G900F"); // Samsung Galaxy S5
add("g3_kt_kr"); // LG G3
add("GT-I9195"); // Samsung Galaxy S4 Mini 4G LTE
add("SM-G930F"); // Samsung Galaxy S7
add("Xperia SP"); // Sony Xperia SP
add("Nexus 6"); // Nexus 6
add("ONE E1003"); // OnePlus X
add("One"); // OnePlus One
add("Moto G5");
add("Moto G (5S) Plus");
add("Moto G4");
add("TA-1053");
add("E5823"); // Sony Z5 Compact
}};

public static Set<String> OPEN_SL_ES_INCLUDE_SET = new HashSet<String>() {{
add("Pixel");
add("Pixel XL");
}};

private static final Set<String> HARDWARE_ACCELERATION_DEVICE_EXCLUDE_SET = new HashSet<String>() {{
add("GT-I9100"); // Samsung Galaxy S2
add("GT-N8013"); // Samsung Galaxy Note 10.1
Expand Down