mirror of
https://github.com/nextcloud/talk-android
synced 2025-03-10 08:00:57 +00:00
rename blacklist/whitelist variables to include/exclude sets to reflect their collection type
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
This commit is contained in:
parent
61ec38dd5e
commit
49792ecf1e
@ -133,11 +133,11 @@ class NextcloudTalkApplication : MultiDexApplication(), LifecycleObserver {
|
|||||||
//region private methods
|
//region private methods
|
||||||
private fun initializeWebRtc() {
|
private fun initializeWebRtc() {
|
||||||
try {
|
try {
|
||||||
if (MagicWebRTCUtils.HARDWARE_AEC_BLACKLIST.contains(Build.MODEL)) {
|
if (MagicWebRTCUtils.HARDWARE_AEC_EXCLUDE_SET.contains(Build.MODEL)) {
|
||||||
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true)
|
WebRtcAudioUtils.setWebRtcBasedAcousticEchoCanceler(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!MagicWebRTCUtils.OPEN_SL_ES_WHITELIST.contains(Build.MODEL)) {
|
if (!MagicWebRTCUtils.OPEN_SL_ES_INCLUDE_SET.contains(Build.MODEL)) {
|
||||||
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true)
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class MagicWebRTCUtils {
|
|||||||
/* AEC blacklist and SL_ES_WHITELIST are borrowed from Signal
|
/* AEC blacklist and SL_ES_WHITELIST are borrowed from Signal
|
||||||
https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java
|
https://github.com/WhisperSystems/Signal-Android/blob/551470123d006b76a68d705d131bb12513a5e683/src/org/thoughtcrime/securesms/ApplicationContext.java
|
||||||
*/
|
*/
|
||||||
public static Set<String> HARDWARE_AEC_BLACKLIST = new HashSet<String>() {{
|
public static Set<String> HARDWARE_AEC_EXCLUDE_SET = new HashSet<String>() {{
|
||||||
add("D6503"); // Sony Xperia Z2 D6503
|
add("D6503"); // Sony Xperia Z2 D6503
|
||||||
add("ONE A2005"); // OnePlus 2
|
add("ONE A2005"); // OnePlus 2
|
||||||
add("MotoG3"); // Moto G (3rd Generation)
|
add("MotoG3"); // Moto G (3rd Generation)
|
||||||
@ -69,12 +69,12 @@ public class MagicWebRTCUtils {
|
|||||||
add("E5823"); // Sony Z5 Compact
|
add("E5823"); // Sony Z5 Compact
|
||||||
}};
|
}};
|
||||||
|
|
||||||
public static Set<String> OPEN_SL_ES_WHITELIST = new HashSet<String>() {{
|
public static Set<String> OPEN_SL_ES_INCLUDE_SET = new HashSet<String>() {{
|
||||||
add("Pixel");
|
add("Pixel");
|
||||||
add("Pixel XL");
|
add("Pixel XL");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private static Set<String> HARDWARE_ACCELERATION_DEVICE_BLACKLIST = new HashSet<String>() {{
|
private static final Set<String> HARDWARE_ACCELERATION_DEVICE_EXCLUDE_SET = new HashSet<String>() {{
|
||||||
add("GT-I9100"); // Samsung Galaxy S2
|
add("GT-I9100"); // Samsung Galaxy S2
|
||||||
add("GT-N8013"); // Samsung Galaxy Note 10.1
|
add("GT-N8013"); // Samsung Galaxy Note 10.1
|
||||||
add("SM-G930F"); // Samsung Galaxy S7
|
add("SM-G930F"); // Samsung Galaxy S7
|
||||||
@ -86,14 +86,14 @@ public class MagicWebRTCUtils {
|
|||||||
add("XT1097"); // Motorola Moto X (2nd Gen)
|
add("XT1097"); // Motorola Moto X (2nd Gen)
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private static Set<String> HARDWARE_ACCELERATION_VENDOR_BLACKLIST = new HashSet<String>() {{
|
private static final Set<String> HARDWARE_ACCELERATION_VENDOR_EXCLUDE_SET = new HashSet<String>() {{
|
||||||
add("samsung");
|
add("samsung");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
|
||||||
public static boolean shouldEnableVideoHardwareAcceleration() {
|
public static boolean shouldEnableVideoHardwareAcceleration() {
|
||||||
return (!HARDWARE_ACCELERATION_VENDOR_BLACKLIST.contains(Build.MANUFACTURER.toLowerCase(Locale.ROOT))
|
return (!HARDWARE_ACCELERATION_VENDOR_EXCLUDE_SET.contains(Build.MANUFACTURER.toLowerCase(Locale.ROOT))
|
||||||
&& !HARDWARE_ACCELERATION_DEVICE_BLACKLIST.contains(Build.MODEL.toUpperCase(Locale.ROOT)));
|
&& !HARDWARE_ACCELERATION_DEVICE_EXCLUDE_SET.contains(Build.MODEL.toUpperCase(Locale.ROOT)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String preferCodec(String sdpDescription, String codec, boolean isAudio) {
|
public static String preferCodec(String sdpDescription, String codec, boolean isAudio) {
|
||||||
@ -105,7 +105,7 @@ public class MagicWebRTCUtils {
|
|||||||
}
|
}
|
||||||
// A list with all the payload types with name |codec|. The payload types are integers in the
|
// A list with all the payload types with name |codec|. The payload types are integers in the
|
||||||
// range 96-127, but they are stored as strings here.
|
// range 96-127, but they are stored as strings here.
|
||||||
final List<String> codecPayloadTypes = new ArrayList<String>();
|
final List<String> codecPayloadTypes = new ArrayList<>();
|
||||||
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
|
// a=rtpmap:<payload type> <encoding name>/<clock rate> [/<encoding parameters>]
|
||||||
final Pattern codecPattern = Pattern.compile("^a=rtpmap:(\\d+) " + codec + "(/\\d+)+[\r]?$");
|
final Pattern codecPattern = Pattern.compile("^a=rtpmap:(\\d+) " + codec + "(/\\d+)+[\r]?$");
|
||||||
for (int i = 0; i < lines.length; ++i) {
|
for (int i = 0; i < lines.length; ++i) {
|
||||||
@ -150,11 +150,11 @@ public class MagicWebRTCUtils {
|
|||||||
}
|
}
|
||||||
final List<String> header = origLineParts.subList(0, 3);
|
final List<String> header = origLineParts.subList(0, 3);
|
||||||
final List<String> unpreferredPayloadTypes =
|
final List<String> unpreferredPayloadTypes =
|
||||||
new ArrayList<String>(origLineParts.subList(3, origLineParts.size()));
|
new ArrayList<>(origLineParts.subList(3, origLineParts.size()));
|
||||||
unpreferredPayloadTypes.removeAll(preferredPayloadTypes);
|
unpreferredPayloadTypes.removeAll(preferredPayloadTypes);
|
||||||
// Reconstruct the line with |preferredPayloadTypes| moved to the beginning of the payload
|
// Reconstruct the line with |preferredPayloadTypes| moved to the beginning of the payload
|
||||||
// types.
|
// types.
|
||||||
final List<String> newLineParts = new ArrayList<String>();
|
final List<String> newLineParts = new ArrayList<>();
|
||||||
newLineParts.addAll(header);
|
newLineParts.addAll(header);
|
||||||
newLineParts.addAll(preferredPayloadTypes);
|
newLineParts.addAll(preferredPayloadTypes);
|
||||||
newLineParts.addAll(unpreferredPayloadTypes);
|
newLineParts.addAll(unpreferredPayloadTypes);
|
||||||
@ -162,7 +162,9 @@ public class MagicWebRTCUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static String joinString(
|
private static String joinString(
|
||||||
Iterable<? extends CharSequence> s, String delimiter, boolean delimiterAtEnd) {
|
Iterable<? extends CharSequence> s,
|
||||||
|
String delimiter,
|
||||||
|
boolean delimiterAtEnd) {
|
||||||
Iterator<? extends CharSequence> iter = s.iterator();
|
Iterator<? extends CharSequence> iter = s.iterator();
|
||||||
if (!iter.hasNext()) {
|
if (!iter.hasNext()) {
|
||||||
return "";
|
return "";
|
||||||
@ -176,5 +178,4 @@ public class MagicWebRTCUtils {
|
|||||||
}
|
}
|
||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user