LINE.apk(点击下载) / l22.java


package uc;

import ai.clova.cic.clientlib.exoplayer2.C;
import android.annotation.TargetApi;
import android.media.MediaCodec;
import android.media.MediaCrypto;
import android.media.MediaCryptoException;
import android.media.MediaFormat;
import android.os.Bundle;
import android.os.SystemClock;
import android.view.Surface;
import com.google.android.exoplayer.text.eia608.ClosedCaptionCtrl;
import dz.a;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import kotlin.UByte;

public abstract class l22 extends h2 {

    /* renamed from: c4  reason: collision with root package name */
    public static final byte[] f158332c4 = {0, 0, 1, 103, 66, -64, 11, -38, ClosedCaptionCtrl.ROLL_UP_CAPTIONS_2_ROWS, -112, 0, 0, 1, 104, -50, 15, 19, ClosedCaptionCtrl.RESUME_CAPTION_LOADING, 0, 0, 1, 101, -120, -124, 13, -50, 113, 24, -96, 0, ClosedCaptionCtrl.END_OF_CAPTION, -65, ClosedCaptionCtrl.MISC_CHAN_2, 49, -61, ClosedCaptionCtrl.ROLL_UP_CAPTIONS_4_ROWS, 93, 120};
    public long A;
    public float B;
    public float C;
    public p3 D;
    public MediaFormat E;
    public boolean F;
    public float G;
    public boolean G3;
    public ArrayDeque<c12> H;
    public boolean H3;
    public v12 I;
    public boolean I3;
    public c12 J;
    public boolean J3;
    public int K;
    public int K3;
    public boolean L;
    public int L3;
    public boolean M;
    public int M3;
    public boolean N;
    public boolean N3;
    public boolean O;
    public boolean O3;
    public boolean P;
    public boolean P3;
    public boolean Q;
    public long Q3;
    public boolean R;
    public long R3;
    public boolean S;
    public boolean S3;
    public boolean T;
    public boolean T3;
    public boolean U;
    public boolean U3;
    public ky1 V;
    public boolean V1;
    public boolean V2;
    public ei V3;
    public long W;
    public long W3;
    public int X;
    public long X3;
    public int Y;
    public int Y3;
    public ByteBuffer Z;
    public ig2 Z3;

    /* renamed from: a4  reason: collision with root package name */
    public v00 f158333a4;

    /* renamed from: b4  reason: collision with root package name */
    public v00 f158334b4;

    /* renamed from: m  reason: collision with root package name */
    public final m42 f158335m;

    /* renamed from: n  reason: collision with root package name */
    public final float f158336n;

    /* renamed from: o  reason: collision with root package name */
    public final y2 f158337o = new y2(0, 0);

    /* renamed from: p  reason: collision with root package name */
    public final y2 f158338p = new y2(0, 0);

    /* renamed from: q  reason: collision with root package name */
    public final y2 f158339q = new y2(2, 0);

    /* renamed from: r  reason: collision with root package name */
    public final rx1 f158340r;

    /* renamed from: s  reason: collision with root package name */
    public final a8<p3> f158341s;

    /* renamed from: t  reason: collision with root package name */
    public final ArrayList<Long> f158342t;

    /* renamed from: u  reason: collision with root package name */
    public final MediaCodec.BufferInfo f158343u;

    /* renamed from: v  reason: collision with root package name */
    public final long[] f158344v;

    /* renamed from: w  reason: collision with root package name */
    public final long[] f158345w;

    /* renamed from: x  reason: collision with root package name */
    public final long[] f158346x;

    /* renamed from: y  reason: collision with root package name */
    public p3 f158347y;

    /* renamed from: z  reason: collision with root package name */
    public p3 f158348z;

    public l22(int i14, jz1 jz12, m42 m422, float f14) {
        super(i14);
        Objects.requireNonNull(m422);
        this.f158335m = m422;
        this.f158336n = f14;
        rx1 rx12 = new rx1();
        this.f158340r = rx12;
        this.f158341s = new a8<>();
        this.f158342t = new ArrayList<>();
        this.f158343u = new MediaCodec.BufferInfo();
        this.B = 1.0f;
        this.C = 1.0f;
        this.A = C.TIME_UNSET;
        this.f158344v = new long[10];
        this.f158345w = new long[10];
        this.f158346x = new long[10];
        this.W3 = C.TIME_UNSET;
        this.X3 = C.TIME_UNSET;
        rx12.e(0);
        rx12.f163838c.order(ByteOrder.nativeOrder());
        this.G = -1.0f;
        this.K = 0;
        this.K3 = 0;
        this.X = -1;
        this.Y = -1;
        this.W = C.TIME_UNSET;
        this.Q3 = C.TIME_UNSET;
        this.R3 = C.TIME_UNSET;
        this.L3 = 0;
        this.M3 = 0;
    }

    private final void b0() {
        this.I3 = false;
        this.f158340r.a();
        this.f158339q.a();
        this.H3 = false;
        this.G3 = false;
    }

