Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
fix(android) disable HW AV1 codec
Saúl Ibarra Corretgé8a79d200c846
diff --git a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiVideoDecoderFactory.java b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiVideoDecoderFactory.javaindex 6971e73d7f..1beaf4cc63 100644--- a/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiVideoDecoderFactory.java+++ b/android/sdk/src/main/java/org/jitsi/meet/sdk/JitsiVideoDecoderFactory.java@@ -10,13 +10,15 @@ package org.jitsi.meet.sdk;* be found in the AUTHORS file in the root of the source tree.*/+import android.media.MediaCodecInfo;import androidx.annotation.Nullable;import com.oney.WebRTCModule.webrtcutils.SoftwareVideoDecoderFactoryProxy;import org.webrtc.EglBase;import org.webrtc.HardwareVideoDecoderFactory;-import org.webrtc.PlatformSoftwareVideoDecoderFactory;+import org.webrtc.JitsiPlatformVideoDecoderFactory;+import org.webrtc.Predicate;import org.webrtc.VideoCodecInfo;import org.webrtc.VideoDecoder;import org.webrtc.VideoDecoderFactory;@@ -31,29 +33,34 @@ import java.util.LinkedHashSet;public class JitsiVideoDecoderFactory implements VideoDecoderFactory {private final VideoDecoderFactory hardwareVideoDecoderFactory;private final VideoDecoderFactory softwareVideoDecoderFactory = new SoftwareVideoDecoderFactoryProxy();- private final @Nullable VideoDecoderFactory platformSoftwareVideoDecoderFactory;+ private final VideoDecoderFactory platformSoftwareVideoDecoderFactory;/**- * Create decoder factory using default hardware decoder factory.+ * Predicate to filter out the AV1 hardware decoder, as we've seen decoding issues with it.*/- public JitsiVideoDecoderFactory(@Nullable EglBase.Context eglContext) {- this.hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext);- this.platformSoftwareVideoDecoderFactory = new PlatformSoftwareVideoDecoderFactory(eglContext);- }+ private static final String GOOGLE_AV1_DECODER = "c2.google.av1";+ private static final Predicate<MediaCodecInfo> hwCodecPredicate = arg -> {+ // Filter out the Google AV1 codec.+ return !arg.getName().startsWith(GOOGLE_AV1_DECODER);+ };+ private static final Predicate<MediaCodecInfo> swCodecPredicate = arg -> {+ // Noop, just making sure we can customize it easily if needed.+ return true;+ };/**- * Create decoder factory using explicit hardware decoder factory.+ * Create decoder factory using default hardware decoder factory.*/- JitsiVideoDecoderFactory(VideoDecoderFactory hardwareVideoDecoderFactory) {- this.hardwareVideoDecoderFactory = hardwareVideoDecoderFactory;- this.platformSoftwareVideoDecoderFactory = null;+ public JitsiVideoDecoderFactory(@Nullable EglBase.Context eglContext) {+ this.hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(eglContext, hwCodecPredicate);+ this.platformSoftwareVideoDecoderFactory = new JitsiPlatformVideoDecoderFactory(eglContext, swCodecPredicate);}@Overridepublic @Nullable VideoDecoder createDecoder(VideoCodecInfo codecType) {VideoDecoder softwareDecoder = softwareVideoDecoderFactory.createDecoder(codecType);final VideoDecoder hardwareDecoder = hardwareVideoDecoderFactory.createDecoder(codecType);- if (softwareDecoder == null && platformSoftwareVideoDecoderFactory != null) {+ if (softwareDecoder == null) {softwareDecoder = platformSoftwareVideoDecoderFactory.createDecoder(codecType);}if (hardwareDecoder != null && softwareDecoder != null) {@@ -70,10 +77,7 @@ public class JitsiVideoDecoderFactory implements VideoDecoderFactory {supportedCodecInfos.addAll(Arrays.asList(softwareVideoDecoderFactory.getSupportedCodecs()));supportedCodecInfos.addAll(Arrays.asList(hardwareVideoDecoderFactory.getSupportedCodecs()));- if (platformSoftwareVideoDecoderFactory != null) {- supportedCodecInfos.addAll(- Arrays.asList(platformSoftwareVideoDecoderFactory.getSupportedCodecs()));- }+ supportedCodecInfos.addAll(Arrays.asList(platformSoftwareVideoDecoderFactory.getSupportedCodecs()));return supportedCodecInfos.toArray(new VideoCodecInfo[supportedCodecInfos.size()]);}diff --git a/android/sdk/src/main/java/org/webrtc/JitsiPlatformVideoDecoderFactory.java b/android/sdk/src/main/java/org/webrtc/JitsiPlatformVideoDecoderFactory.javanew file mode 100644index 0000000000..97522a3d89--- /dev/null+++ b/android/sdk/src/main/java/org/webrtc/JitsiPlatformVideoDecoderFactory.java@@ -0,0 +1,40 @@+/*+ * Copyright 2018 The WebRTC project authors. All Rights Reserved.+ *+ * Use of this source code is governed by a BSD-style license+ * that can be found in the LICENSE file in the root of the source+ * tree. An additional intellectual property rights grant can be found+ * in the file PATENTS. All contributing project authors may+ * be found in the AUTHORS file in the root of the source tree.+ */++package org.webrtc;++import android.media.MediaCodecInfo;+import androidx.annotation.Nullable;++/** Factory for Android platform software VideoDecoders. */+public class JitsiPlatformVideoDecoderFactory extends MediaCodecVideoDecoderFactory {+ /**+ * Default allowed predicate.+ */+ private static final Predicate<MediaCodecInfo> defaultAllowedPredicate =+ codecInfo -> {+ // We only want to use the platform software codecs.+ return MediaCodecUtils.isSoftwareOnly(codecInfo);+ };++ /**+ * Creates a PlatformSoftwareVideoDecoderFactory that supports surface texture rendering.+ *+ * @param sharedContext The textures generated will be accessible from this context. May be null,+ * this disables texture support.+ */+ public JitsiPlatformVideoDecoderFactory(@Nullable EglBase.Context sharedContext) {+ super(sharedContext, defaultAllowedPredicate);+ }++ public JitsiPlatformVideoDecoderFactory(@Nullable EglBase.Context sharedContext, @Nullable Predicate<MediaCodecInfo> codecAllowedPredicate) {+ super(sharedContext, codecAllowedPredicate == null ? defaultAllowedPredicate : codecAllowedPredicate.and(defaultAllowedPredicate));+ }+}