Skip to content

Commit dd363da

Browse files
authored
Merge branch 'main' into dependabot/gradle/androidx.navigation-navigation-compose-2.8.3
2 parents df575e1 + 587f53f commit dd363da

File tree

3 files changed

+87
-4
lines changed

3 files changed

+87
-4
lines changed

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ streamLog = "1.1.4"
33
landscapist = "2.4.1"
44
jvmTarget = "11"
55
androidGradlePlugin = "8.6.1"
6-
androidxActivity = "1.9.2"
6+
androidxActivity = "1.9.3"
77
androidxAppCompat = "1.7.0"
8-
androidxComposeBom = "2024.09.03"
8+
androidxComposeBom = "2024.10.00"
99
androidxComposeMaterial3 = "1.0.0-alpha13"
1010
androidxComposeConstraintLayout = "1.0.1"
1111
androidxComposeNavigation = "2.8.3"
12-
androidxAnnotation = "1.8.2"
12+
androidxAnnotation = "1.9.0"
1313
androidxCore = "1.13.1"
1414
androidxLifecycle = "2.8.6"
1515
androidxNavigation = "2.5.0"
@@ -20,7 +20,7 @@ kotlinxCoroutines = "1.9.0"
2020
okhttp = "4.12.0"
2121
retrofit = "2.9.0"
2222
spotless = "6.21.0"
23-
androidxMacroBenchmark = "1.3.2"
23+
androidxMacroBenchmark = "1.3.3"
2424
androidxProfileinstaller = "1.4.1"
2525
androidxUiAutomator = "2.3.0"
2626

stream-webrtc-android/api/stream-webrtc-android.api

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,13 @@ public final class org/webrtc/DefaultAlignedVideoEncoderFactory : org/webrtc/Vid
265265
public fun getSupportedCodecs ()[Lorg/webrtc/VideoCodecInfo;
266266
}
267267

268+
public class org/webrtc/DefaultBlacklistedVideoDecoderFactory : org/webrtc/VideoDecoderFactory {
269+
public fun <init> (Lorg/webrtc/EglBase$Context;)V
270+
public fun <init> (Lorg/webrtc/EglBase$Context;Ljava/util/function/Predicate;)V
271+
public fun createDecoder (Lorg/webrtc/VideoCodecInfo;)Lorg/webrtc/VideoDecoder;
272+
public fun getSupportedCodecs ()[Lorg/webrtc/VideoCodecInfo;
273+
}
274+
268275
public class org/webrtc/DefaultVideoDecoderFactory : org/webrtc/VideoDecoderFactory {
269276
public fun <init> (Lorg/webrtc/EglBase$Context;)V
270277
public fun createDecoder (Lorg/webrtc/VideoCodecInfo;)Lorg/webrtc/VideoDecoder;
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package org.webrtc;
2+
3+
import androidx.annotation.Nullable;
4+
5+
import java.util.Arrays;
6+
import java.util.HashSet;
7+
import java.util.Set;
8+
import java.util.function.Predicate;
9+
10+
public class DefaultBlacklistedVideoDecoderFactory implements VideoDecoderFactory {
11+
12+
private static final String TAG = "DefaultBlacklistedVideoDecoderFactory";
13+
14+
private static final Predicate<VideoDecoder> defaultBlacklistedPredicate =
15+
decoder -> {
16+
// if the decoder is Exynos VP9, then blacklist it
17+
return isExynosVP9(decoder);
18+
};
19+
20+
private final VideoDecoderFactory hardwareVideoDecoderFactory;
21+
private final VideoDecoderFactory softwareVideoDecoderFactory;
22+
private final VideoDecoderFactory platformSoftwareVideoDecoderFactory;
23+
private final Predicate<VideoDecoder> isHardwareDecoderBlacklisted;
24+
25+
public DefaultBlacklistedVideoDecoderFactory(@Nullable EglBase.Context eglContext) {
26+
this(eglContext, null);
27+
}
28+
29+
public DefaultBlacklistedVideoDecoderFactory(
30+
@Nullable EglBase.Context eglContext,
31+
@Nullable Predicate<VideoDecoder> decoderBlacklistedPredicate) {
32+
this.hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext);
33+
this.softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory();
34+
this.platformSoftwareVideoDecoderFactory = new PlatformSoftwareVideoDecoderFactory(eglContext);
35+
this.isHardwareDecoderBlacklisted = decoderBlacklistedPredicate == null
36+
? defaultBlacklistedPredicate
37+
: decoderBlacklistedPredicate.or(defaultBlacklistedPredicate);
38+
}
39+
40+
@Override
41+
public VideoDecoder createDecoder(VideoCodecInfo codecType) {
42+
VideoDecoder softwareDecoder = softwareVideoDecoderFactory.createDecoder(codecType);
43+
VideoDecoder hardwareDecoder = hardwareVideoDecoderFactory.createDecoder(codecType);
44+
if (softwareDecoder == null) {
45+
softwareDecoder = platformSoftwareVideoDecoderFactory.createDecoder(codecType);
46+
}
47+
48+
if (isHardwareDecoderBlacklisted.test(hardwareDecoder)) {
49+
Logging.d(TAG, "Hardware decoder is blacklisted: " + hardwareDecoder.getImplementationName());
50+
return softwareDecoder;
51+
}
52+
53+
if (hardwareDecoder != null && softwareDecoder != null) {
54+
return new VideoDecoderFallback(softwareDecoder, hardwareDecoder);
55+
} else {
56+
return hardwareDecoder != null ? hardwareDecoder : softwareDecoder;
57+
}
58+
}
59+
60+
@Override
61+
public VideoCodecInfo[] getSupportedCodecs() {
62+
Set<VideoCodecInfo> supportedCodecInfos = new HashSet<>();
63+
supportedCodecInfos.addAll(Arrays.asList(softwareVideoDecoderFactory.getSupportedCodecs()));
64+
supportedCodecInfos.addAll(Arrays.asList(hardwareVideoDecoderFactory.getSupportedCodecs()));
65+
supportedCodecInfos.addAll(Arrays.asList(platformSoftwareVideoDecoderFactory.getSupportedCodecs()));
66+
return supportedCodecInfos.toArray(new VideoCodecInfo[0]);
67+
}
68+
69+
private static boolean isExynosVP9(@Nullable VideoDecoder decoder) {
70+
if (decoder == null) {
71+
return false;
72+
}
73+
final String name = decoder.getImplementationName().toLowerCase();
74+
return name.contains("exynos") && name.contains("vp9");
75+
}
76+
}

0 commit comments

Comments
 (0)