package defpackage;

/* renamed from: ᵤٴˊ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3426 implements InterfaceC3676 {

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public C1240 f12805;

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public long f12806;

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public boolean f12807;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public boolean f12808;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public int f12810;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final InterfaceC4315 f12811;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public int f12813;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public boolean f12814;

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public boolean f12815;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public int f12816;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C4089 f12812 = new C4089(10, new byte[10]);

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public int f12809 = 0;

    public C3426(InterfaceC4315 interfaceC4315) {
        this.f12811 = interfaceC4315;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final boolean m7805() {
        C4089 c4089 = this.f12812;
        c4089.m8957(0);
        int iM8966 = c4089.m8966(24);
        if (iM8966 != 1) {
            AbstractC1327.m4103(iM8966, "Unexpected start code prefix: ");
            this.f12813 = -1;
            return false;
        }
        c4089.m8956(8);
        int iM89662 = c4089.m8966(16);
        c4089.m8956(5);
        this.f12814 = c4089.m8964();
        c4089.m8956(2);
        this.f12808 = c4089.m8964();
        this.f12807 = c4089.m8964();
        c4089.m8956(6);
        int iM89663 = c4089.m8966(8);
        this.f12810 = iM89663;
        if (iM89662 == 0) {
            this.f12813 = -1;
            return true;
        }
        int i = (iM89662 - 3) - iM89663;
        this.f12813 = i;
        if (i < 0) {
            ᵳʿˉ.ᵶʔᵢˊ("Found negative packet payload size: " + this.f12813);
            this.f12813 = -1;
        }
        return true;
    }

    @Override // defpackage.InterfaceC3676
    /* renamed from: ˏᵙ */
    public final void mo1309() {
        this.f12809 = 0;
        this.f12816 = 0;
        this.f12815 = false;
        this.f12811.mo1773();
    }

    @Override // defpackage.InterfaceC3676
    /* renamed from: ᵥᵯˎ */
    public final void mo1310(int i, C3493 c3493) {
        this.f12805.getClass();
        int i2 = i & 1;
        int i3 = -1;
        int i4 = 2;
        InterfaceC4315 interfaceC4315 = this.f12811;
        if (i2 != 0) {
            int i5 = this.f12809;
            if (i5 != 0 && i5 != 1) {
                if (i5 == 2) {
                    ᵳʿˉ.ᵶʔᵢˊ("Unexpected start indicator reading extended header");
                } else {
                    if (i5 != 3) {
                        ᵨᴵᵺ.ˌʾˀ();
                        return;
                    }
                    if (this.f12813 != -1) {
                        ᵳʿˉ.ᵶʔᵢˊ("Unexpected start indicator: expected " + this.f12813 + " more bytes");
                    }
                    interfaceC4315.mo1775(c3493.f13081 == 0);
                }
            }
            this.f12809 = 1;
            this.f12816 = 0;
        }
        int i6 = i;
        while (c3493.m7959() > 0) {
            int i7 = this.f12809;
            if (i7 != 0) {
                C4089 c4089 = this.f12812;
                if (i7 != 1) {
                    if (i7 == i4) {
                        if (m7806(c3493, c4089.f15282, Math.min(10, this.f12810)) && m7806(c3493, null, this.f12810)) {
                            c4089.m8957(0);
                            this.f12806 = -9223372036854775807L;
                            if (this.f12808) {
                                c4089.m8956(4);
                                c4089.m8956(1);
                                c4089.m8956(1);
                                long jM8966 = (c4089.m8966(15) << 15) | (c4089.m8966(3) << 30) | c4089.m8966(15);
                                c4089.m8956(1);
                                if (!this.f12815 && this.f12807) {
                                    c4089.m8956(4);
                                    c4089.m8956(1);
                                    c4089.m8956(1);
                                    c4089.m8956(1);
                                    this.f12805.m3776((c4089.m8966(3) << 30) | (c4089.m8966(15) << 15) | c4089.m8966(15));
                                    this.f12815 = true;
                                }
                                this.f12806 = this.f12805.m3776(jM8966);
                            }
                            i6 |= this.f12814 ? 4 : 0;
                            interfaceC4315.mo1771(this.f12806, i6);
                            this.f12809 = 3;
                            this.f12816 = 0;
                        }
                    } else {
                        if (i7 != 3) {
                            ᵨᴵᵺ.ˌʾˀ();
                            return;
                        }
                        int iM7959 = c3493.m7959();
                        int i8 = this.f12813;
                        int i9 = i8 == i3 ? 0 : iM7959 - i8;
                        if (i9 > 0) {
                            iM7959 -= i9;
                            c3493.m7950(c3493.f13083 + iM7959);
                        }
                        interfaceC4315.mo1774(c3493);
                        int i10 = this.f12813;
                        if (i10 != i3) {
                            int i11 = i10 - iM7959;
                            this.f12813 = i11;
                            if (i11 == 0) {
                                interfaceC4315.mo1775(false);
                                this.f12809 = 1;
                                this.f12816 = 0;
                            }
                        }
                    }
                } else if (m7806(c3493, c4089.f15282, 9)) {
                    this.f12809 = m7805() ? 2 : 0;
                    this.f12816 = 0;
                }
            } else {
                c3493.m7946(c3493.m7959());
            }
            i3 = -1;
            i4 = 2;
        }
    }

    @Override // defpackage.InterfaceC3676
    /* renamed from: ᵴᵳ */
    public final void mo1311(C1240 c1240, InterfaceC1982 interfaceC1982, C4996 c4996) {
        this.f12805 = c1240;
        this.f12811.mo1772(interfaceC1982, c4996);
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final boolean m7806(C3493 c3493, byte[] bArr, int i) {
        int iMin = Math.min(c3493.m7959(), i - this.f12816);
        if (iMin <= 0) {
            return true;
        }
        if (bArr == null) {
            c3493.m7946(iMin);
        } else {
            c3493.m7970(bArr, this.f12816, iMin);
        }
        int i2 = this.f12816 + iMin;
        this.f12816 = i2;
        return i2 == i;
    }
}
