APK反编译源代码展示 - 南明离火平台提供

应用版本信息
应用名称:Music Player
版本号:1.0
包名称:music.downloader.mp3player.downloadmusic

MD5 校验值:61e58c10a11e4adec8760ee3854e996a

反编译源代码说明

x.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。


package K1;

import I1.D;
import I1.I;
import a1.C0224c;
import android.app.UiModeManager;
import android.content.Context;
import android.media.AudioTimestamp;
import android.media.AudioTrack;
import android.media.MediaCodec;
import android.media.MediaCrypto;
import android.media.MediaFormat;
import android.os.Handler;
import android.util.Log;
import android.view.Surface;
import com.google.android.gms.internal.ads.C1430tq;
import java.lang.reflect.Method;
import java.nio.ByteBuffer;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import o4.C2120c;

public final class x extends X1.c implements z2.g {

    public boolean f1546A0;

    public MediaFormat f1547B0;

    public I1.w f1548C0;

    public long f1549D0;

    public boolean f1550E0;

    public boolean f1551F0;

    public long f1552G0;

    public int f1553H0;

    public final Context f1554t0;

    public final C2120c f1555u0;

    public final v f1556v0;

    public final long[] f1557w0;

    public int f1558x0;

    public boolean f1559y0;

    public boolean f1560z0;

    public x(Context context, M1.e eVar, Handler handler, I i5, v vVar) {
        super(1, eVar, 44100.0f);
        this.f1554t0 = context.getApplicationContext();
        this.f1556v0 = vVar;
        this.f1552G0 = -9223372036854775807L;
        this.f1557w0 = new long[10];
        this.f1555u0 = new C2120c(handler, i5, 3);
        vVar.f1528j = new android.support.v4.media.session.m(this);
    }

    @Override
    public final float F(float f7, I1.w[] wVarArr) {
        int i5 = -1;
        for (I1.w wVar : wVarArr) {
            int i6 = wVar.f1069C;
            if (i6 != -1) {
                i5 = Math.max(i5, i6);
            }
        }
        if (i5 == -1) {
            return -1.0f;
        }
        return f7 * i5;
    }

    @Override
    public final List G(X1.d dVar, I1.w wVar, boolean z6) {
        X1.a aVar;
        String str = wVar.f1083o;
        if (str == null) {
            return Collections.emptyList();
        }
        if (b0(wVar.f1068B, str) != 0) {
            dVar.getClass();
            List d = X1.k.d("audio/raw", false, false);
            X1.a aVar2 = null;
            if (d.isEmpty()) {
                aVar = null;
            } else {
                aVar = (X1.a) d.get(0);
            }
            if (aVar != null) {
                aVar2 = new X1.a(aVar.f4182a, null, null, null, true, false, false);
            }
            if (aVar2 != null) {
                return Collections.singletonList(aVar2);
            }
        }
        dVar.getClass();
        ArrayList arrayList = new ArrayList(X1.k.d(str, z6, false));
        Collections.sort(arrayList, new X1.e(new S5.m(wVar)));
        if ("audio/eac3-joc".equals(str)) {
            ArrayList arrayList2 = new ArrayList(arrayList);
            arrayList2.addAll(X1.k.d("audio/eac3", z6, false));
            arrayList = arrayList2;
        }
        return Collections.unmodifiableList(arrayList);
    }

    @Override
    public final void L(long j5, long j6, String str) {
        C2120c c2120c = this.f1555u0;
        Handler handler = (Handler) c2120c.e;
        if (handler != null) {
            handler.post(new A2.s(c2120c, str, j5, j6, 1));
        }
    }

    @Override
    public final void M(com.bumptech.glide.manager.p pVar) {
        super.M(pVar);
        I1.w wVar = (I1.w) pVar.f5878j;
        this.f1548C0 = wVar;
        C2120c c2120c = this.f1555u0;
        Handler handler = (Handler) c2120c.e;
        if (handler != null) {
            handler.post(new A2.q(c2120c, wVar, 5));
        }
    }

    @Override
    public final void N(MediaCodec mediaCodec, MediaFormat mediaFormat) {
        int i5;
        int i6;
        int[] iArr;
        int i7;
        MediaFormat mediaFormat2 = this.f1547B0;
        if (mediaFormat2 != null) {
            i6 = b0(mediaFormat2.getInteger("channel-count"), mediaFormat2.getString("mime"));
            mediaFormat = mediaFormat2;
        } else {
            I1.w wVar = this.f1548C0;
            if ("audio/raw".equals(wVar.f1083o)) {
                i5 = wVar.f1070D;
            } else {
                i5 = 2;
            }
            i6 = i5;
        }
        int integer = mediaFormat.getInteger("channel-count");
        int integer2 = mediaFormat.getInteger("sample-rate");
        if (this.f1560z0 && integer == 6 && (i7 = this.f1548C0.f1068B) < 6) {
            iArr = new int[i7];
            for (int i8 = 0; i8 < this.f1548C0.f1068B; i8++) {
                iArr[i8] = i8;
            }
        } else {
            iArr = null;
        }
        int[] iArr2 = iArr;
        try {
            v vVar = this.f1556v0;
            I1.w wVar2 = this.f1548C0;
            vVar.b(i6, integer, integer2, iArr2, wVar2.f1071E, wVar2.f1072F);
        } catch (j e) {
            throw a(e, this.f1548C0);
        }
    }

    @Override
    public final void O(long j5) {
        while (true) {
            int i5 = this.f1553H0;
            if (i5 != 0) {
                long[] jArr = this.f1557w0;
                if (j5 >= jArr[0]) {
                    v vVar = this.f1556v0;
                    if (vVar.f1544z == 1) {
                        vVar.f1544z = 2;
                    }
                    int i6 = i5 - 1;
                    this.f1553H0 = i6;
                    System.arraycopy(jArr, 1, jArr, 0, i6);
                } else {
                    return;
                }
            } else {
                return;
            }
        }
    }

