mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 12:09:45 +01:00
Disable hardware acceleration on Samsung
Signed-off-by: Mario Danic <mario@lovelyhq.com>
This commit is contained in:
parent
413e962ef4
commit
22cc8fc4cb
@ -12,8 +12,8 @@ android {
|
|||||||
targetSdkVersion 27
|
targetSdkVersion 27
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
|
|
||||||
versionCode 12
|
versionCode 13
|
||||||
versionName "1.0.3"
|
versionName "1.0.4"
|
||||||
|
|
||||||
// Enabling multidex support.
|
// Enabling multidex support.
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
@ -32,6 +32,7 @@ import android.content.Context;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
@ -75,6 +76,7 @@ import com.nextcloud.talk.utils.database.user.UserUtils;
|
|||||||
import com.nextcloud.talk.webrtc.MagicAudioManager;
|
import com.nextcloud.talk.webrtc.MagicAudioManager;
|
||||||
import com.nextcloud.talk.webrtc.MagicPeerConnectionWrapper;
|
import com.nextcloud.talk.webrtc.MagicPeerConnectionWrapper;
|
||||||
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
import com.nextcloud.talk.webrtc.MagicWebRTCUtils;
|
||||||
|
import com.nextcloud.talk.webrtc.MagicWebRtcLists;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.greenrobot.eventbus.EventBus;
|
import org.greenrobot.eventbus.EventBus;
|
||||||
@ -438,7 +440,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
if (camera2EnumeratorIsSupported) {
|
if (camera2EnumeratorIsSupported) {
|
||||||
cameraEnumerator = new Camera2Enumerator(this);
|
cameraEnumerator = new Camera2Enumerator(this);
|
||||||
} else {
|
} else {
|
||||||
cameraEnumerator = new Camera1Enumerator(true);
|
cameraEnumerator = new Camera1Enumerator(!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build
|
||||||
|
.MANUFACTURER.toLowerCase()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -559,8 +562,10 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
|
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
|
||||||
peerConnectionFactory = new PeerConnectionFactory(options);
|
peerConnectionFactory = new PeerConnectionFactory(options);
|
||||||
|
|
||||||
|
if (!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build.MANUFACTURER.toLowerCase())) {
|
||||||
peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(),
|
peerConnectionFactory.setVideoHwAccelerationOptions(rootEglBase.getEglBaseContext(),
|
||||||
rootEglBase.getEglBaseContext());
|
rootEglBase.getEglBaseContext());
|
||||||
|
}
|
||||||
|
|
||||||
//Create MediaConstraints - Will be useful for specifying video and audio constraints.
|
//Create MediaConstraints - Will be useful for specifying video and audio constraints.
|
||||||
audioConstraints = new MediaConstraints();
|
audioConstraints = new MediaConstraints();
|
||||||
@ -1000,7 +1005,6 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (peerConnectionFactory != null) {
|
if (peerConnectionFactory != null) {
|
||||||
peerConnectionFactory.dispose();
|
|
||||||
peerConnectionFactory = null;
|
peerConnectionFactory = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1115,6 +1119,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
Log.d(TAG, "Failed to create a new video view");
|
Log.d(TAG, "Failed to create a new video view");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callControls.setZ(100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -1212,6 +1218,8 @@ public class CallActivity extends AppCompatActivity {
|
|||||||
remoteRenderersLayout.invalidate();
|
remoteRenderersLayout.invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
callControls.setZ(100.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
|
@ -40,6 +40,7 @@ import com.nextcloud.talk.jobs.AccountRemovalJob;
|
|||||||
import com.nextcloud.talk.jobs.PushRegistrationJob;
|
import com.nextcloud.talk.jobs.PushRegistrationJob;
|
||||||
import com.nextcloud.talk.jobs.creator.MagicJobCreator;
|
import com.nextcloud.talk.jobs.creator.MagicJobCreator;
|
||||||
import com.nextcloud.talk.utils.database.user.UserModule;
|
import com.nextcloud.talk.utils.database.user.UserModule;
|
||||||
|
import com.nextcloud.talk.webrtc.MagicWebRtcLists;
|
||||||
import com.squareup.leakcanary.LeakCanary;
|
import com.squareup.leakcanary.LeakCanary;
|
||||||
import com.squareup.leakcanary.RefWatcher;
|
import com.squareup.leakcanary.RefWatcher;
|
||||||
|
|
||||||
@ -51,8 +52,6 @@ import java.lang.reflect.Constructor;
|
|||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.security.GeneralSecurityException;
|
import java.security.GeneralSecurityException;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
@ -109,52 +108,24 @@ public class NextcloudTalkApplication extends MultiDexApplication {
|
|||||||
addDelegate.invoke(drawableManager, "vector", vdcInflateDelegate);
|
addDelegate.invoke(drawableManager, "vector", vdcInflateDelegate);
|
||||||
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException |
|
} catch (ClassNotFoundException | NoSuchMethodException | InstantiationException |
|
||||||
InvocationTargetException | IllegalAccessException e) {
|
InvocationTargetException | IllegalAccessException e) {
|
||||||
Log.d(TAG, "Failed to use reflection to enable proper vector scaling");
|
Log.e(TAG, "Failed to use reflection to enable proper vector scaling");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
AEC blacklist and SL_ES_WHITELIST are borrowed from Signal
|
|
||||||
https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java
|
|
||||||
*/
|
|
||||||
private void initializeWebRtc() {
|
private void initializeWebRtc() {
|
||||||
try {
|
try {
|
||||||
Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
|
if (MagicWebRtcLists.HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
||||||
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("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");
|
|
||||||
}};
|
|
||||||
|
|
||||||
Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
|
|
||||||
add("Pixel");
|
|
||||||
add("Pixel XL");
|
|
||||||
}};
|
|
||||||
|
|
||||||
if (HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
|
||||||
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
if (!MagicWebRtcLists.OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
||||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(this)
|
PeerConnectionFactory.initialize(PeerConnectionFactory.InitializationOptions.builder(this)
|
||||||
.setEnableVideoHwAcceleration(true)
|
.setEnableVideoHwAcceleration(!MagicWebRtcLists.HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build
|
||||||
|
.MANUFACTURER.toLowerCase()))
|
||||||
.createInitializationOptions());
|
.createInitializationOptions());
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
Log.w(TAG, e);
|
Log.w(TAG, e);
|
||||||
|
@ -0,0 +1,62 @@
|
|||||||
|
/*
|
||||||
|
* Nextcloud Talk application
|
||||||
|
*
|
||||||
|
* @author Mario Danic
|
||||||
|
* Copyright (C) 2017 Mario Danic <mario@lovelyhq.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.nextcloud.talk.webrtc;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class MagicWebRtcLists {
|
||||||
|
/*
|
||||||
|
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_BLACKLIST = 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("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");
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
|
||||||
|
add("Pixel");
|
||||||
|
add("Pixel XL");
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static Set<String> HARDWARE_ACCELERATION_DEVICE_BLACKLIST = new HashSet<String>() {{
|
||||||
|
}};
|
||||||
|
|
||||||
|
public static Set<String> HARDWARE_ACCELERATION_VENDOR_BLACKLIST = new HashSet<String>() {{
|
||||||
|
add("samsung");
|
||||||
|
}};
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user