    private final void h0() {
        try {
            this.Z3.f157315a.flush();
        } finally {
            V();
        }
    }

    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r6v4 */
    /* JADX WARN: Type inference failed for: r6v5, types: [int] */
    /* JADX WARNING: Can't wrap try/catch for region: R(6:222|223|224|225|226|229) */
    /* JADX WARNING: Code restructure failed: missing block: B:211:0x02e0, code lost:
        if (r1.f158348z != null) goto L_0x02e2;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:230:?, code lost:
        f0();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:231:0x0339, code lost:
        r15 = r24;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:234:0x033d, code lost:
        if (r15.T3 != false) goto L_0x033f;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:235:0x033f, code lost:
        T();
     */
    /* JADX WARNING: Code restructure failed: missing block: B:236:0x0342, code lost:
        r2 = r15;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:237:0x0343, code lost:
        r4 = r22;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:238:0x0347, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:239:0x0349, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:240:0x034a, code lost:
        r15 = r24;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:265:0x03af, code lost:
        r15 = r2;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:315:0x042e, code lost:
        if (r5[r18].getClassName().equals("android.media.MediaCodec") != false) goto L_0x0430;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:40:0x0091, code lost:
        r14 = true;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:42:?, code lost:
        r1.T3 = true;
        r13 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:67:0x00f3, code lost:
        r11 = false;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:88:0x014c, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:89:0x014d, code lost:
        r13 = false;
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Missing exception handler attribute for start block: B:229:0x0336 */
    /* JADX WARNING: Removed duplicated region for block: B:259:0x039b A[LOOP:2: B:102:0x0171->B:259:0x039b, LOOP_END] */
    /* JADX WARNING: Removed duplicated region for block: B:269:0x03b6 A[Catch:{ IllegalStateException -> 0x03c1 }] */
    /* JADX WARNING: Removed duplicated region for block: B:296:0x03fb A[Catch:{ IllegalStateException -> 0x03fd }, DONT_GENERATE] */
    /* JADX WARNING: Removed duplicated region for block: B:314:0x0422  */
    /* JADX WARNING: Removed duplicated region for block: B:344:0x0399 A[SYNTHETIC] */
    /* JADX WARNING: Removed duplicated region for block: B:350:0x03bc A[EDGE_INSN: B:350:0x03bc->B:271:0x03bc ?: BREAK  , SYNTHETIC] */
    @Override // uc.a5
    public final void C(long j14, long j15) throws p2 {
        boolean z14;
        boolean z15;
        IllegalStateException e14;
        boolean z16;
        StackTraceElement[] stackTrace;
        long j16;
        int i14;
        l22 l222;
        l22 l223;
        p3 p3Var;
        long j17;
        boolean z17;
        ig2 ig22;
        ByteBuffer byteBuffer;
        int i15;
        MediaCodec.BufferInfo bufferInfo;
        int i16;
        ByteBuffer byteBuffer2;
        boolean z18;
        boolean z19;
        p3 p3Var2;
        p3 b14;
        boolean z24;
        boolean z25;
        l22 l224 = this;
        boolean z26 = false;
        boolean z27 = false;
        boolean z28 = true;
        try {
            if (l224.T3) {
                P();
                return;
            }
            int i17 = 2;
            if (l224.f158347y == null) {
                if (!l224.t0(2)) {
                    return;
                }
            }
            R();
            if (l224.G3) {
                l82.b("bypassRender");
                l22 l225 = l224;
                while (true) {
                    try {
                        r52.e(l225.T3 ^ z28);
                        if (l225.f158340r.h()) {
                            rx1 rx12 = l225.f158340r;
                            try {
                            } catch (IllegalStateException e15) {
                                e14 = e15;
                                z24 = z28;
                                boolean z29 = z27 ? 1 : 0;
                                boolean z34 = z27 ? 1 : 0;
                                boolean z35 = z27 ? 1 : 0;
                                boolean z36 = z27 ? 1 : 0;
                                z14 = z29;
                                l224 = l225;
                                z15 = z24;
                                int i18 = d8.f155212a;
                                stackTrace = e14.getStackTrace();
                                if (stackTrace.length > 0) {
                                }
                                throw e14;
                            }
                            try {
                                if (!Q(j14, j15, null, rx12.f163838c, l225.Y, 0, rx12.f161614i, rx12.f163840e, rx12.b(), l225.f158340r.c(), l225.f158348z)) {
                                    l224 = this;
                                    l225 = l224;
                                    z27 = false;
                                    z24 = true;
                                    break;
                                }
                                l224 = this;
                                try {
                                    l224.a0(l224.f158340r.f161613h);
                                    l224.f158340r.a();
                                    l225 = l224;
                                } catch (IllegalStateException e16) {
                                    e14 = e16;
                                    l225 = l224;
                                    z27 = false;
                                    z24 = true;
                                    boolean z292 = z27 ? 1 : 0;
                                    boolean z342 = z27 ? 1 : 0;
                                    boolean z352 = z27 ? 1 : 0;
                                    boolean z362 = z27 ? 1 : 0;
                                    z14 = z292;
                                    l224 = l225;
                                    z15 = z24;
                                    int i182 = d8.f155212a;
                                    stackTrace = e14.getStackTrace();
                                    if (stackTrace.length > 0) {
                                    }
                                    throw e14;
                                }
                            } catch (IllegalStateException e17) {
                                e14 = e17;
                                l224 = this;
                                z14 = false;
                                z15 = true;
                                int i1822 = d8.f155212a;
                                stackTrace = e14.getStackTrace();
                                if (stackTrace.length > 0) {
                                }
                                throw e14;
                            }
                        }
                        try {
                            if (l225.S3) {
                                break;
                            }
                            z24 = true;
                            if (l225.H3) {
                                r52.e(l225.f158340r.i(l225.f158339q));
                                z27 = false;
                                z27 = false;
                                try {
                                    l225.H3 = false;
                                } catch (IllegalStateException e18) {
                                    e14 = e18;
                                    boolean z2922 = z27 ? 1 : 0;
                                    boolean z3422 = z27 ? 1 : 0;
                                    boolean z3522 = z27 ? 1 : 0;
                                    boolean z3622 = z27 ? 1 : 0;
                                    z14 = z2922;
                                    l224 = l225;
                                    z15 = z24;
                                    int i18222 = d8.f155212a;
                                    stackTrace = e14.getStackTrace();
                                    if (stackTrace.length > 0) {
                                    }
                                    throw e14;
                                }
                            } else {
                                z27 = false;
                            }
                            if (l225.I3) {
                                if (!l225.f158340r.h()) {
                                    b0();
                                    l225.I3 = z27;
                                    R();
                                    if (!l225.G3) {
                                        break;
                                    }
                                } else {
                                    z25 = false;
                                    z28 = true;
                                }
                            }
                            r52.e(!l225.S3);
                            q3 e19 = e();
                            l225.f158339q.a();
                            while (true) {
                                l225.f158339q.a();
                                y2 y2Var = l225.f158339q;
                                int i19 = z27 ? 1 : 0;
                                int i24 = z27 ? 1 : 0;
                                int i25 = z27 ? 1 : 0;
                                int i26 = z27 ? 1 : 0;
                                int i27 = z27 ? 1 : 0;
                                int i28 = z27 ? 1 : 0;
                                int i29 = l225.i(e19, y2Var, i19);
                                if (i29 != -5) {
                                    if (i29 == -4) {
                                        if (!l225.f158339q.c()) {
                                            if (l225.U3) {
                                                p3 p3Var3 = l225.f158347y;
                                                Objects.requireNonNull(p3Var3);
                                                l225.f158348z = p3Var3;
                                                z25 = false;
                                                l225.s0(p3Var3, null);
                                                l225.U3 = z27;
                                            } else {
                                                z25 = false;
                                            }
                                            l225.f158339q.f();
                                            if (!l225.f158340r.i(l225.f158339q)) {
                                                l225.H3 = true;
                                                break;
                                            }
                                        } else {
                                            l225.S3 = true;
                                            break;
                                        }
                                    } else {
                                        break;
                                    }
                                } else {
                                    z25 = false;
                                    l225.r0(e19);
                                    break;
                                }
                            }
                            if (l225.f158340r.h()) {
                                l225.f158340r.f();
                            }
                            if (!l225.f158340r.h() && !l225.S3 && !l225.I3) {
                                break;
                            }
                            z28 = true;
                        } catch (IllegalStateException e24) {
                            e14 = e24;
                            z27 = false;
                            z24 = true;
                            boolean z29222 = z27 ? 1 : 0;
                            boolean z34222 = z27 ? 1 : 0;
                            boolean z35222 = z27 ? 1 : 0;
                            boolean z36222 = z27 ? 1 : 0;
                            z14 = z29222;
                            l224 = l225;
                            z15 = z24;
                            int i182222 = d8.f155212a;
                            stackTrace = e14.getStackTrace();
                            if (stackTrace.length > 0) {
                            }
                            throw e14;
                        }
                    } catch (IllegalStateException e25) {
                        e14 = e25;
                        boolean z37 = z27 ? 1 : 0;
                        boolean z38 = z27 ? 1 : 0;
                        boolean z39 = z27 ? 1 : 0;
                        z14 = z37;
                        l224 = l225;
                        z15 = z28;
                        int i1822222 = d8.f155212a;
                        stackTrace = e14.getStackTrace();
                        if (stackTrace.length > 0) {
                        }
                        throw e14;
                    }
                }
                l82.c();
                boolean z44 = z27 ? 1 : 0;
                boolean z45 = z27 ? 1 : 0;
                boolean z46 = z27 ? 1 : 0;
                z14 = z44;
                l224 = l225;
                z15 = z24;
            } else {
                boolean z47 = true;
                p3 p3Var4 = null;
                try {
                    if (l224.Z3 != null) {
                        try {
                            long elapsedRealtime = SystemClock.elapsedRealtime();
                            l82.b("drainAndFeed");
                            l22 l226 = l224;
                            while (true) {
                                try {
                                    if (!(l226.Y >= 0 ? z47 : z26)) {
                                        if (!l226.P || !l226.O3) {
                                            i16 = l226.Z3.a(l226.f158343u);
                                        } else {
                                            try {
                                                i16 = l226.Z3.a(l226.f158343u);
                                            } catch (IllegalStateException unused) {
                                                f0();
                                                if (l226.T3) {
                                                    T();
                                                }
                                            }
                                        }
                                        if (i16 >= 0) {
                                            if (!l226.T) {
                                                MediaCodec.BufferInfo bufferInfo2 = l226.f158343u;
                                                if (bufferInfo2.size == 0 && (bufferInfo2.flags & 4) != 0) {
                                                    f0();
                                                    break;
                                                }
                                                l226.Y = i16;
                                                ig2 ig23 = l226.Z3;
                                                Objects.requireNonNull(ig23);
                                                if (d8.f155212a >= 21) {
                                                    byteBuffer2 = ig23.f157315a.getOutputBuffer(i16);
                                                } else {
                                                    byteBuffer2 = ig23.f157317c[i16];
                                                }
                                                l226.Z = byteBuffer2;
                                                if (byteBuffer2 != null) {
                                                    byteBuffer2.position(l226.f158343u.offset);
                                                    ByteBuffer byteBuffer3 = l226.Z;
                                                    MediaCodec.BufferInfo bufferInfo3 = l226.f158343u;
                                                    byteBuffer3.limit(bufferInfo3.offset + bufferInfo3.size);
                                                }
                                                if (l226.Q) {
                                                    MediaCodec.BufferInfo bufferInfo4 = l226.f158343u;
                                                    if (bufferInfo4.presentationTimeUs == 0 && (bufferInfo4.flags & 4) != 0) {
                                                        long j18 = l226.Q3;
                                                        if (j18 != C.TIME_UNSET) {
                                                            bufferInfo4.presentationTimeUs = j18;
                                                        }
                                                    }
                                                }
                                                long j19 = l226.f158343u.presentationTimeUs;
                                                int size = l226.f158342t.size();
                                                int i34 = z26;
                                                while (true) {
                                                    if (i34 >= size) {
                                                        z18 = z26;
                                                        break;
                                                    } else if (l226.f158342t.get(i34 == true ? 1 : 0).longValue() == j19) {
                                                        l226.f158342t.remove((int) i34);
                                                        z18 = z47;
                                                        break;
                                                    } else {
                                                        i34++;
                                                    }
                                                }
                                                l226.V1 = z18;
                                                long j24 = l226.R3;
                                                long j25 = l226.f158343u.presentationTimeUs;
                                                if (j24 == j25) {
                                                    boolean z48 = z47 ? 1 : 0;
                                                    boolean z49 = z47 ? 1 : 0;
                                                    boolean z54 = z47 ? 1 : 0;
                                                    z19 = z48;
                                                } else {
                                                    z19 = z26;
                                                }
                                                l226.V2 = z19;
                                                a8<p3> a8Var = l226.f158341s;
                                                synchronized (a8Var) {
                                                    p3Var2 = p3Var4;
                                                    while (true) {
                                                        if (a8Var.f154022d <= 0) {
                                                            break;
                                                        } else if (j25 - a8Var.f154019a[a8Var.f154021c] < 0) {
                                                            break;
                                                        } else {
                                                            p3Var2 = a8Var.b();
                                                        }
                                                    }
                                                }
                                                p3 p3Var5 = p3Var2;
                                                if (p3Var5 == null && l226.F) {
                                                    a8<p3> a8Var2 = l226.f158341s;
                                                    synchronized (a8Var2) {
                                                        b14 = a8Var2.f154022d == 0 ? p3Var4 : a8Var2.b();
                                                    }
                                                    p3Var5 = b14;
                                                }
                                                if (p3Var5 != null) {
                                                    l226.f158348z = p3Var5;
                                                } else if (l226.F) {
                                                }
                                                l226.s0(l226.f158348z, l226.E);
                                                l226.F = z26;
                                            } else {
                                                l226.T = z26;
                                                l226.Z3.f157315a.releaseOutputBuffer(i16, z26);
                                            }
                                        } else if (i16 == -2) {
                                            l226.P3 = z47;
                                            MediaFormat outputFormat = l226.Z3.f157315a.getOutputFormat();
                                            if (l226.K != 0 && outputFormat.getInteger("width") == 32 && outputFormat.getInteger("height") == 32) {
                                                l226.T = z47;
                                            } else {
                                                if (l226.R) {
                                                    int i35 = z47 ? 1 : 0;
                                                    int i36 = z47 ? 1 : 0;
                                                    int i37 = z47 ? 1 : 0;
                                                    outputFormat.setInteger("channel-count", i35);
                                                }
                                                l226.E = outputFormat;
                                                l226.F = z47;
                                            }
                                        } else if (l226.U && (l226.S3 || l226.L3 == i17)) {
                                            f0();
                                        }
                                        l222 = l226;
                                        j16 = elapsedRealtime;
                                        p3Var = p3Var4;
                                        i14 = i17;
                                        z14 = z26;
                                        l223 = l224;
                                        try {
                                            if (l222.u0(j16)) {
                                                l224 = l222;
                                                break;
                                            }
                                            p3Var4 = p3Var;
                                            l224 = l223;
                                            l226 = l222;
                                            elapsedRealtime = j16;
                                            i17 = i14;
                                            boolean z55 = z14 ? 1 : 0;
                                            boolean z56 = z14 ? 1 : 0;
                                            z26 = z55;
                                            z47 = true;
                                        } catch (IllegalStateException e26) {
                                            e14 = e26;
                                            l224 = l222;
                                            z15 = true;
                                            int i18222222 = d8.f155212a;
                                            stackTrace = e14.getStackTrace();
                                            if (stackTrace.length > 0) {
                                            }
                                            throw e14;
                                        }
                                    }
                                    try {
                                        if (l226.P && l226.O3) {
                                            try {
                                                ig2 ig24 = l226.Z3;
                                                ByteBuffer byteBuffer4 = l226.Z;
                                                int i38 = l226.Y;
                                                MediaCodec.BufferInfo bufferInfo5 = l226.f158343u;
                                                j17 = elapsedRealtime;
                                                i14 = i17;
                                                z14 = z26;
                                                z17 = Q(j14, j15, ig24, byteBuffer4, i38, bufferInfo5.flags, 1, bufferInfo5.presentationTimeUs, l226.V1, l226.V2, l226.f158348z);
                                            } catch (IllegalStateException unused2) {
                                                j17 = elapsedRealtime;
                                                z14 = z26;
                                            }
                                            break;
                                        }
                                        j17 = elapsedRealtime;
                                        i14 = i17;
                                        z14 = z26;
                                        try {
                                            ig22 = l226.Z3;
                                            byteBuffer = l226.Z;
                                            i15 = l226.Y;
                                            bufferInfo = l226.f158343u;
                                        } catch (IllegalStateException e27) {
                                            e14 = e27;
                                            l224 = l226;
                                            z15 = true;
                                            int i182222222 = d8.f155212a;
                                            stackTrace = e14.getStackTrace();
                                            if (stackTrace.length > 0) {
                                            }
                                            throw e14;
                                        }
                                        try {
                                            z17 = Q(j14, j15, ig22, byteBuffer, i15, bufferInfo.flags, 1, bufferInfo.presentationTimeUs, l226.V1, l226.V2, l226.f158348z);
                                            if (!z17) {
                                                l223 = this;
                                                break;
                                            }
                                            l223 = this;
                                            try {
                                                l223.a0(l223.f158343u.presentationTimeUs);
                                                int i39 = l223.f158343u.flags;
                                                l223.Y = -1;
                                                p3Var = null;
                                                l223.Z = null;
                                                if ((i39 & 4) != 0) {
                                                    f0();
                                                    break;
                                                }
                                                l222 = l223;
                                                j16 = j17;
                                                if (l222.u0(j16)) {
                                                }
                                            } catch (IllegalStateException e28) {
                                                e14 = e28;
                                                l224 = l223;
                                                z15 = true;
                                                int i1822222222 = d8.f155212a;
                                                stackTrace = e14.getStackTrace();
                                                if (stackTrace.length > 0) {
                                                }
                                                throw e14;
                                            }
                                        } catch (IllegalStateException e29) {
                                            e14 = e29;
                                            l223 = this;
                                            l224 = l223;
                                            z15 = true;
                                            int i18222222222 = d8.f155212a;
                                            stackTrace = e14.getStackTrace();
                                            if (stackTrace.length > 0) {
                                            }
                                            throw e14;
                                        }
                                    } catch (IllegalStateException e34) {
                                        e14 = e34;
                                        z14 = z26;
                                        l224 = l226;
                                        z15 = true;
                                        int i182222222222 = d8.f155212a;
                                        stackTrace = e14.getStackTrace();
                                        if (stackTrace.length > 0) {
                                        }
                                        throw e14;
                                    }
                                } catch (IllegalStateException e35) {
                                    e14 = e35;
                                    z14 = z26;
                                    l224 = l226;
                                    z15 = true;
                                    int i1822222222222 = d8.f155212a;
                                    stackTrace = e14.getStackTrace();
                                    if (stackTrace.length > 0) {
                                    }
                                    throw e14;
                                }
                            }
                            j16 = elapsedRealtime;
                            z14 = z26;
                            l224 = l226;
                            do {
                                try {
                                    if (g0()) {
                                        break;
                                    }
                                } catch (IllegalStateException e36) {
                                    e14 = e36;
                                    z15 = true;
                                    int i18222222222222 = d8.f155212a;
                                    stackTrace = e14.getStackTrace();
                                    if (stackTrace.length > 0) {
                                    }
                                    throw e14;
                                }
                            } while (l224.u0(j16));
                            l82.c();
                            z15 = true;
                        } catch (IllegalStateException e37) {
                            e14 = e37;
                            z14 = false;
                            z15 = true;
                            int i182222222222222 = d8.f155212a;
                            if (i182222222222222 < 21 || !(e14 instanceof MediaCodec.CodecException)) {
                                stackTrace = e14.getStackTrace();
                                if (stackTrace.length > 0) {
                                    char c14 = z14 ? 1 : 0;
                                    char c15 = z14 ? 1 : 0;
                                    char c16 = z14 ? 1 : 0;
                                    char c17 = z14 ? 1 : 0;
                                    char c18 = z14 ? 1 : 0;
                                    char c19 = z14 ? 1 : 0;
                                    char c24 = z14 ? 1 : 0;
                                    char c25 = z14 ? 1 : 0;
                                    char c26 = z14 ? 1 : 0;
                                    char c27 = z14 ? 1 : 0;
                                    char c28 = z14 ? 1 : 0;
                                    char c29 = z14 ? 1 : 0;
                                    char c34 = z14 ? 1 : 0;
                                    char c35 = z14 ? 1 : 0;
                                    char c36 = z14 ? 1 : 0;
                                    char c37 = z14 ? 1 : 0;
                                    char c38 = z14 ? 1 : 0;
                                    char c39 = z14 ? 1 : 0;
                                    char c44 = z14 ? 1 : 0;
                                    char c45 = z14 ? 1 : 0;
                                    char c46 = z14 ? 1 : 0;
                                    char c47 = z14 ? 1 : 0;
                                    char c48 = z14 ? 1 : 0;
                                    char c49 = z14 ? 1 : 0;
                                    char c54 = z14 ? 1 : 0;
                                    char c55 = z14 ? 1 : 0;
                                }
                                throw e14;
                            }
                            l224.q0(e14);
                            if (i182222222222222 < 21 || !(e14 instanceof MediaCodec.CodecException) || !((MediaCodec.CodecException) e14).isRecoverable()) {
                                boolean z57 = z14 ? 1 : 0;
                                boolean z58 = z14 ? 1 : 0;
                                boolean z59 = z14 ? 1 : 0;
                                boolean z64 = z14 ? 1 : 0;
                                boolean z65 = z14 ? 1 : 0;
                                boolean z66 = z14 ? 1 : 0;
                                boolean z67 = z14 ? 1 : 0;
                                boolean z68 = z14 ? 1 : 0;
                                boolean z69 = z14 ? 1 : 0;
                                boolean z74 = z14 ? 1 : 0;
                                boolean z75 = z14 ? 1 : 0;
                                boolean z76 = z14 ? 1 : 0;
                                boolean z77 = z14 ? 1 : 0;
                                boolean z78 = z14 ? 1 : 0;
                                boolean z79 = z14 ? 1 : 0;
                                boolean z84 = z14 ? 1 : 0;
                                boolean z85 = z14 ? 1 : 0;
                                boolean z86 = z14 ? 1 : 0;
                                boolean z87 = z14 ? 1 : 0;
                                boolean z88 = z14 ? 1 : 0;
                                boolean z89 = z14 ? 1 : 0;
                                boolean z94 = z14 ? 1 : 0;
                                boolean z95 = z14 ? 1 : 0;
                                boolean z96 = z14 ? 1 : 0;
                                z16 = z57;
                            } else {
                                z16 = z15;
                            }
                            if (z16) {
                                T();
                            }
                            throw l224.f(l224.Y(e14, l224.J), l224.f158347y, z16, 4003);
                        }
                    } else {
                        z14 = false;
                        try {
                            ei eiVar = l224.V3;
                            int i44 = eiVar.f155796d;
                            am2 am22 = l224.f156709g;
                            Objects.requireNonNull(am22);
                            eiVar.f155796d = i44 + am22.a(j14 - l224.f156711i);
                            z15 = true;
                        } catch (IllegalStateException e38) {
                            e14 = e38;
                            z15 = true;
                            l224 = l224;
                            int i1822222222222222 = d8.f155212a;
                            stackTrace = e14.getStackTrace();
                            if (stackTrace.length > 0) {
                            }
                            throw e14;
                        }
                        try {
                            l224.t0(1);
                            l224 = l224;
                        } catch (IllegalStateException e39) {
                            e14 = e39;
                            l224 = l224;
                            int i18222222222222222 = d8.f155212a;
                            stackTrace = e14.getStackTrace();
                            if (stackTrace.length > 0) {
                            }
                            throw e14;
                        }
                    }
                } catch (IllegalStateException e44) {
                    e14 = e44;
                    z14 = false;
                    z15 = true;
                    int i182222222222222222 = d8.f155212a;
                    stackTrace = e14.getStackTrace();
                    if (stackTrace.length > 0) {
                    }
                    throw e14;
                }
            }
            try {
                synchronized (l224.V3) {
                }
            } catch (IllegalStateException e45) {
                e14 = e45;
                int i1822222222222222222 = d8.f155212a;
                stackTrace = e14.getStackTrace();
                if (stackTrace.length > 0) {
                }
                throw e14;
            }
        } catch (IllegalStateException e46) {
            e14 = e46;
            z15 = true;
            z14 = false;
            int i18222222222222222222 = d8.f155212a;
            stackTrace = e14.getStackTrace();
            if (stackTrace.length > 0) {
            }
            throw e14;
        }
    }

