Rabbit-R1/android (non root)/java/sources/org/webrtc/DefaultVideoEncoderFactory.java
2024-05-21 17:08:36 -04:00

37 lines
1.7 KiB
Java

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()]);
}
}