    @Override
    public final void P(L1.c cVar) {
        if (this.f1550E0 && !cVar.isDecodeOnly()) {
            if (Math.abs(cVar.f1690f - this.f1549D0) > 500000) {
                this.f1549D0 = cVar.f1690f;
            }
            this.f1550E0 = false;
        }
        this.f1552G0 = Math.max(cVar.f1690f, this.f1552G0);
    }

    @Override
    public final boolean R(long j5, long j6, MediaCodec mediaCodec, ByteBuffer byteBuffer, int i5, int i6, long j7, boolean z6, boolean z7) {
        if (this.f1546A0 && j7 == 0 && (i6 & 4) != 0) {
            long j8 = this.f1552G0;
            if (j8 != -9223372036854775807L) {
                j7 = j8;
            }
        }
        if (this.f1559y0 && (i6 & 2) != 0) {
            mediaCodec.releaseOutputBuffer(i5, false);
            return true;
        }
        v vVar = this.f1556v0;
        if (z6) {
            mediaCodec.releaseOutputBuffer(i5, false);
            this.f4233r0.getClass();
            if (vVar.f1544z == 1) {
                vVar.f1544z = 2;
            }
            return true;
        }
        try {
            if (!vVar.g(byteBuffer, j7)) {
                return false;
            }
            mediaCodec.releaseOutputBuffer(i5, false);
            this.f4233r0.getClass();
            return true;
        } catch (k | l e) {
            throw a(e, this.f1548C0);
        }
    }

    @Override
    public final void U() {
        try {
            v vVar = this.f1556v0;
            if (!vVar.f1514J && vVar.i() && vVar.c()) {
                vVar.j();
                vVar.f1514J = true;
            }
        } catch (l e) {
            throw a(e, this.f1548C0);
        }
    }

    @Override
    public final int X(X1.d dVar, I1.w wVar) {
        int i5;
        boolean z6;
        int i6;
        int i7;
        X1.a aVar;
        String str = wVar.f1083o;
        if (!z2.h.h(str)) {
            return 0;
        }
        if (z2.q.f19694a >= 21) {
            i5 = 32;
        } else {
            i5 = 0;
        }
        if (wVar.f1086r != null && !M1.f.class.equals(wVar.f1074I)) {
            z6 = false;
        } else {
            z6 = true;
        }
        int i8 = wVar.f1068B;
        if (z6 && b0(i8, str) != 0) {
            dVar.getClass();
            List d = X1.k.d("audio/raw", false, false);
            X1.a aVar2 = null;
            if (d.isEmpty()) {
                aVar = null;
            } else {
                aVar = (X1.a) d.get(0);
            }
            if (aVar != null) {
                aVar2 = new X1.a(aVar.f4182a, null, null, null, true, false, false);
            }
            if (aVar2 != null) {
                return 12 | i5;
            }
        }
        boolean equals = "audio/raw".equals(str);
        v vVar = this.f1556v0;
        if ((equals && !vVar.m(i8, wVar.f1070D)) || !vVar.m(i8, 2)) {
            return 1;
        }
        List G = G(dVar, wVar, false);
        if (G.isEmpty()) {
            return 1;
        }
        if (!z6) {
            return 2;
        }
        X1.a aVar3 = (X1.a) G.get(0);
        boolean b7 = aVar3.b(wVar);
        if (b7 && aVar3.c(wVar)) {
            i6 = 16;
        } else {
            i6 = 8;
        }
        if (b7) {
            i7 = 4;
        } else {
            i7 = 3;
        }
        return i6 | i7 | i5;
    }

    public final int a0(X1.a aVar, I1.w wVar) {
        int i5;
        UiModeManager uiModeManager;
        if ("OMX.google.raw.decoder".equals(aVar.f4182a) && (i5 = z2.q.f19694a) < 24 && (i5 != 23 || (uiModeManager = (UiModeManager) this.f1554t0.getApplicationContext().getSystemService("uimode")) == null || uiModeManager.getCurrentModeType() != 4)) {
            return -1;
        }
        return wVar.f1084p;
    }

    @Override
    public final void b(D d) {
        v vVar = this.f1556v0;
        t tVar = vVar.f1530l;
        if (tVar != null && !tVar.f1501j) {
            d = D.e;
        } else {
            D d4 = vVar.f1533o;
            if (d4 == null) {
                ArrayDeque arrayDeque = vVar.f1527i;
                if (!arrayDeque.isEmpty()) {
                    d4 = ((u) arrayDeque.getLast()).f1503a;
                } else {
                    d4 = vVar.f1534p;
                }
            }
            if (!d.equals(d4)) {
                if (vVar.i()) {
                    vVar.f1533o = d;
                    return;
                }
            } else {
                return;
            }
        }
        vVar.f1534p = d;
    }

    public final int b0(int i5, String str) {
        boolean equals = "audio/eac3-joc".equals(str);
        v vVar = this.f1556v0;
        if (equals) {
            if (vVar.m(-1, 18)) {
                return z2.h.b("audio/eac3-joc");
            }
            str = "audio/eac3";
        }
        int b7 = z2.h.b(str);
        if (vVar.m(i5, b7)) {
            return b7;
        }
        return 0;
    }

