package defpackage;

import android.os.SystemClock;
import java.util.List;
import java.util.TreeSet;

/* JADX INFO: renamed from: ʿˏˈ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C0398 implements InterfaceC4291 {

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C4545 f2250;

    /* JADX INFO: renamed from: ˊᵫᵗ, reason: contains not printable characters */
    public boolean f2251;

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public final C4545 f2252;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public long f2253;

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final Object f2254;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public long f2255;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public volatile int f2256;

    /* JADX INFO: renamed from: ᵲᵶᵳˈ, reason: contains not printable characters */
    public final InterfaceC0728 f2257;

    /* JADX INFO: renamed from: ᵵᵽ, reason: contains not printable characters */
    public InterfaceC4550 f2258;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public boolean f2259;

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final int f2260;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public volatile long f2261;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public final C0625 f2262;

    public C0398(C3176 c3176, int i) {
        InterfaceC0728 c0900;
        InterfaceC0728 interfaceC0728;
        this.f2260 = i;
        String str = c3176.f12057.f19987;
        str.getClass();
        switch (str) {
            case "video/3gpp":
                c0900 = new C0900(c3176, 0);
                interfaceC0728 = c0900;
                break;
            case "video/hevc":
                c0900 = new C1777(c3176, 1);
                interfaceC0728 = c0900;
                break;
            case "audio/amr-wb":
            case "audio/3gpp":
                c0900 = new C1125(c3176);
                interfaceC0728 = c0900;
                break;
            case "audio/mp4a-latm":
                c0900 = c3176.f12058.equals("MP4A-LATM") ? new C1459(c3176) : new C1047(c3176);
                interfaceC0728 = c0900;
                break;
            case "audio/ac3":
                c0900 = new C1116(c3176);
                interfaceC0728 = c0900;
                break;
            case "audio/raw":
            case "audio/g711-alaw":
            case "audio/g711-mlaw":
                c0900 = new C2484(c3176);
                interfaceC0728 = c0900;
                break;
            case "video/mp4v-es":
                c0900 = new C0990(c3176);
                interfaceC0728 = c0900;
                break;
            case "video/avc":
                c0900 = new C1777(c3176, 0);
                interfaceC0728 = c0900;
                break;
            case "audio/opus":
                c0900 = new C3182(c3176);
                interfaceC0728 = c0900;
                break;
            case "video/x-vnd.on2.vp8":
                c0900 = new C2820(c3176);
                interfaceC0728 = c0900;
                break;
            case "video/x-vnd.on2.vp9":
                c0900 = new C0900(c3176, 1);
                interfaceC0728 = c0900;
                break;
            default:
                interfaceC0728 = null;
                break;
        }
        interfaceC0728.getClass();
        this.f2257 = interfaceC0728;
        this.f2250 = new C4545(65507);
        this.f2252 = new C4545();
        this.f2254 = new Object();
        C0625 c0625 = new C0625();
        c0625.f2970 = new TreeSet(new C2262(17));
        c0625.m2283();
        this.f2262 = c0625;
        this.f2261 = -9223372036854775807L;
        this.f2256 = -1;
        this.f2255 = -9223372036854775807L;
        this.f2253 = -9223372036854775807L;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo1252(long j, long j2) {
        synchronized (this.f2254) {
            try {
                if (!this.f2259) {
                    this.f2259 = true;
                }
                this.f2255 = j;
                this.f2253 = j2;
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final InterfaceC4291 mo1254() {
        return this;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵨᵣ */
    public final boolean mo1255(InterfaceC5206 interfaceC5206) {
        throw new UnsupportedOperationException("RTP packets are transmitted in a packet stream do not support sniffing.");
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo1256() {
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵵᵽ */
    public final void mo1257(InterfaceC4550 interfaceC4550) {
        this.f2257.mo2600(interfaceC4550, this.f2260);
        interfaceC4550.mo2740();
        interfaceC4550.mo2739(new C3782(-9223372036854775807L));
        this.f2258 = interfaceC4550;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final int mo1258(InterfaceC5206 interfaceC5206, C2669 c2669) {
        this.f2258.getClass();
        int i = interfaceC5206.read(this.f2250.f17284, 0, 65507);
        if (i == -1) {
            return -1;
        }
        if (i == 0) {
            return 0;
        }
        this.f2250.m9624(0);
        this.f2250.m9612(i);
        C4545 c4545 = this.f2250;
        byte[] bArr = C5141.f19337;
        C5141 c5141 = null;
        if (c4545.m9623() >= 12) {
            int iM9626 = c4545.m9626();
            byte b = (byte) (iM9626 >> 6);
            byte b2 = (byte) (iM9626 & 15);
            boolean z = ((iM9626 >> 4) & 1) == 1;
            if (b == 2) {
                int iM96262 = c4545.m9626();
                boolean z2 = ((iM96262 >> 7) & 1) == 1;
                byte b3 = (byte) (iM96262 & 127);
                int iM9598 = c4545.m9598();
                long jM9606 = c4545.m9606();
                int iM9614 = c4545.m9614();
                if (b2 > 0) {
                    byte[] bArr2 = new byte[b2 * 4];
                    for (int i2 = 0; i2 < b2; i2++) {
                        c4545.m9627(bArr2, i2 * 4, 4);
                    }
                }
                if (z) {
                    c4545.m9609(2);
                    short sM9611 = c4545.m9611();
                    if (sM9611 != 0) {
                        c4545.m9609(sM9611 * 4);
                    }
                }
                byte[] bArr3 = new byte[c4545.m9623()];
                c4545.m9627(bArr3, 0, c4545.m9623());
                C3989 c3989 = new C3989();
                c3989.f15287 = bArr;
                c3989.f15285 = z2;
                c3989.f15282 = b3;
                ᵻᵪ.ᵱᵽʡᵚ(iM9598 >= 0 && iM9598 <= 65535);
                c3989.f15283 = 65535 & iM9598;
                c3989.f15286 = jM9606;
                c3989.f15284 = iM9614;
                c3989.f15287 = bArr3;
                c5141 = new C5141(c3989);
            }
        }
        if (c5141 != null) {
            long jElapsedRealtime = SystemClock.elapsedRealtime();
            long j = jElapsedRealtime - 30;
            this.f2262.m2284(c5141, jElapsedRealtime);
            C5141 c5141M2285 = this.f2262.m2285(j);
            if (c5141M2285 != null) {
                if (!this.f2251) {
                    if (this.f2261 == -9223372036854775807L) {
                        this.f2261 = c5141M2285.f19342;
                    }
                    if (this.f2256 == -1) {
                        this.f2256 = c5141M2285.f19339;
                    }
                    this.f2257.mo2601(this.f2261);
                    this.f2251 = true;
                }
                synchronized (this.f2254) {
                    try {
                        if (!this.f2259) {
                            do {
                                C4545 c45452 = this.f2252;
                                byte[] bArr4 = c5141M2285.f19343;
                                c45452.getClass();
                                c45452.m9600(bArr4.length, bArr4);
                                this.f2257.mo2602(this.f2252, c5141M2285.f19342, c5141M2285.f19339, c5141M2285.f19341);
                                c5141M2285 = this.f2262.m2285(j);
                            } while (c5141M2285 != null);
                        } else if (this.f2255 != -9223372036854775807L && this.f2253 != -9223372036854775807L) {
                            this.f2262.m2283();
                            this.f2257.mo2599(this.f2255, this.f2253);
                            this.f2259 = false;
                            this.f2255 = -9223372036854775807L;
                            this.f2253 = -9223372036854775807L;
                        }
                    } catch (Throwable th) {
                        throw th;
                    }
                }
                return 0;
            }
        }
        return 0;
    }

    @Override // defpackage.InterfaceC4291
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final List mo1259() {
        C2822 c2822 = AbstractC4509.f17159;
        return C2598.f10048;
    }
}