    public final void J() {
        this.X = -1;
        this.f158338p.f163838c = null;
    }

    public abstract void K(y2 y2Var) throws p2;

    public abstract void M();

    public void P() throws p2 {
    }

    public abstract boolean Q(long j14, long j15, ig2 ig22, ByteBuffer byteBuffer, int i14, int i15, int i16, long j16, boolean z14, boolean z15, p3 p3Var) throws p2;

    /* JADX DEBUG: Multi-variable search result rejected for r23v0, resolved type: uc.l22 */
    /* JADX DEBUG: Multi-variable search result rejected for r10v5, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r10v7, resolved type: boolean */
    /* JADX DEBUG: Multi-variable search result rejected for r10v12, resolved type: boolean */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARN: Type inference failed for: r10v0 */
    /* JADX WARN: Type inference failed for: r10v1, types: [android.media.MediaCrypto, java.util.ArrayDeque<uc.c12>] */
    /* JADX WARN: Type inference failed for: r10v2 */
    /* JADX WARNING: Code restructure failed: missing block: B:136:0x023c, code lost:
        if ("stvm8".equals(r6) == false) goto L_0x0250;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:140:0x024c, code lost:
        if ("OMX.amlogic.avc.decoder.awesome.secure".equals(r2) == false) goto L_0x0250;
     */
    /* JADX WARNING: Removed duplicated region for block: B:100:0x01c2  */
    /* JADX WARNING: Removed duplicated region for block: B:108:0x01dd A[ADDED_TO_REGION] */
    /* JADX WARNING: Removed duplicated region for block: B:124:0x0213  */
    /* JADX WARNING: Removed duplicated region for block: B:133:0x022c  */
    /* JADX WARNING: Removed duplicated region for block: B:145:0x0255  */
    /* JADX WARNING: Removed duplicated region for block: B:171:0x02b1  */
    /* JADX WARNING: Removed duplicated region for block: B:179:0x02c8  */
    /* JADX WARNING: Removed duplicated region for block: B:200:0x0315  */
    /* JADX WARNING: Removed duplicated region for block: B:203:0x0321  */
    /* JADX WARNING: Removed duplicated region for block: B:209:0x0344  */
    /* JADX WARNING: Unknown variable types count: 1 */
    public final void R() throws p2 {
        p3 p3Var;
        float f14;
        String str;
        MediaCodec mediaCodec;
        Throwable e14;
        String str2;
        int i14;
        boolean z14;
        boolean z15;
        if (this.Z3 == null && !this.G3 && (p3Var = this.f158347y) != null) {
            if (this.f158334b4 != null || !k0(p3Var)) {
                v00 v002 = this.f158334b4;
                this.f158333a4 = v002;
                p3 p3Var2 = this.f158347y;
                String str3 = p3Var2.f160229k;
                int i15 = 0;
                if (v002 == null || !fw1.f156339a) {
                    try {
                        ?? r102 = 0;
                        if (this.H == null) {
                            try {
                                List<c12> j04 = j0(this.f158335m, p3Var2, false);
                                j04.isEmpty();
                                this.H = new ArrayDeque<>();
                                if (!j04.isEmpty()) {
                                    this.H.add(j04.get(0));
                                }
                                this.I = null;
                            } catch (q92 e15) {
                                throw new v12(this.f158347y, (Throwable) e15, false, -49998);
                            }
                        }
                        if (!this.H.isEmpty()) {
                            while (this.Z3 == null) {
                                c12 peekFirst = this.H.peekFirst();
                                if (S(peekFirst)) {
                                    try {
                                        String str4 = peekFirst.f154652a;
                                        int i16 = d8.f155212a;
                                        float f15 = -1.0f;
                                        if (i16 < 23) {
                                            f14 = -1.0f;
                                        } else {
                                            float f16 = this.C;
                                            p3 p3Var3 = this.f158347y;
                                            p3[] p3VarArr = this.f156710h;
                                            Objects.requireNonNull(p3VarArr);
                                            f14 = n0(f16, p3Var3, p3VarArr);
                                        }
                                        if (f14 > this.f158336n) {
                                            f15 = f14;
                                        }
                                        long elapsedRealtime = SystemClock.elapsedRealtime();
                                        String valueOf = String.valueOf(str4);
                                        if (valueOf.length() != 0) {
                                            str = "createCodec:".concat(valueOf);
                                        } else {
                                            str = new String("createCodec:");
                                        }
                                        l82.b(str);
                                        kg0 l04 = l0(peekFirst, this.f158347y, r102, f15);
                                        try {
                                            c12 c122 = (c12) l04.f158145a;
                                            Objects.requireNonNull(c122);
                                            String str5 = c122.f154652a;
                                            String valueOf2 = String.valueOf(str5);
                                            if (valueOf2.length() != 0) {
                                                str2 = "createCodec:".concat(valueOf2);
                                            } else {
                                                str2 = new String("createCodec:");
                                            }
                                            l82.b(str2);
                                            MediaCodec createByCodecName = MediaCodec.createByCodecName(str5);
                                            l82.c();
                                            try {
                                                l82.b("configureCodec");
                                                createByCodecName.configure((MediaFormat) l04.f158146b, (Surface) l04.f158148d, (MediaCrypto) r102, i15);
                                                l82.c();
                                                l82.b("startCodec");
                                                createByCodecName.start();
                                                l82.c();
                                                ig2 ig22 = new ig2(createByCodecName);
                                                long elapsedRealtime2 = SystemClock.elapsedRealtime();
                                                this.Z3 = ig22;
                                                this.J = peekFirst;
                                                this.G = f15;
                                                this.D = this.f158347y;
                                                if (i16 <= 25 && "OMX.Exynos.avc.dec.secure".equals(str4)) {
                                                    String str6 = d8.f155215d;
                                                    if (str6.startsWith("SM-T585") || str6.startsWith("SM-A510") || str6.startsWith("SM-A520") || str6.startsWith("SM-J700")) {
                                                        i14 = 2;
                                                        this.K = i14;
                                                        this.L = (i16 < 21 || !this.D.f160231m.isEmpty() || !"OMX.MTK.VIDEO.DECODER.AVC".equals(str4)) ? i15 : 1;
                                                        this.M = i16 >= 18 || (i16 == 18 && ("OMX.SEC.avc.dec".equals(str4) || "OMX.SEC.avc.dec.secure".equals(str4))) || (i16 == 19 && d8.f155215d.startsWith("SM-G800") && ("OMX.Exynos.avc.dec".equals(str4) || "OMX.Exynos.avc.dec.secure".equals(str4)));
                                                        this.N = i16 != 29 && "c2.android.aac.decoder".equals(str4);
                                                        if (i16 > 23 || !"OMX.google.vorbis.decoder".equals(str4)) {
                                                            if (i16 <= 19) {
                                                                String str7 = d8.f155213b;
                                                                if (!"hb2000".equals(str7)) {
                                                                }
                                                                if (!"OMX.amlogic.avc.decoder.awesome".equals(str4)) {
                                                                }
                                                            }
                                                            z14 = false;
                                                            this.O = z14;
                                                            this.P = i16 != 21 && "OMX.google.aac.decoder".equals(str4);
                                                            if (i16 < 21 && "OMX.SEC.mp3.dec".equals(str4) && "samsung".equals(d8.f155214c)) {
                                                                String str8 = d8.f155213b;
                                                                if (str8.startsWith("baffin") || str8.startsWith("grand") || str8.startsWith("fortuna") || str8.startsWith("gprimelte") || str8.startsWith("j2y18lte") || str8.startsWith("ms01")) {
                                                                    z15 = true;
                                                                    this.Q = z15;
                                                                    this.R = i16 > 18 && this.D.f160242x == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str4);
                                                                    String str9 = peekFirst.f154652a;
                                                                    this.U = (i16 > 25 && "OMX.rk.video_decoder.avc".equals(str9)) || (i16 <= 17 && "OMX.allwinner.video.decoder.avc".equals(str9)) || ((i16 <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str9) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str9))) || ("Amazon".equals(d8.f155214c) && "AFTS".equals(d8.f155215d) && peekFirst.f154657f));
                                                                    if ("c2.android.mp3.decoder".equals(peekFirst.f154652a)) {
                                                                        this.V = new ky1();
                                                                    }
                                                                    if (this.f156708f == 2) {
                                                                        this.W = SystemClock.elapsedRealtime() + 1000;
                                                                    }
                                                                    this.V3.f155793a++;
                                                                    o0(str4, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime);
                                                                    i15 = 0;
                                                                    r102 = 0;
                                                                }
                                                            }
                                                            z15 = false;
                                                            this.Q = z15;
                                                            this.R = i16 > 18 && this.D.f160242x == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str4);
                                                            String str92 = peekFirst.f154652a;
                                                            this.U = (i16 > 25 && "OMX.rk.video_decoder.avc".equals(str92)) || (i16 <= 17 && "OMX.allwinner.video.decoder.avc".equals(str92)) || ((i16 <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str92) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str92))) || ("Amazon".equals(d8.f155214c) && "AFTS".equals(d8.f155215d) && peekFirst.f154657f));
                                                            if ("c2.android.mp3.decoder".equals(peekFirst.f154652a)) {
                                                            }
                                                            if (this.f156708f == 2) {
                                                            }
                                                            this.V3.f155793a++;
                                                            o0(str4, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime);
                                                            i15 = 0;
                                                            r102 = 0;
                                                        }
                                                        z14 = true;
                                                        this.O = z14;
                                                        this.P = i16 != 21 && "OMX.google.aac.decoder".equals(str4);
                                                        String str82 = d8.f155213b;
                                                        z15 = true;
                                                        this.Q = z15;
                                                        this.R = i16 > 18 && this.D.f160242x == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str4);
                                                        String str922 = peekFirst.f154652a;
                                                        this.U = (i16 > 25 && "OMX.rk.video_decoder.avc".equals(str922)) || (i16 <= 17 && "OMX.allwinner.video.decoder.avc".equals(str922)) || ((i16 <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str922) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str922))) || ("Amazon".equals(d8.f155214c) && "AFTS".equals(d8.f155215d) && peekFirst.f154657f));
                                                        if ("c2.android.mp3.decoder".equals(peekFirst.f154652a)) {
                                                        }
                                                        if (this.f156708f == 2) {
                                                        }
                                                        this.V3.f155793a++;
                                                        o0(str4, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime);
                                                        i15 = 0;
                                                        r102 = 0;
                                                    }
                                                }
                                                if (i16 < 24 && ("OMX.Nvidia.h264.decode".equals(str4) || "OMX.Nvidia.h264.decode.secure".equals(str4))) {
                                                    String str10 = d8.f155213b;
                                                    if ("flounder".equals(str10) || "flounder_lte".equals(str10) || "grouper".equals(str10) || "tilapia".equals(str10)) {
                                                        i14 = 1;
                                                        this.K = i14;
                                                        this.L = (i16 < 21 || !this.D.f160231m.isEmpty() || !"OMX.MTK.VIDEO.DECODER.AVC".equals(str4)) ? i15 : 1;
                                                        this.M = i16 >= 18 || (i16 == 18 && ("OMX.SEC.avc.dec".equals(str4) || "OMX.SEC.avc.dec.secure".equals(str4))) || (i16 == 19 && d8.f155215d.startsWith("SM-G800") && ("OMX.Exynos.avc.dec".equals(str4) || "OMX.Exynos.avc.dec.secure".equals(str4)));
                                                        this.N = i16 != 29 && "c2.android.aac.decoder".equals(str4);
                                                        if (i16 <= 19) {
                                                        }
                                                        z14 = false;
                                                        this.O = z14;
                                                        this.P = i16 != 21 && "OMX.google.aac.decoder".equals(str4);
                                                        String str822 = d8.f155213b;
                                                        z15 = true;
                                                        this.Q = z15;
                                                        this.R = i16 > 18 && this.D.f160242x == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str4);
                                                        String str9222 = peekFirst.f154652a;
                                                        this.U = (i16 > 25 && "OMX.rk.video_decoder.avc".equals(str9222)) || (i16 <= 17 && "OMX.allwinner.video.decoder.avc".equals(str9222)) || ((i16 <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str9222) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str9222))) || ("Amazon".equals(d8.f155214c) && "AFTS".equals(d8.f155215d) && peekFirst.f154657f));
                                                        if ("c2.android.mp3.decoder".equals(peekFirst.f154652a)) {
                                                        }
                                                        if (this.f156708f == 2) {
                                                        }
                                                        this.V3.f155793a++;
                                                        o0(str4, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime);
                                                        i15 = 0;
                                                        r102 = 0;
                                                    }
                                                }
                                                i14 = i15;
                                                this.K = i14;
                                                this.L = (i16 < 21 || !this.D.f160231m.isEmpty() || !"OMX.MTK.VIDEO.DECODER.AVC".equals(str4)) ? i15 : 1;
                                                this.M = i16 >= 18 || (i16 == 18 && ("OMX.SEC.avc.dec".equals(str4) || "OMX.SEC.avc.dec.secure".equals(str4))) || (i16 == 19 && d8.f155215d.startsWith("SM-G800") && ("OMX.Exynos.avc.dec".equals(str4) || "OMX.Exynos.avc.dec.secure".equals(str4)));
                                                this.N = i16 != 29 && "c2.android.aac.decoder".equals(str4);
                                                if (i16 <= 19) {
                                                }
                                                z14 = false;
                                                this.O = z14;
                                                this.P = i16 != 21 && "OMX.google.aac.decoder".equals(str4);
                                                String str8222 = d8.f155213b;
                                                z15 = true;
                                                this.Q = z15;
                                                this.R = i16 > 18 && this.D.f160242x == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str4);
                                                String str92222 = peekFirst.f154652a;
                                                this.U = (i16 > 25 && "OMX.rk.video_decoder.avc".equals(str92222)) || (i16 <= 17 && "OMX.allwinner.video.decoder.avc".equals(str92222)) || ((i16 <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str92222) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str92222))) || ("Amazon".equals(d8.f155214c) && "AFTS".equals(d8.f155215d) && peekFirst.f154657f));
                                                if ("c2.android.mp3.decoder".equals(peekFirst.f154652a)) {
                                                }
                                                if (this.f156708f == 2) {
                                                }
                                                this.V3.f155793a++;
                                                o0(str4, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime);
                                                i15 = 0;
                                                r102 = 0;
                                            } catch (IOException | RuntimeException e16) {
                                                e14 = e16;
                                                mediaCodec = createByCodecName;
                                                if (mediaCodec != null) {
                                                }
                                                throw e14;
                                            }
                                        } catch (IOException | RuntimeException e17) {
                                            e14 = e17;
                                            mediaCodec = null;
                                            if (mediaCodec != null) {
                                                mediaCodec.release();
                                            }
                                            throw e14;
                                        }
                                    } catch (Exception e18) {
                                        a.D("Failed to initialize decoder: ".concat(String.valueOf(peekFirst)), e18);
                                        this.H.removeFirst();
                                        v12 v122 = new v12(this.f158347y, (Throwable) e18, false, peekFirst);
                                        q0(v122);
                                        v12 v123 = this.I;
                                        if (v123 == null) {
                                            this.I = v122;
                                        } else {
                                            this.I = new v12(v123.getMessage(), v123.getCause(), v123.f162810b, v123.f162811c, v123.f162812d, v122);
                                        }
                                        if (this.H.isEmpty()) {
                                            throw this.I;
                                        }
                                    }
                                } else {
                                    return;
                                }
                            }
                            this.H = r102;
                            return;
                        }
                        throw new v12(this.f158347y, (Throwable) null, false, -49999);
                    } catch (v12 e19) {
                        throw f(e19, this.f158347y, false, 4001);
                    }
                } else {
                    kq1 kq12 = (kq1) v002.f162804b;
                    throw f(kq12, p3Var2, false, kq12.f158222b);
                }
            } else {
                p3 p3Var4 = this.f158347y;
                b0();
                String str11 = p3Var4.f160229k;
                if ("audio/mp4a-latm".equals(str11) || "audio/mpeg".equals(str11) || "audio/opus".equals(str11)) {
                    this.f158340r.f161615j = 32;
                } else {
                    this.f158340r.f161615j = 1;
                }
                this.G3 = true;
            }
        }
    }

    public boolean S(c12 c122) {
        return true;
    }

    public final void T() {
        try {
            ig2 ig22 = this.Z3;
            if (ig22 != null) {
                ig22.f157316b = null;
                ig22.f157317c = null;
                ig22.f157315a.release();
                this.V3.f155794b++;
                p0(this.J.f154652a);
            }
        } finally {
            this.Z3 = null;
            this.f158333a4 = null;
            W();
        }
    }

    public final boolean U() {
        if (this.Z3 == null) {
            return false;
        }
        if (this.M3 == 3 || this.M || ((this.N && !this.P3) || (this.O && this.O3))) {
            T();
            return true;
        }
        h0();
        return false;
    }

    public void V() {
        J();
        this.Y = -1;
        this.Z = null;
        this.W = C.TIME_UNSET;
        this.O3 = false;
        this.N3 = false;
        this.S = false;
        this.T = false;
        this.V1 = false;
        this.V2 = false;
        this.f158342t.clear();
        this.Q3 = C.TIME_UNSET;
        this.R3 = C.TIME_UNSET;
        ky1 ky12 = this.V;
        if (ky12 != null) {
            ky12.f158280a = 0;
            ky12.f158281b = 0;
            ky12.f158282c = false;
        }
        this.L3 = 0;
        this.M3 = 0;
        this.K3 = this.J3 ? 1 : 0;
    }

    public final void W() {
        V();
        this.V = null;
        this.H = null;
        this.J = null;
        this.D = null;
        this.E = null;
        this.F = false;
        this.P3 = false;
        this.G = -1.0f;
        this.K = 0;
        this.L = false;
        this.M = false;
        this.N = false;
        this.O = false;
        this.P = false;
        this.Q = false;
        this.R = false;
        this.U = false;
        this.J3 = false;
        this.K3 = 0;
    }

    @Override // uc.a5
    public boolean X() {
        boolean z14;
        if (this.f158347y != null) {
            if (G()) {
                z14 = this.f156713k;
            } else {
                am2 am22 = this.f156709g;
                Objects.requireNonNull(am22);
                z14 = am22.k();
            }
            if (z14) {
                return true;
            }
            if (this.Y >= 0) {
                return true;
            }
            if (this.W != C.TIME_UNSET && SystemClock.elapsedRealtime() < this.W) {
                return true;
            }
        }
        return false;
    }

    public f02 Y(Throwable th4, c12 c122) {
        return new f02(th4, c122);
    }

    public void Z(y2 y2Var) throws p2 {
    }

    public void a0(long j14) {
        while (true) {
            int i14 = this.Y3;
            if (i14 != 0 && j14 >= this.f158346x[0]) {
                long[] jArr = this.f158344v;
                this.W3 = jArr[0];
                this.X3 = this.f158345w[0];
                int i15 = i14 - 1;
                this.Y3 = i15;
                System.arraycopy(jArr, 1, jArr, 0, i15);
                long[] jArr2 = this.f158345w;
                System.arraycopy(jArr2, 1, jArr2, 0, this.Y3);
                long[] jArr3 = this.f158346x;
                System.arraycopy(jArr3, 1, jArr3, 0, this.Y3);
                M();
            } else {
                return;
            }
        }
    }

    @Override // uc.h2
    public final int b() {
        return 8;
    }

    @Override // uc.h2
    public final int c(p3 p3Var) throws p2 {
        try {
            return i0(this.f158335m, p3Var);
        } catch (q92 e14) {
            throw f(e14, p3Var, false, 4002);
        }
    }

    public final boolean c0(p3 p3Var) throws p2 {
        if (!(d8.f155212a < 23 || this.Z3 == null || this.M3 == 3 || this.f156708f == 0)) {
            float f14 = this.C;
            p3[] p3VarArr = this.f156710h;
            Objects.requireNonNull(p3VarArr);
            float n04 = n0(f14, p3Var, p3VarArr);
            float f15 = this.G;
            if (f15 == n04) {
                return true;
            }
            if (n04 == -1.0f) {
                e0();
                return false;
            } else if (f15 == -1.0f && n04 <= this.f158336n) {
                return true;
            } else {
                Bundle bundle = new Bundle();
                bundle.putFloat("operating-rate", n04);
                this.Z3.f157315a.setParameters(bundle);
                this.G = n04;
            }
        }
        return true;
    }

    @Override // uc.h2
    public final void d(p3[] p3VarArr, long j14, long j15) throws p2 {
        boolean z14 = true;
        if (this.X3 == C.TIME_UNSET) {
            if (this.W3 != C.TIME_UNSET) {
                z14 = false;
            }
            r52.e(z14);
            this.W3 = j14;
            this.X3 = j15;
            return;
        }
        int i14 = this.Y3;
        if (i14 == 10) {
            long j16 = this.f158345w[9];
        } else {
            this.Y3 = i14 + 1;
        }
        long[] jArr = this.f158344v;
        int i15 = this.Y3 - 1;
        jArr[i15] = j14;
        this.f158345w[i15] = j15;
        this.f158346x[i15] = this.Q3;
    }

    @TargetApi(23)
    public final boolean d0() throws p2 {
        if (this.N3) {
            this.L3 = 1;
            if (this.M || this.O) {
                this.M3 = 3;
                return false;
            }
            this.M3 = 2;
            return true;
        }
        try {
            throw null;
        } catch (MediaCryptoException e14) {
            throw f(e14, this.f158347y, false, 6006);
        }
    }

    public final void e0() throws p2 {
        if (this.N3) {
            this.L3 = 1;
            this.M3 = 3;
            return;
        }
        T();
        R();
    }

    @TargetApi(23)
    public final void f0() throws p2 {
        int i14 = this.M3;
        if (i14 == 1) {
            h0();
        } else if (i14 == 2) {
            h0();
            try {
                throw null;
            } catch (MediaCryptoException e14) {
                throw f(e14, this.f158347y, false, 6006);
            }
        } else if (i14 != 3) {
            this.T3 = true;
            P();
        } else {
            T();
            R();
        }
    }

    /* JADX DEBUG: Multi-variable search result rejected for r10v2, resolved type: V[] */
    /* JADX WARN: Multi-variable type inference failed */
    /* JADX WARNING: Removed duplicated region for block: B:130:0x0206  */
    /* JADX WARNING: Removed duplicated region for block: B:131:0x020f  */
    public final boolean g0() throws p2 {
        int i14;
        long j14;
        int i15;
        int i16;
        ByteBuffer byteBuffer;
        ig2 ig22 = this.Z3;
        if (ig22 == null || this.L3 == 2 || this.S3) {
            return false;
        }
        if (this.X < 0) {
            int dequeueInputBuffer = ig22.f157315a.dequeueInputBuffer(0);
            this.X = dequeueInputBuffer;
            if (dequeueInputBuffer < 0) {
                return false;
            }
            y2 y2Var = this.f158338p;
            ig2 ig23 = this.Z3;
            Objects.requireNonNull(ig23);
            if (d8.f155212a >= 21) {
                byteBuffer = ig23.f157315a.getInputBuffer(dequeueInputBuffer);
            } else {
                byteBuffer = ig23.f157316b[dequeueInputBuffer];
            }
            y2Var.f163838c = byteBuffer;
            this.f158338p.a();
        }
        if (this.L3 == 1) {
            if (!this.U) {
                this.O3 = true;
                this.Z3.b(this.X, 0, 0, 4);
                J();
            }
            this.L3 = 2;
            return false;
        } else if (this.S) {
            this.S = false;
            this.f158338p.f163838c.put(f158332c4);
            this.Z3.b(this.X, 38, 0, 0);
            J();
            this.N3 = true;
            return true;
        } else {
            if (this.K3 == 1) {
                for (int i17 = 0; i17 < this.D.f160231m.size(); i17++) {
                    this.f158338p.f163838c.put(this.D.f160231m.get(i17));
                }
                this.K3 = 2;
            }
            int position = this.f158338p.f163838c.position();
            q3 e14 = e();
            try {
                int i18 = i(e14, this.f158338p, 0);
                if (G()) {
                    this.R3 = this.Q3;
                }
                if (i18 == -3) {
                    return false;
                }
                if (i18 == -5) {
                    if (this.K3 == 2) {
                        this.f158338p.a();
                        this.K3 = 1;
                    }
                    r0(e14);
                    return true;
                } else if (this.f158338p.c()) {
                    if (this.K3 == 2) {
                        this.f158338p.a();
                        this.K3 = 1;
                    }
                    this.S3 = true;
                    if (!this.N3) {
                        f0();
                        return false;
                    }
                    try {
                        if (!this.U) {
                            this.O3 = true;
                            this.Z3.b(this.X, 0, 0, 4);
                            J();
                        }
                        return false;
                    } catch (MediaCodec.CryptoException e15) {
                        throw f(e15, this.f158347y, false, i2.c(e15.getErrorCode()));
                    }
                } else if (this.N3 || this.f158338p.d(1)) {
                    boolean d14 = this.f158338p.d(C.BUFFER_FLAG_ENCRYPTED);
                    if (d14) {
                        o0 o0Var = this.f158338p.f163837b;
                        Objects.requireNonNull(o0Var);
                        if (position != 0) {
                            if (o0Var.f159652b == null) {
                                int[] iArr = new int[1];
                                o0Var.f159652b = iArr;
                                o0Var.f159654d.numBytesOfClearData = iArr;
                            }
                            int[] iArr2 = o0Var.f159652b;
                            iArr2[0] = iArr2[0] + position;
                        }
                    }
                    if (this.L && !d14) {
                        ByteBuffer byteBuffer2 = this.f158338p.f163838c;
                        byte[] bArr = o7.f159737a;
                        int position2 = byteBuffer2.position();
                        int i19 = 0;
                        int i24 = 0;
                        while (true) {
                            int i25 = i19 + 1;
                            if (i25 >= position2) {
                                byteBuffer2.clear();
                                break;
                            }
                            int i26 = byteBuffer2.get(i19) & UByte.MAX_VALUE;
                            if (i24 == 3) {
                                if (i26 == 1) {
                                    if ((byteBuffer2.get(i25) & ClosedCaptionCtrl.TAB_OFFSET_CHAN_2) == 7) {
                                        ByteBuffer duplicate = byteBuffer2.duplicate();
                                        duplicate.position(i19 - 3);
                                        duplicate.limit(position2);
                                        byteBuffer2.position(0);
                                        byteBuffer2.put(duplicate);
                                        break;
                                    }
                                    i26 = 1;
                                }
                            } else if (i26 == 0) {
                                i24++;
                            }
                            if (i26 != 0) {
                                i24 = 0;
                            }
                            i19 = i25;
                        }
                        if (this.f158338p.f163838c.position() == 0) {
                            return true;
                        }
                        this.L = false;
                    }
                    y2 y2Var2 = this.f158338p;
                    long j15 = y2Var2.f163840e;
                    ky1 ky12 = this.V;
                    if (ky12 != null) {
                        p3 p3Var = this.f158347y;
                        if (ky12.f158281b == 0) {
                            ky12.f158280a = j15;
                        }
                        if (!ky12.f158282c) {
                            ByteBuffer byteBuffer3 = y2Var2.f163838c;
                            Objects.requireNonNull(byteBuffer3);
                            int i27 = 0;
                            for (int i28 = 0; i28 < 4; i28++) {
                                i27 = (i27 << 8) | (byteBuffer3.get(i28) & UByte.MAX_VALUE);
                            }
                            if (!(!jq2.b(i27) || (i15 = (i27 >>> 19) & 3) == 1 || (i16 = (i27 >>> 17) & 3) == 0)) {
                                int i29 = (i27 >>> 12) & 15;
                                int i34 = (i27 >>> 10) & 3;
                                if (!(i29 == 0 || i29 == 15 || i34 == 3)) {
                                    i14 = jq2.c(i15, i16);
                                    if (i14 != -1) {
                                        ky12.f158282c = true;
                                        ky12.f158281b = 0;
                                        j14 = y2Var2.f163840e;
                                        ky12.f158280a = j14;
                                    } else {
                                        j14 = ky12.a((long) p3Var.f160243y);
                                        ky12.f158281b += (long) i14;
                                    }
                                    j15 = j14;
                                }
                            }
                            i14 = -1;
                            if (i14 != -1) {
                            }
                            j15 = j14;
                        }
                        long j16 = this.Q3;
                        ky1 ky13 = this.V;
                        p3 p3Var2 = this.f158347y;
                        Objects.requireNonNull(ky13);
                        this.Q3 = Math.max(j16, ky13.a((long) p3Var2.f160243y));
                    }
                    if (this.f158338p.b()) {
                        this.f158342t.add(Long.valueOf(j15));
                    }
                    if (this.U3) {
                        a8<p3> a8Var = this.f158341s;
                        p3 p3Var3 = this.f158347y;
                        synchronized (a8Var) {
                            int i35 = a8Var.f154022d;
                            if (i35 > 0) {
                                if (j15 <= a8Var.f154019a[((a8Var.f154021c + i35) - 1) % a8Var.f154020b.length]) {
                                    a8Var.a();
                                }
                            }
                            int length = a8Var.f154020b.length;
                            if (a8Var.f154022d >= length) {
                                int i36 = length + length;
                                long[] jArr = new long[i36];
                                V[] vArr = (V[]) new Object[i36];
                                int i37 = a8Var.f154021c;
                                int i38 = length - i37;
                                System.arraycopy(a8Var.f154019a, i37, jArr, 0, i38);
                                System.arraycopy(a8Var.f154020b, a8Var.f154021c, vArr, 0, i38);
                                int i39 = a8Var.f154021c;
                                if (i39 > 0) {
                                    System.arraycopy(a8Var.f154019a, 0, jArr, i38, i39);
                                    System.arraycopy(a8Var.f154020b, 0, vArr, i38, a8Var.f154021c);
                                }
                                a8Var.f154019a = jArr;
                                a8Var.f154020b = vArr;
                                a8Var.f154021c = 0;
                            }
                            int i44 = a8Var.f154021c;
                            int i45 = a8Var.f154022d;
                            V[] vArr2 = a8Var.f154020b;
                            int length2 = (i44 + i45) % vArr2.length;
                            a8Var.f154019a[length2] = j15;
                            vArr2[length2] = p3Var3;
                            a8Var.f154022d = i45 + 1;
                        }
                        this.U3 = false;
                    }
                    this.Q3 = Math.max(this.Q3, j15);
                    this.f158338p.f();
                    if (this.f158338p.d(268435456)) {
                        Z(this.f158338p);
                    }
                    K(this.f158338p);
                    if (d14) {
                        try {
                            this.Z3.f157315a.queueSecureInputBuffer(this.X, 0, this.f158338p.f163837b.f159654d, j15, 0);
                        } catch (MediaCodec.CryptoException e16) {
                            throw f(e16, this.f158347y, false, i2.c(e16.getErrorCode()));
                        }
                    } else {
                        this.Z3.b(this.X, this.f158338p.f163838c.limit(), j15, 0);
                    }
                    J();
                    this.N3 = true;
                    this.K3 = 0;
                    this.V3.f155795c++;
                    return true;
                } else {
                    this.f158338p.a();
                    if (this.K3 == 2) {
                        this.K3 = 1;
                    }
                    return true;
                }
            } catch (k2 e17) {
                q0(e17);
                t0(0);
                h0();
                return true;
            }
        }
    }

    public abstract int i0(m42 m422, p3 p3Var) throws q92;

    public abstract List<c12> j0(m42 m422, p3 p3Var, boolean z14) throws q92;

    @Override // uc.h2
    public void k(long j14, boolean z14) throws p2 {
        int i14;
        this.S3 = false;
        this.T3 = false;
        if (this.G3) {
            this.f158340r.a();
            this.f158339q.a();
            this.H3 = false;
        } else if (U()) {
            R();
        }
        a8<p3> a8Var = this.f158341s;
        synchronized (a8Var) {
            i14 = a8Var.f154022d;
        }
        if (i14 > 0) {
            this.U3 = true;
        }
        this.f158341s.a();
        int i15 = this.Y3;
        if (i15 != 0) {
            int i16 = i15 - 1;
            this.X3 = this.f158345w[i16];
            this.W3 = this.f158344v[i16];
            this.Y3 = 0;
        }
    }

    public boolean k0(p3 p3Var) {
        return false;
    }

    public abstract kg0 l0(c12 c122, p3 p3Var, MediaCrypto mediaCrypto, float f14);

    public abstract zi m0(c12 c122, p3 p3Var, p3 p3Var2);

    @Override // uc.h2
    public void n() {
        this.f158347y = null;
        this.W3 = C.TIME_UNSET;
        this.X3 = C.TIME_UNSET;
        this.Y3 = 0;
        U();
    }

    public abstract float n0(float f14, p3 p3Var, p3[] p3VarArr);

    public abstract void o0(String str, long j14, long j15);

    @Override // uc.a5
    public boolean p() {
        return this.T3;
    }

    public abstract void p0(String str);

    @Override // uc.h2
    public void q() {
        try {
            b0();
            T();
        } finally {
            this.f158334b4 = null;
        }
    }

    public abstract void q0(Exception exc);

    /* JADX WARNING: Code restructure failed: missing block: B:26:0x0060, code lost:
        if (d0() == false) goto L_0x00bb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:40:0x008c, code lost:
        if (d0() == false) goto L_0x00bb;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:47:0x009f, code lost:
        if (d0() == false) goto L_0x00bb;
     */
    /* JADX WARNING: Removed duplicated region for block: B:60:0x00bf  */
    public zi r0(q3 q3Var) throws p2 {
        boolean z14 = true;
        this.U3 = true;
        p3 p3Var = (p3) q3Var.f160837b;
        Objects.requireNonNull(p3Var);
        if (p3Var.f160229k != null) {
            v00 v002 = (v00) q3Var.f160838c;
            this.f158334b4 = v002;
            this.f158347y = p3Var;
            if (this.G3) {
                this.I3 = true;
                return null;
            }
            ig2 ig22 = this.Z3;
            if (ig22 == null) {
                this.H = null;
                R();
                return null;
            }
            c12 c122 = this.J;
            p3 p3Var2 = this.D;
            v00 v003 = this.f158333a4;
            if (v003 == v002) {
                r52.e(v002 == v003 || d8.f155212a >= 23);
                zi m04 = m0(c122, p3Var2, p3Var);
                int i14 = m04.f164466d;
                int i15 = 2;
                if (i14 != 0) {
                    if (i14 != 1) {
                        if (i14 != 2) {
                            if (c0(p3Var)) {
                                this.D = p3Var;
                                if (v002 != v003) {
                                }
                            }
                        } else if (c0(p3Var)) {
                            this.J3 = true;
                            this.K3 = 1;
                            int i16 = this.K;
                            if (!(i16 == 2 || (i16 == 1 && p3Var.f160234p == p3Var2.f160234p && p3Var.f160235q == p3Var2.f160235q))) {
                                z14 = false;
                            }
                            this.S = z14;
                            this.D = p3Var;
                            if (v002 != v003) {
                            }
                        }
                    } else if (c0(p3Var)) {
                        this.D = p3Var;
                        if (v002 == v003) {
                            if (this.N3) {
                                this.L3 = 1;
                                if (this.M || this.O) {
                                    this.M3 = 3;
                                    return (m04.f164466d != 0 || (this.Z3 == ig22 && this.M3 != 3)) ? m04 : new zi(c122.f154652a, p3Var2, p3Var, 0, i15);
                                }
                                this.M3 = 1;
                            }
                        }
                    }
                    i15 = 16;
                    if (m04.f164466d != 0) {
                    }
                }
                e0();
                i15 = 0;
                if (m04.f164466d != 0) {
                }
            }
            if (!(v002 == null || v003 == null || d8.f155212a < 23)) {
                UUID uuid = i2.f157162b;
                UUID uuid2 = i2.f157161a;
                if (!uuid.equals(uuid2)) {
                    uuid.equals(uuid2);
                }
            }
            e0();
            return new zi(c122.f154652a, p3Var2, p3Var, 0, 128);
        }
        throw f(new IllegalArgumentException(), p3Var, false, 4005);
    }

    public abstract void s0(p3 p3Var, MediaFormat mediaFormat) throws p2;

    public final boolean t0(int i14) throws p2 {
        q3 e14 = e();
        this.f158337o.a();
        int i15 = i(e14, this.f158337o, i14 | 4);
        if (i15 == -5) {
            r0(e14);
            return true;
        } else if (i15 != -4 || !this.f158337o.c()) {
            return false;
        } else {
            this.S3 = true;
            f0();
            return false;
        }
    }

    public final boolean u0(long j14) {
        return this.A == C.TIME_UNSET || SystemClock.elapsedRealtime() - j14 < this.A;
    }

    @Override // uc.h2, uc.a5
    public void x(float f14, float f15) throws p2 {
        this.B = f14;
        this.C = f15;
        c0(this.D);
    }
}