    public final void c0() {
        long j5;
        long j6;
        boolean z6;
        v vVar;
        o oVar;
        u uVar;
        int i5;
        m mVar;
        long j7;
        long j8;
        long j9;
        long j10;
        v vVar2;
        u uVar2;
        ArrayDeque arrayDeque;
        float f7;
        long j11;
        long j12;
        long j13;
        boolean z7;
        long j14;
        v vVar3;
        long j15;
        Method method;
        Method method2;
        u uVar3;
        long max;
        int i6;
        boolean h6 = h();
        v vVar4 = this.f1556v0;
        if (vVar4.i() && vVar4.f1544z != 0) {
            o oVar2 = vVar4.f1526h;
            AudioTrack audioTrack = oVar2.f1464c;
            audioTrack.getClass();
            if (audioTrack.getPlayState() == 3) {
                long a6 = (oVar2.a() * 1000000) / oVar2.f1466g;
                if (a6 != 0) {
                    long nanoTime = System.nanoTime() / 1000;
                    if (nanoTime - oVar2.f1470k >= 30000) {
                        int i7 = oVar2.f1479t;
                        long[] jArr = oVar2.f1463b;
                        jArr[i7] = a6 - nanoTime;
                        oVar2.f1479t = (i7 + 1) % 10;
                        int i8 = oVar2.f1480u;
                        if (i8 < 10) {
                            oVar2.f1480u = i8 + 1;
                        }
                        oVar2.f1470k = nanoTime;
                        oVar2.f1469j = 0L;
                        int i9 = 0;
                        while (true) {
                            int i10 = oVar2.f1480u;
                            if (i9 >= i10) {
                                break;
                            }
                            oVar2.f1469j = (jArr[i9] / i10) + oVar2.f1469j;
                            i9++;
                            h6 = h6;
                        }
                    }
                    z6 = h6;
                    if (!oVar2.f1467h) {
                        n nVar = oVar2.f1465f;
                        nVar.getClass();
                        m mVar2 = (m) nVar.f1461f;
                        if (mVar2 != null && nanoTime - nVar.d >= nVar.f1460c) {
                            nVar.d = nanoTime;
                            AudioTrack audioTrack2 = (AudioTrack) mVar2.f1455a;
                            AudioTimestamp audioTimestamp = (AudioTimestamp) mVar2.f1456b;
                            z7 = audioTrack2.getTimestamp(audioTimestamp);
                            if (z7) {
                                long j16 = audioTimestamp.framePosition;
                                if (mVar2.d > j16) {
                                    mVar2.f1457c++;
                                }
                                mVar2.d = j16;
                                mVar2.e = j16 + (mVar2.f1457c << 32);
                            }
                            int i11 = nVar.f1458a;
                            if (i11 != 0) {
                                if (i11 != 1) {
                                    if (i11 != 2) {
                                        if (i11 != 3) {
                                            if (i11 != 4) {
                                                throw new IllegalStateException();
                                            }
                                        }
                                        C0224c c0224c = oVar2.f1462a;
                                        if (z7) {
                                            vVar = vVar4;
                                            oVar = oVar2;
                                        } else {
                                            if (mVar2 != null) {
                                                j14 = ((AudioTimestamp) mVar2.f1456b).nanoTime / 1000;
                                            } else {
                                                j14 = -9223372036854775807L;
                                            }
                                            if (mVar2 != null) {
                                                vVar3 = vVar4;
                                                j15 = mVar2.e;
                                            } else {
                                                vVar3 = vVar4;
                                                j15 = -1;
                                            }
                                            if (Math.abs(j14 - nanoTime) > 5000000) {
                                                c0224c.getClass();
                                                StringBuilder sb = new StringBuilder("Spurious audio timestamp (system clock mismatch): ");
                                                sb.append(j15);
                                                sb.append(", ");
                                                sb.append(j14);
                                                sb.append(", ");
                                                sb.append(nanoTime);
                                                sb.append(", ");
                                                sb.append(a6);
                                                sb.append(", ");
                                                v vVar5 = (v) c0224c.e;
                                                sb.append(vVar5.e());
                                                sb.append(", ");
                                                sb.append(vVar5.f());
                                                Log.w("AudioTrack", sb.toString());
                                                nVar.b(4);
                                                oVar = oVar2;
                                                vVar = vVar3;
                                            } else {
                                                oVar = oVar2;
                                                vVar = vVar3;
                                                if (Math.abs(((j15 * 1000000) / oVar2.f1466g) - a6) > 5000000) {
                                                    c0224c.getClass();
                                                    StringBuilder sb2 = new StringBuilder("Spurious audio timestamp (frame position mismatch): ");
                                                    sb2.append(j15);
                                                    sb2.append(", ");
                                                    sb2.append(j14);
                                                    sb2.append(", ");
                                                    sb2.append(nanoTime);
                                                    sb2.append(", ");
                                                    sb2.append(a6);
                                                    sb2.append(", ");
                                                    v vVar6 = (v) c0224c.e;
                                                    sb2.append(vVar6.e());
                                                    sb2.append(", ");
                                                    sb2.append(vVar6.f());
                                                    Log.w("AudioTrack", sb2.toString());
                                                    nVar.b(4);
                                                } else if (nVar.f1458a == 4) {
                                                    nVar.a();
                                                }
                                            }
                                        }
                                        if (oVar.f1474o && (method = oVar.f1471l) != null && nanoTime - oVar.f1475p >= 500000) {
                                            try {
                                                AudioTrack audioTrack3 = oVar.f1464c;
                                                audioTrack3.getClass();
                                            } catch (Exception unused) {
                                                method2 = 0;
                                            }
                                            try {
                                                Integer num = (Integer) method.invoke(audioTrack3, null);
                                                int i12 = z2.q.f19694a;
                                                long intValue = (num.intValue() * 1000) - oVar.f1468i;
                                                oVar.f1472m = intValue;
                                                max = Math.max(intValue, 0L);
                                                oVar.f1472m = max;
                                                if (max > 5000000) {
                                                    c0224c.getClass();
                                                    Log.w("AudioTrack", "Ignoring impossibly large audio latency: " + max);
                                                    oVar.f1472m = 0L;
                                                }
                                                uVar3 = null;
                                            } catch (Exception unused2) {
                                                method2 = 0;
                                                oVar.f1471l = method2;
                                                uVar3 = method2;
                                                oVar.f1475p = nanoTime;
                                                uVar = uVar3;
                                                long nanoTime2 = System.nanoTime() / 1000;
                                                n nVar2 = oVar.f1465f;
                                                nVar2.getClass();
                                                i5 = nVar2.f1458a;
                                                if (i5 == 1) {
                                                }
                                                mVar = (m) nVar2.f1461f;
                                                if (mVar != null) {
                                                }
                                                long j17 = (j8 * j7) / oVar.f1466g;
                                                if (i5 == 2) {
                                                }
                                                vVar2 = vVar;
                                                long min = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                                long j18 = vVar2.f1506A;
                                                uVar2 = uVar;
                                                while (true) {
                                                    arrayDeque = vVar2.f1527i;
                                                    if (!arrayDeque.isEmpty()) {
                                                    }
                                                    uVar2 = (u) arrayDeque.remove();
                                                }
                                                if (uVar2 != null) {
                                                }
                                                f7 = vVar2.f1534p.f893a;
                                                B0.o oVar3 = vVar2.f1522b;
                                                if (f7 == 1.0f) {
                                                }
                                                j6 = ((((z) oVar3.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                                j5 = Long.MIN_VALUE;
                                                if (j6 == j5) {
                                                }
                                            }
                                            oVar.f1475p = nanoTime;
                                            uVar = uVar3;
                                            long nanoTime22 = System.nanoTime() / 1000;
                                            n nVar22 = oVar.f1465f;
                                            nVar22.getClass();
                                            i5 = nVar22.f1458a;
                                            if (i5 == 1 && i5 != 2) {
                                                if (oVar.f1480u == 0) {
                                                    j9 = (oVar.a() * 1000000) / oVar.f1466g;
                                                } else {
                                                    j9 = nanoTime22 + oVar.f1469j;
                                                }
                                                if (!z6) {
                                                    j9 -= oVar.f1472m;
                                                }
                                            } else {
                                                mVar = (m) nVar22.f1461f;
                                                if (mVar != null) {
                                                    j8 = mVar.e;
                                                    j7 = 1000000;
                                                } else {
                                                    j7 = 1000000;
                                                    j8 = -1;
                                                }
                                                long j172 = (j8 * j7) / oVar.f1466g;
                                                if (i5 == 2) {
                                                    if (mVar != null) {
                                                        j10 = ((AudioTimestamp) mVar.f1456b).nanoTime / 1000;
                                                    } else {
                                                        j10 = -9223372036854775807L;
                                                    }
                                                    j9 = (nanoTime22 - j10) + j172;
                                                } else {
                                                    j9 = j172;
                                                }
                                            }
                                            vVar2 = vVar;
                                            long min2 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                            long j182 = vVar2.f1506A;
                                            uVar2 = uVar;
                                            while (true) {
                                                arrayDeque = vVar2.f1527i;
                                                if (!arrayDeque.isEmpty() || min2 < ((u) arrayDeque.getFirst()).f1505c) {
                                                    break;
                                                } else {
                                                    uVar2 = (u) arrayDeque.remove();
                                                }
                                            }
                                            if (uVar2 != null) {
                                                vVar2.f1534p = uVar2.f1503a;
                                                vVar2.f1536r = uVar2.f1505c;
                                                vVar2.f1535q = uVar2.f1504b - vVar2.f1506A;
                                            }
                                            f7 = vVar2.f1534p.f893a;
                                            B0.o oVar32 = vVar2.f1522b;
                                            if (f7 == 1.0f) {
                                                j12 = (min2 + vVar2.f1535q) - vVar2.f1536r;
                                                j11 = j182;
                                            } else if (arrayDeque.isEmpty()) {
                                                long j19 = vVar2.f1535q;
                                                long j20 = min2 - vVar2.f1536r;
                                                B b7 = (B) oVar32.f233j;
                                                long j21 = b7.f1423o;
                                                if (j21 >= 1024) {
                                                    int i13 = b7.f1416h.f1446a;
                                                    int i14 = b7.f1415g.f1446a;
                                                    long j22 = b7.f1422n;
                                                    if (i13 == i14) {
                                                        j13 = z2.q.y(j20, j22, j21);
                                                        j11 = j182;
                                                    } else {
                                                        j11 = j182;
                                                        j13 = z2.q.y(j20, j22 * i13, j21 * i14);
                                                    }
                                                } else {
                                                    j11 = j182;
                                                    j13 = (long) (b7.f1413c * j20);
                                                }
                                                j12 = j19 + j13;
                                            } else {
                                                j11 = j182;
                                                long j23 = vVar2.f1535q;
                                                long j24 = min2 - vVar2.f1536r;
                                                float f8 = vVar2.f1534p.f893a;
                                                int i15 = z2.q.f19694a;
                                                if (f8 != 1.0f) {
                                                    j24 = Math.round(j24 * f8);
                                                }
                                                j12 = j24 + j23;
                                            }
                                            j6 = ((((z) oVar32.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                            j5 = Long.MIN_VALUE;
                                        }
                                        uVar = null;
                                        long nanoTime222 = System.nanoTime() / 1000;
                                        n nVar222 = oVar.f1465f;
                                        nVar222.getClass();
                                        i5 = nVar222.f1458a;
                                        if (i5 == 1) {
                                        }
                                        mVar = (m) nVar222.f1461f;
                                        if (mVar != null) {
                                        }
                                        long j1722 = (j8 * j7) / oVar.f1466g;
                                        if (i5 == 2) {
                                        }
                                        vVar2 = vVar;
                                        long min22 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                        long j1822 = vVar2.f1506A;
                                        uVar2 = uVar;
                                        while (true) {
                                            arrayDeque = vVar2.f1527i;
                                            if (!arrayDeque.isEmpty()) {
                                                break;
                                            } else {
                                                break;
                                            }
                                            uVar2 = (u) arrayDeque.remove();
                                        }
                                        if (uVar2 != null) {
                                        }
                                        f7 = vVar2.f1534p.f893a;
                                        B0.o oVar322 = vVar2.f1522b;
                                        if (f7 == 1.0f) {
                                        }
                                        j6 = ((((z) oVar322.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                        j5 = Long.MIN_VALUE;
                                    }
                                } else {
                                    if (z7) {
                                        if (mVar2.e > nVar.e) {
                                            i6 = 2;
                                            nVar.b(i6);
                                        }
                                        C0224c c0224c2 = oVar2.f1462a;
                                        if (z7) {
                                        }
                                        if (oVar.f1474o) {
                                            AudioTrack audioTrack32 = oVar.f1464c;
                                            audioTrack32.getClass();
                                            Integer num2 = (Integer) method.invoke(audioTrack32, null);
                                            int i122 = z2.q.f19694a;
                                            long intValue2 = (num2.intValue() * 1000) - oVar.f1468i;
                                            oVar.f1472m = intValue2;
                                            max = Math.max(intValue2, 0L);
                                            oVar.f1472m = max;
                                            if (max > 5000000) {
                                            }
                                            uVar3 = null;
                                            oVar.f1475p = nanoTime;
                                            uVar = uVar3;
                                            long nanoTime2222 = System.nanoTime() / 1000;
                                            n nVar2222 = oVar.f1465f;
                                            nVar2222.getClass();
                                            i5 = nVar2222.f1458a;
                                            if (i5 == 1) {
                                            }
                                            mVar = (m) nVar2222.f1461f;
                                            if (mVar != null) {
                                            }
                                            long j17222 = (j8 * j7) / oVar.f1466g;
                                            if (i5 == 2) {
                                            }
                                            vVar2 = vVar;
                                            long min222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                            long j18222 = vVar2.f1506A;
                                            uVar2 = uVar;
                                            while (true) {
                                                arrayDeque = vVar2.f1527i;
                                                if (!arrayDeque.isEmpty()) {
                                                }
                                                uVar2 = (u) arrayDeque.remove();
                                            }
                                            if (uVar2 != null) {
                                            }
                                            f7 = vVar2.f1534p.f893a;
                                            B0.o oVar3222 = vVar2.f1522b;
                                            if (f7 == 1.0f) {
                                            }
                                            j6 = ((((z) oVar3222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                            j5 = Long.MIN_VALUE;
                                        }
                                        uVar = null;
                                        long nanoTime22222 = System.nanoTime() / 1000;
                                        n nVar22222 = oVar.f1465f;
                                        nVar22222.getClass();
                                        i5 = nVar22222.f1458a;
                                        if (i5 == 1) {
                                        }
                                        mVar = (m) nVar22222.f1461f;
                                        if (mVar != null) {
                                        }
                                        long j172222 = (j8 * j7) / oVar.f1466g;
                                        if (i5 == 2) {
                                        }
                                        vVar2 = vVar;
                                        long min2222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                        long j182222 = vVar2.f1506A;
                                        uVar2 = uVar;
                                        while (true) {
                                            arrayDeque = vVar2.f1527i;
                                            if (!arrayDeque.isEmpty()) {
                                            }
                                            uVar2 = (u) arrayDeque.remove();
                                        }
                                        if (uVar2 != null) {
                                        }
                                        f7 = vVar2.f1534p.f893a;
                                        B0.o oVar32222 = vVar2.f1522b;
                                        if (f7 == 1.0f) {
                                        }
                                        j6 = ((((z) oVar32222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                        j5 = Long.MIN_VALUE;
                                    }
                                    nVar.a();
                                    C0224c c0224c22 = oVar2.f1462a;
                                    if (z7) {
                                    }
                                    if (oVar.f1474o) {
                                    }
                                    uVar = null;
                                    long nanoTime222222 = System.nanoTime() / 1000;
                                    n nVar222222 = oVar.f1465f;
                                    nVar222222.getClass();
                                    i5 = nVar222222.f1458a;
                                    if (i5 == 1) {
                                    }
                                    mVar = (m) nVar222222.f1461f;
                                    if (mVar != null) {
                                    }
                                    long j1722222 = (j8 * j7) / oVar.f1466g;
                                    if (i5 == 2) {
                                    }
                                    vVar2 = vVar;
                                    long min22222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                    long j1822222 = vVar2.f1506A;
                                    uVar2 = uVar;
                                    while (true) {
                                        arrayDeque = vVar2.f1527i;
                                        if (!arrayDeque.isEmpty()) {
                                        }
                                        uVar2 = (u) arrayDeque.remove();
                                    }
                                    if (uVar2 != null) {
                                    }
                                    f7 = vVar2.f1534p.f893a;
                                    B0.o oVar322222 = vVar2.f1522b;
                                    if (f7 == 1.0f) {
                                    }
                                    j6 = ((((z) oVar322222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                    j5 = Long.MIN_VALUE;
                                }
                            } else {
                                if (z7) {
                                    if (audioTimestamp.nanoTime / 1000 >= nVar.f1459b) {
                                        nVar.e = mVar2.e;
                                        i6 = 1;
                                    }
                                } else {
                                    if (nanoTime - nVar.f1459b > 500000) {
                                        i6 = 3;
                                    }
                                    C0224c c0224c222 = oVar2.f1462a;
                                    if (z7) {
                                    }
                                    if (oVar.f1474o) {
                                    }
                                    uVar = null;
                                    long nanoTime2222222 = System.nanoTime() / 1000;
                                    n nVar2222222 = oVar.f1465f;
                                    nVar2222222.getClass();
                                    i5 = nVar2222222.f1458a;
                                    if (i5 == 1) {
                                    }
                                    mVar = (m) nVar2222222.f1461f;
                                    if (mVar != null) {
                                    }
                                    long j17222222 = (j8 * j7) / oVar.f1466g;
                                    if (i5 == 2) {
                                    }
                                    vVar2 = vVar;
                                    long min222222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                    long j18222222 = vVar2.f1506A;
                                    uVar2 = uVar;
                                    while (true) {
                                        arrayDeque = vVar2.f1527i;
                                        if (!arrayDeque.isEmpty()) {
                                        }
                                        uVar2 = (u) arrayDeque.remove();
                                    }
                                    if (uVar2 != null) {
                                    }
                                    f7 = vVar2.f1534p.f893a;
                                    B0.o oVar3222222 = vVar2.f1522b;
                                    if (f7 == 1.0f) {
                                    }
                                    j6 = ((((z) oVar3222222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                    j5 = Long.MIN_VALUE;
                                }
                                nVar.b(i6);
                                C0224c c0224c2222 = oVar2.f1462a;
                                if (z7) {
                                }
                                if (oVar.f1474o) {
                                }
                                uVar = null;
                                long nanoTime22222222 = System.nanoTime() / 1000;
                                n nVar22222222 = oVar.f1465f;
                                nVar22222222.getClass();
                                i5 = nVar22222222.f1458a;
                                if (i5 == 1) {
                                }
                                mVar = (m) nVar22222222.f1461f;
                                if (mVar != null) {
                                }
                                long j172222222 = (j8 * j7) / oVar.f1466g;
                                if (i5 == 2) {
                                }
                                vVar2 = vVar;
                                long min2222222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                                long j182222222 = vVar2.f1506A;
                                uVar2 = uVar;
                                while (true) {
                                    arrayDeque = vVar2.f1527i;
                                    if (!arrayDeque.isEmpty()) {
                                    }
                                    uVar2 = (u) arrayDeque.remove();
                                }
                                if (uVar2 != null) {
                                }
                                f7 = vVar2.f1534p.f893a;
                                B0.o oVar32222222 = vVar2.f1522b;
                                if (f7 == 1.0f) {
                                }
                                j6 = ((((z) oVar32222222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                                j5 = Long.MIN_VALUE;
                            }
                        }
                        z7 = false;
                        C0224c c0224c22222 = oVar2.f1462a;
                        if (z7) {
                        }
                        if (oVar.f1474o) {
                        }
                        uVar = null;
                        long nanoTime222222222 = System.nanoTime() / 1000;
                        n nVar222222222 = oVar.f1465f;
                        nVar222222222.getClass();
                        i5 = nVar222222222.f1458a;
                        if (i5 == 1) {
                        }
                        mVar = (m) nVar222222222.f1461f;
                        if (mVar != null) {
                        }
                        long j1722222222 = (j8 * j7) / oVar.f1466g;
                        if (i5 == 2) {
                        }
                        vVar2 = vVar;
                        long min22222222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                        long j1822222222 = vVar2.f1506A;
                        uVar2 = uVar;
                        while (true) {
                            arrayDeque = vVar2.f1527i;
                            if (!arrayDeque.isEmpty()) {
                            }
                            uVar2 = (u) arrayDeque.remove();
                        }
                        if (uVar2 != null) {
                        }
                        f7 = vVar2.f1534p.f893a;
                        B0.o oVar322222222 = vVar2.f1522b;
                        if (f7 == 1.0f) {
                        }
                        j6 = ((((z) oVar322222222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                        j5 = Long.MIN_VALUE;
                    }
                    vVar = vVar4;
                    oVar = oVar2;
                    uVar = null;
                    long nanoTime2222222222 = System.nanoTime() / 1000;
                    n nVar2222222222 = oVar.f1465f;
                    nVar2222222222.getClass();
                    i5 = nVar2222222222.f1458a;
                    if (i5 == 1) {
                    }
                    mVar = (m) nVar2222222222.f1461f;
                    if (mVar != null) {
                    }
                    long j17222222222 = (j8 * j7) / oVar.f1466g;
                    if (i5 == 2) {
                    }
                    vVar2 = vVar;
                    long min222222222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
                    long j18222222222 = vVar2.f1506A;
                    uVar2 = uVar;
                    while (true) {
                        arrayDeque = vVar2.f1527i;
                        if (!arrayDeque.isEmpty()) {
                        }
                        uVar2 = (u) arrayDeque.remove();
                    }
                    if (uVar2 != null) {
                    }
                    f7 = vVar2.f1534p.f893a;
                    B0.o oVar3222222222 = vVar2.f1522b;
                    if (f7 == 1.0f) {
                    }
                    j6 = ((((z) oVar3222222222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
                    j5 = Long.MIN_VALUE;
                }
            }
            z6 = h6;
            vVar = vVar4;
            oVar = oVar2;
            uVar = null;
            long nanoTime22222222222 = System.nanoTime() / 1000;
            n nVar22222222222 = oVar.f1465f;
            nVar22222222222.getClass();
            i5 = nVar22222222222.f1458a;
            if (i5 == 1) {
            }
            mVar = (m) nVar22222222222.f1461f;
            if (mVar != null) {
            }
            long j172222222222 = (j8 * j7) / oVar.f1466g;
            if (i5 == 2) {
            }
            vVar2 = vVar;
            long min2222222222 = Math.min(j9, (vVar2.f() * 1000000) / vVar2.f1530l.e);
            long j182222222222 = vVar2.f1506A;
            uVar2 = uVar;
            while (true) {
                arrayDeque = vVar2.f1527i;
                if (!arrayDeque.isEmpty()) {
                }
                uVar2 = (u) arrayDeque.remove();
            }
            if (uVar2 != null) {
            }
            f7 = vVar2.f1534p.f893a;
            B0.o oVar32222222222 = vVar2.f1522b;
            if (f7 == 1.0f) {
            }
            j6 = ((((z) oVar32222222222.f232f).f1569q * 1000000) / vVar2.f1530l.e) + j12 + j11;
            j5 = Long.MIN_VALUE;
        } else {
            j5 = Long.MIN_VALUE;
            j6 = Long.MIN_VALUE;
        }
        if (j6 == j5) {
            if (!this.f1551F0) {
                j6 = Math.max(this.f1549D0, j6);
            }
            this.f1549D0 = j6;
            this.f1551F0 = false;
        }
    }

    @Override
    public final D d() {
        v vVar = this.f1556v0;
        D d = vVar.f1533o;
        if (d == null) {
            ArrayDeque arrayDeque = vVar.f1527i;
            if (!arrayDeque.isEmpty()) {
                return ((u) arrayDeque.getLast()).f1503a;
            }
            return vVar.f1534p;
        }
        return d;
    }

    @Override
    public final long e() {
        if (this.f958k == 2) {
            c0();
        }
        return this.f1549D0;
    }

    @Override
    public final void f(int i5, Object obj) {
        v vVar = this.f1556v0;
        if (i5 != 2) {
            if (i5 != 3) {
                if (i5 == 5) {
                    p pVar = (p) obj;
                    if (!vVar.f1518N.equals(pVar)) {
                        pVar.getClass();
                        if (vVar.f1531m != null) {
                            vVar.f1518N.getClass();
                        }
                        vVar.f1518N = pVar;
                        return;
                    }
                    return;
                }
                return;
            }
            C0068b c0068b = (C0068b) obj;
            if (!vVar.f1532n.equals(c0068b)) {
                vVar.f1532n = c0068b;
                if (!vVar.f1519O) {
                    vVar.d();
                    vVar.f1517M = 0;
                    return;
                }
                return;
            }
            return;
        }
        float floatValue = ((Float) obj).floatValue();
        if (vVar.f1507B != floatValue) {
            vVar.f1507B = floatValue;
            if (vVar.i()) {
                if (z2.q.f19694a >= 21) {
                    vVar.f1531m.setVolume(vVar.f1507B);
                    return;
                }
                AudioTrack audioTrack = vVar.f1531m;
                float f7 = vVar.f1507B;
                audioTrack.setStereoVolume(f7, f7);
            }
        }
    }

    @Override
    public final boolean h() {
        if (this.f4228n0) {
            v vVar = this.f1556v0;
            if (!vVar.i() || (vVar.f1514J && !vVar.h())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public final boolean i() {
        if (!this.f1556v0.h() && !super.i()) {
            return false;
        }
        return true;
    }

    @Override
    public final void j() {
        C2120c c2120c = this.f1555u0;
        try {
            this.f1552G0 = -9223372036854775807L;
            this.f1553H0 = 0;
            this.f1556v0.d();
            try {
                super.j();
            } finally {
            }
        } catch (Throwable th) {
            try {
                super.j();
                throw th;
            } finally {
            }
        }
    }

    @Override
    public final void k(boolean z6) {
        B0.n nVar = new B0.n(2, false);
        this.f4233r0 = nVar;
        C2120c c2120c = this.f1555u0;
        Handler handler = (Handler) c2120c.e;
        if (handler != null) {
            handler.post(new g(c2120c, nVar, 0));
        }
        int i5 = this.f956f.f902a;
        boolean z7 = false;
        v vVar = this.f1556v0;
        if (i5 != 0) {
            vVar.getClass();
            if (z2.q.f19694a >= 21) {
                z7 = true;
            }
            z2.b.f(z7);
            if (!vVar.f1519O || vVar.f1517M != i5) {
                vVar.f1519O = true;
                vVar.f1517M = i5;
                vVar.d();
                return;
            }
            return;
        }
        if (vVar.f1519O) {
            vVar.f1519O = false;
            vVar.f1517M = 0;
            vVar.d();
        }
    }

    @Override
    public final void l(long j5, boolean z6) {
        this.f4227m0 = false;
        this.f4228n0 = false;
        this.f4231q0 = false;
        if (C()) {
            J();
        }
        C1430tq c1430tq = this.f4240y;
        synchronized (c1430tq) {
            c1430tq.f13648c = 0;
            c1430tq.d = 0;
            Arrays.fill(c1430tq.f13647b, (Object) null);
        }
        this.f1556v0.d();
        this.f1549D0 = j5;
        this.f1550E0 = true;
        this.f1551F0 = true;
        this.f1552G0 = -9223372036854775807L;
        this.f1553H0 = 0;
    }

    @Override
    public final void m() {
        v vVar = this.f1556v0;
        try {
            try {
                T();
            } finally {
                this.f4194D = null;
            }
        } finally {
            vVar.l();
        }
    }

    @Override
    public final void n() {
        v vVar = this.f1556v0;
        vVar.f1516L = true;
        if (vVar.i()) {
            n nVar = vVar.f1526h.f1465f;
            nVar.getClass();
            nVar.a();
            vVar.f1531m.play();
        }
    }

    @Override
    public final void o() {
        c0();
        v vVar = this.f1556v0;
        vVar.f1516L = false;
        if (vVar.i()) {
            o oVar = vVar.f1526h;
            oVar.f1469j = 0L;
            oVar.f1480u = 0;
            oVar.f1479t = 0;
            oVar.f1470k = 0L;
            if (oVar.f1481v == -9223372036854775807L) {
                n nVar = oVar.f1465f;
                nVar.getClass();
                nVar.a();
                vVar.f1531m.pause();
            }
        }
    }

    @Override
    public final void p(I1.w[] wVarArr, long j5) {
        if (this.f1552G0 != -9223372036854775807L) {
            int i5 = this.f1553H0;
            long[] jArr = this.f1557w0;
            if (i5 == jArr.length) {
                Log.w("MediaCodecAudioRenderer", "Too many stream changes, so dropping change at " + jArr[this.f1553H0 - 1]);
            } else {
                this.f1553H0 = i5 + 1;
            }
            jArr[this.f1553H0 - 1] = this.f1552G0;
        }
    }

    @Override
    public final int w(X1.a aVar, I1.w wVar, I1.w wVar2) {
        if (a0(aVar, wVar2) <= this.f1558x0 && wVar.f1071E == 0 && wVar.f1072F == 0 && wVar2.f1071E == 0 && wVar2.f1072F == 0) {
            if (aVar.d(wVar, wVar2, true)) {
                return 3;
            }
            String str = wVar.f1083o;
            if (z2.q.a(str, wVar2.f1083o) && wVar.f1068B == wVar2.f1068B && wVar.f1069C == wVar2.f1069C && wVar.f1070D == wVar2.f1070D && wVar.t(wVar2) && !"audio/opus".equals(str)) {
                return 1;
            }
        }
        return 0;
    }

    @Override
    public final void x(X1.a aVar, MediaCodec mediaCodec, I1.w wVar, MediaCrypto mediaCrypto, float f7) {
        boolean z6;
        boolean z7;
        boolean z8;
        String str;
        MediaFormat mediaFormat;
        String str2;
        I1.w[] wVarArr = this.f960m;
        int a02 = a0(aVar, wVar);
        if (wVarArr.length != 1) {
            for (I1.w wVar2 : wVarArr) {
                if (aVar.d(wVar, wVar2, false)) {
                    a02 = Math.max(a02, a0(aVar, wVar2));
                }
            }
        }
        this.f1558x0 = a02;
        int i5 = z2.q.f19694a;
        String str3 = aVar.f4182a;
        if (i5 < 24 && "OMX.SEC.aac.dec".equals(str3) && "samsung".equals(z2.q.f19696c)) {
            String str4 = z2.q.f19695b;
            if (str4.startsWith("zeroflte") || str4.startsWith("herolte") || str4.startsWith("heroqlte")) {
                z6 = true;
                this.f1560z0 = z6;
                if (i5 < 21 && "OMX.SEC.mp3.dec".equals(str3) && "samsung".equals(z2.q.f19696c)) {
                    str2 = z2.q.f19695b;
                    if (!str2.startsWith("baffin") || str2.startsWith("grand") || str2.startsWith("fortuna") || str2.startsWith("gprimelte") || str2.startsWith("j2y18lte") || str2.startsWith("ms01")) {
                        z7 = true;
                        this.f1546A0 = z7;
                        z8 = aVar.f4186g;
                        this.f1559y0 = z8;
                        if (!z8) {
                            str = "audio/raw";
                        } else {
                            str = aVar.f4184c;
                        }
                        int i6 = this.f1558x0;
                        mediaFormat = new MediaFormat();
                        mediaFormat.setString("mime", str);
                        mediaFormat.setInteger("channel-count", wVar.f1068B);
                        mediaFormat.setInteger("sample-rate", wVar.f1069C);
                        com.bumptech.glide.e.p(mediaFormat, wVar.f1085q);
                        com.bumptech.glide.e.j(mediaFormat, "max-input-size", i6);
                        if (i5 >= 23) {
                            mediaFormat.setInteger("priority", 0);
                            if (f7 != -1.0f) {
                                if (i5 == 23) {
                                    String str5 = z2.q.d;
                                    if (!"ZTE B2017G".equals(str5)) {
                                    }
                                }
                                mediaFormat.setFloat("operating-rate", f7);
                            }
                        }
                        String str6 = wVar.f1083o;
                        if (i5 <= 28 && "audio/ac4".equals(str6)) {
                            mediaFormat.setInteger("ac4-is-sync", 1);
                        }
                        mediaCodec.configure(mediaFormat, (Surface) null, mediaCrypto, 0);
                        if (!this.f1559y0) {
                            this.f1547B0 = mediaFormat;
                            mediaFormat.setString("mime", str6);
                            return;
                        } else {
                            this.f1547B0 = null;
                            return;
                        }
                    }
                }
                z7 = false;
                this.f1546A0 = z7;
                z8 = aVar.f4186g;
                this.f1559y0 = z8;
                if (!z8) {
                }
                int i62 = this.f1558x0;
                mediaFormat = new MediaFormat();
                mediaFormat.setString("mime", str);
                mediaFormat.setInteger("channel-count", wVar.f1068B);
                mediaFormat.setInteger("sample-rate", wVar.f1069C);
                com.bumptech.glide.e.p(mediaFormat, wVar.f1085q);
                com.bumptech.glide.e.j(mediaFormat, "max-input-size", i62);
                if (i5 >= 23) {
                }
                String str62 = wVar.f1083o;
                if (i5 <= 28) {
                    mediaFormat.setInteger("ac4-is-sync", 1);
                }
                mediaCodec.configure(mediaFormat, (Surface) null, mediaCrypto, 0);
                if (!this.f1559y0) {
                }
            }
        }
        z6 = false;
        this.f1560z0 = z6;
        if (i5 < 21) {
            str2 = z2.q.f19695b;
            if (!str2.startsWith("baffin")) {
            }
            z7 = true;
            this.f1546A0 = z7;
            z8 = aVar.f4186g;
            this.f1559y0 = z8;
            if (!z8) {
            }
            int i622 = this.f1558x0;
            mediaFormat = new MediaFormat();
            mediaFormat.setString("mime", str);
            mediaFormat.setInteger("channel-count", wVar.f1068B);
            mediaFormat.setInteger("sample-rate", wVar.f1069C);
            com.bumptech.glide.e.p(mediaFormat, wVar.f1085q);
            com.bumptech.glide.e.j(mediaFormat, "max-input-size", i622);
            if (i5 >= 23) {
            }
            String str622 = wVar.f1083o;
            if (i5 <= 28) {
            }
            mediaCodec.configure(mediaFormat, (Surface) null, mediaCrypto, 0);
            if (!this.f1559y0) {
            }
        }
        z7 = false;
        this.f1546A0 = z7;
        z8 = aVar.f4186g;
        this.f1559y0 = z8;
        if (!z8) {
        }
        int i6222 = this.f1558x0;
        mediaFormat = new MediaFormat();
        mediaFormat.setString("mime", str);
        mediaFormat.setInteger("channel-count", wVar.f1068B);
        mediaFormat.setInteger("sample-rate", wVar.f1069C);
        com.bumptech.glide.e.p(mediaFormat, wVar.f1085q);
        com.bumptech.glide.e.j(mediaFormat, "max-input-size", i6222);
        if (i5 >= 23) {
        }
        String str6222 = wVar.f1083o;
        if (i5 <= 28) {
        }
        mediaCodec.configure(mediaFormat, (Surface) null, mediaCrypto, 0);
        if (!this.f1559y0) {
        }
    }

    @Override
    public final z2.g c() {
        return this;
    }
}