package defpackage;

import android.os.Handler;
import android.os.SystemClock;
import android.os.Trace;
import android.view.Surface;
import androidx.media3.decoder.DecoderException;
import androidx.media3.exoplayer.ExoPlaybackException;

/* JADX INFO: renamed from: ːⁱ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C2013 extends AbstractC0799 {

    /* JADX INFO: renamed from: ʽᵡᵢᵾ, reason: contains not printable characters */
    public final C0760 f7955;

    /* JADX INFO: renamed from: ʿᵿʽᵞ, reason: contains not printable characters */
    public int f7956;

    /* JADX INFO: renamed from: ˀᵗ, reason: contains not printable characters */
    public InterfaceC0594 f7957;

    /* JADX INFO: renamed from: ˁʢᵛ, reason: contains not printable characters */
    public Surface f7958;

    /* JADX INFO: renamed from: ˁᵺˈ, reason: contains not printable characters */
    public int f7959;

    /* JADX INFO: renamed from: ˈⁱᵡ, reason: contains not printable characters */
    public final C3008 f7960;

    /* JADX INFO: renamed from: ˉˆᵗ, reason: contains not printable characters */
    public long f7961;

    /* JADX INFO: renamed from: ˊˌˊ, reason: contains not printable characters */
    public Object f7962;

    /* JADX INFO: renamed from: ˋʿᐧ, reason: contains not printable characters */
    public C2763 f7963;

    /* JADX INFO: renamed from: ˋᵯᵩ, reason: contains not printable characters */
    public C2537 f7964;

    /* JADX INFO: renamed from: ˏᵩʨ, reason: contains not printable characters */
    public InterfaceC4417 f7965;

    /* JADX INFO: renamed from: ˑʢ, reason: contains not printable characters */
    public final ʽᵺᴵ f7966;

    /* JADX INFO: renamed from: ᵛˀˊ, reason: contains not printable characters */
    public InterfaceC4417 f7967;

    /* JADX INFO: renamed from: ᵞᵛᵘ, reason: contains not printable characters */
    public int f7968;

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

    /* JADX INFO: renamed from: ᵡᵶᵬʤ, reason: contains not printable characters */
    public boolean f7970;

    /* JADX INFO: renamed from: ᵨˈʼﹶ, reason: contains not printable characters */
    public C5286 f7971;

    /* JADX INFO: renamed from: ᵵᵬᵽ, reason: contains not printable characters */
    public final long f7972;

    public C2013(long j, Handler handler, InterfaceC3605 interfaceC3605, int i) {
        super(2);
        this.f7972 = j;
        this.f7969 = -9223372036854775807L;
        this.f7955 = new C0760();
        this.f7960 = new C3008(0, 0);
        this.f7966 = new ʽᵺᴵ(handler, interfaceC3605);
        this.f7968 = -1;
        this.f7956 = 0;
        this.f7964 = new C2537();
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ˈᵲᵢ */
    public final int mo376(C5286 c5286) {
        return AbstractC2704.m6526(0, 0, 0, 0);
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ˉᵲ */
    public final void mo377() {
        this.f7959 = 0;
        this.f7961 = SystemClock.elapsedRealtime();
        SystemClock.elapsedRealtime();
        String str = AbstractC0956.f4222;
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ˊᵨᵧ */
    public final void mo380(C5286[] c5286Arr, long j, long j2, C4100 c4100) {
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ˋˈ */
    public final void mo383() {
        ʽᵺᴵ r0 = this.f7966;
        this.f7971 = null;
        this.f7963 = null;
        this.f7956 = Math.min(this.f7956, 0);
        try {
            AbstractC3589.m8104(this.f7967, null);
            this.f7967 = null;
            AbstractC3589.m8104(this.f7965, null);
            this.f7965 = null;
        } finally {
            r0.ᵮᵣᵗˈ(this.f7964);
        }
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ˏːˆ */
    public final void mo385() {
        this.f7969 = -9223372036854775807L;
        if (this.f7959 > 0) {
            long jElapsedRealtime = SystemClock.elapsedRealtime();
            long j = jElapsedRealtime - this.f7961;
            int i = this.f7959;
            ʽᵺᴵ r5 = this.f7966;
            Handler handler = (Handler) r5.ᵜᵪʾ;
            if (handler != null) {
                handler.post(new RunnableC3757(r5, i, j));
            }
            this.f7959 = 0;
            this.f7961 = jElapsedRealtime;
        }
    }

    @Override // defpackage.AbstractC0799, defpackage.InterfaceC1896
    /* JADX INFO: renamed from: ːˏᵟᵯ */
    public final void mo386(int i, Object obj) {
        Object obj2;
        Handler handler;
        if (i != 1) {
            if (i == 7) {
                return;
            }
            return;
        }
        if (obj instanceof Surface) {
            this.f7958 = (Surface) obj;
            this.f7957 = null;
            this.f7968 = 1;
        } else if (obj instanceof InterfaceC0594) {
            this.f7958 = null;
            this.f7957 = (InterfaceC0594) obj;
            this.f7968 = 0;
        } else {
            this.f7958 = null;
            this.f7957 = null;
            this.f7968 = -1;
            obj = null;
        }
        Object obj3 = this.f7962;
        ʽᵺᴵ r2 = this.f7966;
        if (obj3 == obj) {
            if (obj != null) {
                C2763 c2763 = this.f7963;
                if (c2763 != null) {
                    r2.ˊᵙᵾᵲ(c2763);
                }
                if (this.f7956 != 3 || (obj2 = this.f7962) == null || (handler = (Handler) r2.ᵜᵪʾ) == null) {
                    return;
                }
                handler.post(new RunnableC5383(r2, obj2, SystemClock.elapsedRealtime()));
                return;
            }
            return;
        }
        this.f7962 = obj;
        if (obj == null) {
            this.f7963 = null;
            this.f7956 = Math.min(this.f7956, 1);
            return;
        }
        C2763 c27632 = this.f7963;
        if (c27632 != null) {
            r2.ˊᵙᵾᵲ(c27632);
        }
        this.f7956 = Math.min(this.f7956, 1);
        if (this.f3588 == 2) {
            long j = this.f7972;
            this.f7969 = j > 0 ? SystemClock.elapsedRealtime() + j : -9223372036854775807L;
        }
    }

    /* JADX INFO: renamed from: ˑˊᵲ, reason: contains not printable characters */
    public final void m5391() throws ExoPlaybackException {
        InterfaceC4417 interfaceC4417 = this.f7967;
        AbstractC3589.m8104(this.f7965, interfaceC4417);
        this.f7965 = interfaceC4417;
        if (interfaceC4417 != null && interfaceC4417.mo4234() == null && this.f7965.mo4238() == null) {
            return;
        }
        try {
            SystemClock.elapsedRealtime();
            this.f7971.getClass();
            Trace.beginSection("createFfmpegVideoDecoder");
            Trace.endSection();
            throw null;
        } catch (DecoderException e) {
            ˋˀᵧ.ˋˈ("Video codec error", e);
            ʽᵺᴵ r3 = this.f7966;
            Handler handler = (Handler) r3.ᵜᵪʾ;
            if (handler != null) {
                handler.post(new RunnableC3757(r3, e, 1));
            }
            throw m2900(e, this.f7971, false, 4001);
        } catch (OutOfMemoryError e2) {
            throw m2900(e2, this.f7971, false, 4001);
        }
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵔᵖᵹᵫ */
    public final void mo388(long j, long j2) throws ExoPlaybackException {
        if (this.f7970) {
            return;
        }
        if (this.f7971 == null) {
            ˊˊᵞᵽ r3 = this.f3590;
            r3.ᵻˈᵦʼ();
            C3008 c3008 = this.f7960;
            c3008.mo7091();
            int iM2893 = m2893(r3, c3008, 2);
            if (iM2893 != -5) {
                if (iM2893 == -4) {
                    ᵻᵪ.ˌᴵ(c3008.m6278(4));
                    this.f7970 = true;
                    return;
                }
                return;
            }
            C5286 c5286 = (C5286) r3.ᵔᵖᵹᵫ;
            c5286.getClass();
            InterfaceC4417 interfaceC4417 = (InterfaceC4417) r3.ᵜᵪʾ;
            AbstractC3589.m8104(this.f7967, interfaceC4417);
            this.f7967 = interfaceC4417;
            this.f7971 = c5286;
            m5391();
            C5286 c52862 = this.f7971;
            c52862.getClass();
            ʽᵺᴵ r4 = this.f7966;
            Handler handler = (Handler) r4.ᵜᵪʾ;
            if (handler != null) {
                handler.post(new RunnableC2093(r4, c52862, null, 24));
            }
        }
        m5391();
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵝᵶ */
    public final boolean mo389() {
        boolean zMo1985;
        if (this.f7971 != null) {
            if (m2899()) {
                zMo1985 = this.f3582;
            } else {
                InterfaceC4833 interfaceC4833 = this.f3597;
                interfaceC4833.getClass();
                zMo1985 = interfaceC4833.mo1985();
            }
            if (zMo1985 && (this.f7956 == 3 || this.f7968 == -1)) {
                this.f7969 = -9223372036854775807L;
                return true;
            }
        }
        if (this.f7969 == -9223372036854775807L) {
            return false;
        }
        if (SystemClock.elapsedRealtime() < this.f7969) {
            return true;
        }
        this.f7969 = -9223372036854775807L;
        return false;
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵟᵹᵙ */
    public final void mo390(long j, boolean z, boolean z2) {
        this.f7970 = false;
        this.f7956 = Math.min(this.f7956, 1);
        if (z) {
            long j2 = this.f7972;
            this.f7969 = j2 > 0 ? SystemClock.elapsedRealtime() + j2 : -9223372036854775807L;
        } else {
            this.f7969 = -9223372036854775807L;
        }
        C0760 c0760 = this.f7955;
        c0760.m2726();
        c0760.m2723();
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵨᵣ */
    public final void mo2894() {
        if (this.f7956 == 0) {
            this.f7956 = 1;
        }
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵪᵹᵥᵻ */
    public final void mo392(boolean z, boolean z2) {
        C2537 c2537 = new C2537();
        this.f7964 = c2537;
        ʽᵺᴵ r0 = this.f7966;
        Handler handler = (Handler) r0.ᵜᵪʾ;
        if (handler != null) {
            handler.post(new RunnableC3757(r0, c2537, 5));
        }
        this.f7956 = z2 ? 1 : 0;
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵮᵣᵗˈ */
    public final boolean mo393() {
        return this.f7970;
    }

    @Override // defpackage.AbstractC0799
    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public final String mo394() {
        return "ExperimentalFfmpegVideoRenderer";
    }
}
