discord-jadx/app/src/main/java/org/webrtc/DefaultVideoDecoderFactory....

53 lines
2.5 KiB
Java

package org.webrtc;
import androidx.annotation.Nullable;
import h0.c.q0;
import java.util.Arrays;
import java.util.LinkedHashSet;
import org.webrtc.EglBase;
public class DefaultVideoDecoderFactory implements VideoDecoderFactory {
private final VideoDecoderFactory hardwareVideoDecoderFactory;
@Nullable
private final VideoDecoderFactory platformSoftwareVideoDecoderFactory;
private final VideoDecoderFactory softwareVideoDecoderFactory = new SoftwareVideoDecoderFactory();
public DefaultVideoDecoderFactory(@Nullable EglBase.Context context) {
this.hardwareVideoDecoderFactory = new HardwareVideoDecoderFactory(context);
this.platformSoftwareVideoDecoderFactory = new PlatformSoftwareVideoDecoderFactory(context);
}
public DefaultVideoDecoderFactory(VideoDecoderFactory videoDecoderFactory) {
this.hardwareVideoDecoderFactory = videoDecoderFactory;
this.platformSoftwareVideoDecoderFactory = null;
}
@Override // org.webrtc.VideoDecoderFactory
public /* synthetic */ VideoDecoder createDecoder(String str) {
return q0.a(this, str);
}
@Override // org.webrtc.VideoDecoderFactory
@Nullable
public VideoDecoder createDecoder(VideoCodecInfo videoCodecInfo) {
VideoDecoderFactory videoDecoderFactory;
VideoDecoder createDecoder = this.softwareVideoDecoderFactory.createDecoder(videoCodecInfo);
VideoDecoder createDecoder2 = this.hardwareVideoDecoderFactory.createDecoder(videoCodecInfo);
if (createDecoder == null && (videoDecoderFactory = this.platformSoftwareVideoDecoderFactory) != null) {
createDecoder = videoDecoderFactory.createDecoder(videoCodecInfo);
}
return (createDecoder2 == null || createDecoder == null) ? createDecoder2 != null ? createDecoder2 : createDecoder : new VideoDecoderFallback(createDecoder, createDecoder2);
}
@Override // org.webrtc.VideoDecoderFactory
public VideoCodecInfo[] getSupportedCodecs() {
LinkedHashSet linkedHashSet = new LinkedHashSet();
linkedHashSet.addAll(Arrays.asList(this.softwareVideoDecoderFactory.getSupportedCodecs()));
linkedHashSet.addAll(Arrays.asList(this.hardwareVideoDecoderFactory.getSupportedCodecs()));
VideoDecoderFactory videoDecoderFactory = this.platformSoftwareVideoDecoderFactory;
if (videoDecoderFactory != null) {
linkedHashSet.addAll(Arrays.asList(videoDecoderFactory.getSupportedCodecs()));
}
return (VideoCodecInfo[]) linkedHashSet.toArray(new VideoCodecInfo[linkedHashSet.size()]);
}
}