package defpackage;

/* JADX INFO: renamed from: ᵥᵹˎ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C3537 implements InterfaceC1954 {

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

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public C0085 f13586;

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

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

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

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

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

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

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public int f13593;

    /* JADX INFO: renamed from: ᵻˈᵦʼ, reason: contains not printable characters */
    public boolean f13594;

    /* JADX INFO: renamed from: ʽˈˋ, reason: contains not printable characters */
    public final C3180 f13583 = new C3180(10, new byte[10]);

    /* JADX INFO: renamed from: ːˏᵟᵯ, reason: contains not printable characters */
    public int f13585 = 0;

    public C3537(InterfaceC2750 interfaceC2750) {
        this.f13589 = interfaceC2750;
    }

    @Override // defpackage.InterfaceC1954
    /* JADX INFO: renamed from: ʽˈˋ */
    public final void mo5234(C0085 c0085, InterfaceC4550 interfaceC4550, C4173 c4173) {
        this.f13586 = c0085;
        this.f13589.mo2663(interfaceC4550, c4173);
    }

    @Override // defpackage.InterfaceC1954
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final void mo5235() {
        this.f13585 = 0;
        this.f13592 = 0;
        this.f13584 = false;
        this.f13589.mo2659();
    }

    /* JADX INFO: renamed from: ᵨᵣ, reason: contains not printable characters */
    public final boolean m8048() {
        C3180 c3180 = this.f13583;
        c3180.m7298(0);
        int iM7302 = c3180.m7302(24);
        if (iM7302 != 1) {
            AbstractC3653.m8224(iM7302, "Unexpected start code prefix: ");
            this.f13588 = -1;
            return false;
        }
        c3180.m7287(8);
        int iM73022 = c3180.m7302(16);
        c3180.m7287(5);
        this.f13591 = c3180.m7299();
        c3180.m7287(2);
        this.f13594 = c3180.m7299();
        this.f13590 = c3180.m7299();
        c3180.m7287(6);
        int iM73023 = c3180.m7302(8);
        this.f13593 = iM73023;
        if (iM73022 == 0) {
            this.f13588 = -1;
            return true;
        }
        int i = (iM73022 - 3) - iM73023;
        this.f13588 = i;
        if (i < 0) {
            ˋˀᵧ.ʿٴˇ("Found negative packet payload size: " + this.f13588);
            this.f13588 = -1;
        }
        return true;
    }

    @Override // defpackage.InterfaceC1954
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final void mo5236(int i, C4545 c4545) {
        this.f13586.getClass();
        int i2 = i & 1;
        int i3 = -1;
        int i4 = 2;
        InterfaceC2750 interfaceC2750 = this.f13589;
        if (i2 != 0) {
            int i5 = this.f13585;
            if (i5 != 0 && i5 != 1) {
                if (i5 == 2) {
                    ˋˀᵧ.ʿٴˇ("Unexpected start indicator reading extended header");
                } else {
                    if (i5 != 3) {
                        ᵷᵝˎ.ᵱʡˏ();
                        return;
                    }
                    if (this.f13588 != -1) {
                        ˋˀᵧ.ʿٴˇ("Unexpected start indicator: expected " + this.f13588 + " more bytes");
                    }
                    interfaceC2750.mo2662(c4545.f17283 == 0);
                }
            }
            this.f13585 = 1;
            this.f13592 = 0;
        }
        int i6 = i;
        while (c4545.m9623() > 0) {
            int i7 = this.f13585;
            if (i7 != 0) {
                C3180 c3180 = this.f13583;
                if (i7 != 1) {
                    if (i7 == i4) {
                        if (m8049(c4545, c3180.f12075, Math.min(10, this.f13593)) && m8049(c4545, null, this.f13593)) {
                            c3180.m7298(0);
                            this.f13587 = -9223372036854775807L;
                            if (this.f13594) {
                                c3180.m7287(4);
                                long jM7302 = ((long) c3180.m7302(3)) << 30;
                                c3180.m7287(1);
                                long jM73022 = ((long) (c3180.m7302(15) << 15)) | jM7302;
                                c3180.m7287(1);
                                long jM73023 = jM73022 | ((long) c3180.m7302(15));
                                c3180.m7287(1);
                                if (!this.f13584 && this.f13590) {
                                    c3180.m7287(4);
                                    long jM73024 = ((long) c3180.m7302(3)) << 30;
                                    c3180.m7287(1);
                                    long jM73025 = jM73024 | ((long) (c3180.m7302(15) << 15));
                                    c3180.m7287(1);
                                    long jM73026 = jM73025 | ((long) c3180.m7302(15));
                                    c3180.m7287(1);
                                    this.f13586.m1133(jM73026);
                                    this.f13584 = true;
                                }
                                this.f13587 = this.f13586.m1133(jM73023);
                            }
                            i6 |= this.f13591 ? 4 : 0;
                            interfaceC2750.mo2660(this.f13587, i6);
                            this.f13585 = 3;
                            this.f13592 = 0;
                        }
                    } else {
                        if (i7 != 3) {
                            ᵷᵝˎ.ᵱʡˏ();
                            return;
                        }
                        int iM9623 = c4545.m9623();
                        int i8 = this.f13588;
                        int i9 = i8 == i3 ? 0 : iM9623 - i8;
                        if (i9 > 0) {
                            iM9623 -= i9;
                            c4545.m9612(c4545.f17282 + iM9623);
                        }
                        interfaceC2750.mo2661(c4545);
                        int i10 = this.f13588;
                        if (i10 != i3) {
                            int i11 = i10 - iM9623;
                            this.f13588 = i11;
                            if (i11 == 0) {
                                interfaceC2750.mo2662(false);
                                this.f13585 = 1;
                                this.f13592 = 0;
                            }
                        }
                    }
                } else if (m8049(c4545, c3180.f12075, 9)) {
                    this.f13585 = m8048() ? 2 : 0;
                    this.f13592 = 0;
                }
            } else {
                c4545.m9609(c4545.m9623());
            }
            i3 = -1;
            i4 = 2;
        }
    }

    /* JADX INFO: renamed from: ᵷᵺʾᵖ, reason: contains not printable characters */
    public final boolean m8049(C4545 c4545, byte[] bArr, int i) {
        int iMin = Math.min(c4545.m9623(), i - this.f13592);
        if (iMin <= 0) {
            return true;
        }
        if (bArr == null) {
            c4545.m9609(iMin);
        } else {
            c4545.m9627(bArr, this.f13592, iMin);
        }
        int i2 = this.f13592 + iMin;
        this.f13592 = i2;
        return i2 == i;
    }
}
