package defpackage;

import android.os.SystemClock;
import android.os.Trace;

/* renamed from: ˋᐧ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1486 {

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

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final C1258 f5979;

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final C2860 f5980;

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

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final ᵪᵨ f5983;

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

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

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public C3788 f5986;

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

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final C3944 f5981 = new C3944();

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final C3959 f5988 = new C3959();

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final C3959 f5977 = new C3959();

    public C1486(ᵪᵨ r3, C2057 c2057, C1258 c1258) {
        this.f5983 = r3;
        this.f5984 = c2057;
        this.f5979 = c1258;
        C2860 c2860 = new C2860();
        int iHighestOneBit = Integer.bitCount(16) != 1 ? Integer.highestOneBit(15) << 1 : 16;
        c2860.f11085 = 0;
        c2860.f11083 = -1;
        c2860.f11087 = 0;
        c2860.f11084 = new long[iHighestOneBit];
        c2860.f11086 = iHighestOneBit - 1;
        this.f5980 = c2860;
        this.f5987 = -9223372036854775807L;
        this.f5986 = C3788.f14146;
        this.f5982 = -9223372036854775807L;
        this.f5985 = -9223372036854775807L;
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final void m4413(long j, long j2) {
        final ᵪᵨ r1 = this.f5983;
        C2273 c2273 = (C2273) r1.ᵿʗᵝʽ;
        while (true) {
            C2860 c2860 = this.f5980;
            int i = c2860.f11087;
            if (i == 0) {
                return;
            }
            if (i == 0) {
                C0190.m1427();
                return;
            }
            long j3 = ((long[]) c2860.f11084)[c2860.f11085];
            Long l = (Long) this.f5977.m8756(j3);
            C2057 c2057 = this.f5984;
            if (l != null && l.longValue() != this.f5978) {
                this.f5978 = l.longValue();
                c2057.m5638(2);
            }
            long j4 = this.f5978;
            C2057 c20572 = this.f5984;
            C3944 c3944 = this.f5981;
            int iM5642 = c20572.m5642(j3, j, j2, j4, false, false, c3944);
            if (iM5642 != 5 && iM5642 != 4) {
                this.f5979.m3807(j3, c3944.f14889);
            }
            final int i2 = 0;
            if (iM5642 == 0 || iM5642 == 1) {
                this.f5982 = j3;
                boolean z = iM5642 == 0;
                long jM6995 = c2860.m6995();
                C3788 c3788 = (C3788) this.f5988.m8756(jM6995);
                if (c3788 != null && !c3788.equals(C3788.f14146) && !c3788.equals(this.f5986)) {
                    this.f5986 = c3788;
                    C2153 c2153 = new C2153();
                    c2153.f8501 = c3788.f14148;
                    c2153.f8514 = c3788.f14149;
                    c2153.f8516 = AbstractC2924.m7101("video/raw");
                    r1.ᵢˇᵭ = new C3446(c2153);
                    c2273.f8884.execute(new RunnableC0421(r1, 23, c3788));
                }
                long jNanoTime = z ? System.nanoTime() : c3944.f14890;
                i = c2057.f8209 == 3 ? 0 : 1;
                c2057.f8209 = 3;
                c2057.f8210.getClass();
                c2057.f8211 = AbstractC3558.m8133(SystemClock.elapsedRealtime());
                if (i != 0 && c2273.f8880 != null) {
                    c2273.f8884.execute(new Runnable() { // from class: ʿᵠᵟ
                        @Override // java.lang.Runnable
                        public final void run() {
                            int i3 = i2;
                            ᵪᵨ r12 = r1;
                            switch (i3) {
                                case 0:
                                    ((C2273) r12.ᵿʗᵝʽ).f8888.m9272();
                                    break;
                                default:
                                    ((C2273) r12.ᵿʗᵝʽ).f8888.m9270();
                                    break;
                            }
                        }
                    });
                }
                C3446 c3446 = (C3446) r1.ᵢˇᵭ;
                c2273.f8887.mo3132(jM6995, jNanoTime, c3446 == null ? new C3446(new C2153()) : c3446, null);
                C5149 c5149 = (C5149) c2273.f8889.remove();
                c5149.f19165.ˁᵳˉ(c5149.f19166, c5149.f19167, jNanoTime);
            } else if (iM5642 == 2 || iM5642 == 3) {
                this.f5982 = j3;
                c2860.m6995();
                c2273.f8884.execute(new Runnable() { // from class: ʿᵠᵟ
                    @Override // java.lang.Runnable
                    public final void run() {
                        int i3 = i;
                        ᵪᵨ r12 = r1;
                        switch (i3) {
                            case 0:
                                ((C2273) r12.ᵿʗᵝʽ).f8888.m9272();
                                break;
                            default:
                                ((C2273) r12.ᵿʗᵝʽ).f8888.m9270();
                                break;
                        }
                    }
                });
                C5149 c51492 = (C5149) c2273.f8889.remove();
                ᵞᵞᵧ r4 = c51492.f19165;
                InterfaceC4316 interfaceC4316 = c51492.f19166;
                int i3 = c51492.f19167;
                Trace.beginSection("dropVideoBuffer");
                interfaceC4316.mo5745(i3);
                Trace.endSection();
                r4.ᵠᵳ(0, 1);
            } else {
                if (iM5642 != 4) {
                    if (iM5642 == 5) {
                        return;
                    }
                    ᵹˉᵞ.ᵳٴᵶ(String.valueOf(iM5642));
                    return;
                }
                this.f5982 = j3;
            }
        }
    }
}
