package defpackage;

import java.util.Locale;

/* renamed from: ˁˋᵤᵔ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C0675 implements InterfaceC1593 {

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

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

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

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

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public InterfaceC2154 f3321;

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

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final /* synthetic */ int f3323;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public boolean f3324;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final C2419 f3325;

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

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

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

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

    public C0675(C2419 c2419, int i) {
        this.f3323 = i;
        switch (i) {
            case 1:
                this.f3325 = c2419;
                this.f3329 = -9223372036854775807L;
                this.f3319 = -1;
                this.f3328 = -9223372036854775807L;
                this.f3317 = 0L;
                this.f3320 = -1;
                this.f3322 = -1;
                this.f3326 = -1;
                break;
            default:
                this.f3325 = c2419;
                this.f3329 = -9223372036854775807L;
                this.f3319 = -1;
                break;
        }
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final void mo2630(InterfaceC1982 interfaceC1982, int i) {
        int i2 = this.f3323;
        C2419 c2419 = this.f3325;
        switch (i2) {
            case 0:
                InterfaceC2154 interfaceC2154Mo4996 = interfaceC1982.mo4996(i, 2);
                this.f3321 = interfaceC2154Mo4996;
                interfaceC2154Mo4996.mo4407(c2419.f9445);
                break;
            default:
                InterfaceC2154 interfaceC2154Mo49962 = interfaceC1982.mo4996(i, 2);
                this.f3321 = interfaceC2154Mo49962;
                interfaceC2154Mo49962.mo4407(c2419.f9445);
                break;
        }
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void mo2631(long j) {
        switch (this.f3323) {
            case 0:
                ᵛᵾˏ.ᵿʗᵝʽ(this.f3329 == -9223372036854775807L);
                this.f3329 = j;
                break;
            default:
                ᵛᵾˏ.ᵿʗᵝʽ(this.f3329 == -9223372036854775807L);
                this.f3329 = j;
                break;
        }
    }

    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final void mo2632(long j, long j2) {
        switch (this.f3323) {
            case 0:
                this.f3329 = j;
                this.f3320 = 0;
                this.f3317 = j2;
                break;
            default:
                this.f3329 = j;
                this.f3319 = -1;
                this.f3317 = j2;
                break;
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    @Override // defpackage.InterfaceC1593
    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final void mo2633(C3493 c3493, long j, int i, boolean z) {
        int i2;
        int i3;
        int i4 = this.f3323;
        C2419 c2419 = this.f3325;
        switch (i4) {
            case 0:
                this.f3321.getClass();
                int i5 = c3493.f13083;
                int iM7972 = c3493.m7972();
                Object[] objArr = (iM7972 & 1024) > 0;
                if ((iM7972 & 512) != 0 || (iM7972 & 504) != 0 || (iM7972 & 7) != 0) {
                    ᵳʿˉ.ᵶʔᵢˊ("Dropping packet: video reduncancy coding is not supported, packet header VRC, or PLEN or PEBIT is non-zero");
                    break;
                } else {
                    boolean z2 = this.f3324;
                    if (objArr == true) {
                        if (z2 && this.f3320 > 0) {
                            InterfaceC2154 interfaceC2154 = this.f3321;
                            interfaceC2154.getClass();
                            interfaceC2154.mo4410(this.f3328, this.f3327 ? 1 : 0, this.f3320, 0, null);
                            this.f3320 = 0;
                            this.f3328 = -9223372036854775807L;
                            this.f3327 = false;
                            this.f3324 = false;
                        }
                        this.f3324 = true;
                        if ((c3493.m7968() & 252) < 128) {
                            ᵳʿˉ.ᵶʔᵢˊ("Picture start Code (PSC) missing, dropping packet.");
                            break;
                        } else {
                            byte[] bArr = c3493.f13082;
                            bArr[i5] = 0;
                            bArr[i5 + 1] = 0;
                            c3493.m7955(i5);
                        }
                    } else if (z2) {
                        int iM10873 = C5228.m10873(this.f3319);
                        if (i < iM10873) {
                            String str = AbstractC3558.f13329;
                            Locale locale = Locale.US;
                            ᵳʿˉ.ᵶʔᵢˊ("Received RTP packet with unexpected sequence number. Expected: " + iM10873 + "; received: " + i + ". Dropping packet.");
                            break;
                        }
                    } else {
                        ᵳʿˉ.ᵶʔᵢˊ("First payload octet of the H263 packet is not the beginning of a new H263 partition, Dropping current packet.");
                        break;
                    }
                    if (this.f3320 == 0) {
                        boolean z3 = this.f3318;
                        int i6 = c3493.f13083;
                        if (((c3493.m7954() >> 10) & 63) == 32) {
                            int iM7968 = c3493.m7968();
                            int i7 = (iM7968 >> 1) & 1;
                            if (!z3 && i7 == 0) {
                                int i8 = (iM7968 >> 2) & 7;
                                if (i8 == 1) {
                                    this.f3322 = 128;
                                    this.f3326 = 96;
                                } else {
                                    int i9 = i8 - 2;
                                    this.f3322 = 176 << i9;
                                    this.f3326 = 144 << i9;
                                }
                            }
                            c3493.m7955(i6);
                            this.f3327 = i7 == 0;
                        } else {
                            c3493.m7955(i6);
                            this.f3327 = false;
                        }
                        if (!this.f3318 && this.f3327) {
                            int i10 = this.f3322;
                            C3446 c3446 = c2419.f9445;
                            if (i10 != c3446.f12924 || this.f3326 != c3446.f12920) {
                                InterfaceC2154 interfaceC21542 = this.f3321;
                                C2153 c2153M7829 = c3446.m7829();
                                c2153M7829.f8501 = this.f3322;
                                c2153M7829.f8514 = this.f3326;
                                AbstractC4737.m10004(c2153M7829, interfaceC21542);
                            }
                            this.f3318 = true;
                        }
                    }
                    int iM7959 = c3493.m7959();
                    this.f3321.mo4406(iM7959, c3493);
                    this.f3320 += iM7959;
                    this.f3328 = ˁˈᵸ.ᵡᵘˎʽ(90000, this.f3317, j, this.f3329);
                    if (z) {
                        InterfaceC2154 interfaceC21543 = this.f3321;
                        interfaceC21543.getClass();
                        interfaceC21543.mo4410(this.f3328, this.f3327 ? 1 : 0, this.f3320, 0, null);
                        this.f3320 = 0;
                        this.f3328 = -9223372036854775807L;
                        this.f3327 = false;
                        this.f3324 = false;
                    }
                    this.f3319 = i;
                    break;
                }
                break;
            default:
                this.f3321.getClass();
                int iM7956 = c3493.m7956();
                int i11 = iM7956 & 8;
                boolean z4 = this.f3327;
                if (i11 == 8) {
                    if (z4 && this.f3319 > 0) {
                        InterfaceC2154 interfaceC21544 = this.f3321;
                        interfaceC21544.getClass();
                        interfaceC21544.mo4410(this.f3328, this.f3324 ? 1 : 0, this.f3319, 0, null);
                        this.f3319 = -1;
                        this.f3328 = -9223372036854775807L;
                        this.f3327 = false;
                    }
                    this.f3327 = true;
                } else if (z4) {
                    int iM108732 = C5228.m10873(this.f3320);
                    if (i < iM108732) {
                        String str2 = AbstractC3558.f13329;
                        Locale locale2 = Locale.US;
                        ᵳʿˉ.ᵶʔᵢˊ("Received RTP packet with unexpected sequence number. Expected: " + iM108732 + "; received: " + i + ". Dropping packet.");
                        break;
                    }
                } else {
                    ᵳʿˉ.ᵶʔᵢˊ("First payload octet of the RTP packet is not the beginning of a new VP9 partition, Dropping current packet.");
                    break;
                }
                if ((iM7956 & 128) == 0 || (c3493.m7956() & 128) == 0 || c3493.m7959() >= 1) {
                    int i12 = iM7956 & 16;
                    ᵛᵾˏ.ˌᵜᵹᵩ("VP9 flexible mode is not supported.", i12 == 0);
                    if ((iM7956 & 32) != 0) {
                        c3493.m7946(1);
                        if (c3493.m7959() >= 1) {
                            if (i12 == 0) {
                                c3493.m7946(1);
                            }
                        }
                    }
                    if ((iM7956 & 2) != 0) {
                        int iM79562 = c3493.m7956();
                        int i13 = (iM79562 >> 5) & 7;
                        if ((iM79562 & 16) != 0) {
                            int i14 = i13 + 1;
                            if (c3493.m7959() >= i14 * 4) {
                                for (int i15 = 0; i15 < i14; i15++) {
                                    this.f3322 = c3493.m7972();
                                    this.f3326 = c3493.m7972();
                                }
                            }
                        }
                        if ((iM79562 & 8) != 0) {
                            int iM79563 = c3493.m7956();
                            if (c3493.m7959() >= iM79563) {
                                for (int i16 = 0; i16 < iM79563; i16++) {
                                    int iM79722 = (c3493.m7972() & 12) >> 2;
                                    if (c3493.m7959() < iM79722) {
                                        break;
                                    } else {
                                        c3493.m7946(iM79722);
                                    }
                                }
                            }
                        }
                    }
                    if (this.f3319 == -1 && this.f3327) {
                        this.f3324 = (c3493.m7968() & 4) == 0;
                    }
                    if (!this.f3318 && (i2 = this.f3322) != -1 && (i3 = this.f3326) != -1) {
                        C3446 c34462 = c2419.f9445;
                        if (i2 != c34462.f12924 || i3 != c34462.f12920) {
                            InterfaceC2154 interfaceC21545 = this.f3321;
                            C2153 c2153M78292 = c34462.m7829();
                            c2153M78292.f8501 = this.f3322;
                            c2153M78292.f8514 = this.f3326;
                            AbstractC4737.m10004(c2153M78292, interfaceC21545);
                        }
                        this.f3318 = true;
                    }
                    int iM79592 = c3493.m7959();
                    this.f3321.mo4406(iM79592, c3493);
                    int i17 = this.f3319;
                    if (i17 == -1) {
                        this.f3319 = iM79592;
                    } else {
                        this.f3319 = i17 + iM79592;
                    }
                    this.f3328 = ˁˈᵸ.ᵡᵘˎʽ(90000, this.f3317, j, this.f3329);
                    if (z) {
                        InterfaceC2154 interfaceC21546 = this.f3321;
                        interfaceC21546.getClass();
                        interfaceC21546.mo4410(this.f3328, this.f3324 ? 1 : 0, this.f3319, 0, null);
                        this.f3319 = -1;
                        this.f3328 = -9223372036854775807L;
                        this.f3327 = false;
                    }
                    this.f3320 = i;
                    break;
                }
                break;
        }
    }
}
