Rabbit-R1/android (non root)/java/sources/org/webrtc/DefaultVideoEncoderFactory.java

38 lines
1.7 KiB
Java
Raw Normal View History

2024-05-21 16:08:36 -05:00
package org.webrtc;
import java.util.Arrays;
import java.util.LinkedHashSet;
import org.webrtc.EglBase;
/* loaded from: classes3.dex */
public class DefaultVideoEncoderFactory implements VideoEncoderFactory {
private final VideoEncoderFactory hardwareVideoEncoderFactory;
private final VideoEncoderFactory softwareVideoEncoderFactory = new SoftwareVideoEncoderFactory();
public DefaultVideoEncoderFactory(EglBase.Context context, boolean z, boolean z2) {
this.hardwareVideoEncoderFactory = new HardwareVideoEncoderFactory(context, z, z2);
}
DefaultVideoEncoderFactory(VideoEncoderFactory videoEncoderFactory) {
this.hardwareVideoEncoderFactory = videoEncoderFactory;
}
@Override // org.webrtc.VideoEncoderFactory
public VideoEncoder createEncoder(VideoCodecInfo videoCodecInfo) {
VideoEncoder createEncoder = this.softwareVideoEncoderFactory.createEncoder(videoCodecInfo);
VideoEncoder createEncoder2 = this.hardwareVideoEncoderFactory.createEncoder(videoCodecInfo);
if (createEncoder2 == null || createEncoder == null) {
return createEncoder2 != null ? createEncoder2 : createEncoder;
}
return new VideoEncoderFallback(createEncoder, createEncoder2);
}
@Override // org.webrtc.VideoEncoderFactory
public VideoCodecInfo[] getSupportedCodecs() {
LinkedHashSet linkedHashSet = new LinkedHashSet();
linkedHashSet.addAll(Arrays.asList(this.softwareVideoEncoderFactory.getSupportedCodecs()));
linkedHashSet.addAll(Arrays.asList(this.hardwareVideoEncoderFactory.getSupportedCodecs()));
return (VideoCodecInfo[]) linkedHashSet.toArray(new VideoCodecInfo[linkedHashSet.size()]);
}
}