package D;

import a0.r;
import android.os.Handler;
import android.os.SystemClock;
import android.util.Log;
import b0.AbstractC0399d;
import java.io.IOException;
import java.util.Arrays;
import java.util.LinkedList;
import n.C0633A;
import n.InterfaceC0634B;
import n.x;
import n.y;
import p.InterfaceC0689a;

/* JADX INFO: loaded from: classes.dex */
public final class j implements InterfaceC0634B, InterfaceC0634B.a, r.a {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    private p.c f391A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    private m f392B;

    /* JADX INFO: renamed from: C, reason: collision with root package name */
    private m f393C;

    /* JADX INFO: renamed from: D, reason: collision with root package name */
    private r f394D;

    /* JADX INFO: renamed from: E, reason: collision with root package name */
    private IOException f395E;

    /* JADX INFO: renamed from: F, reason: collision with root package name */
    private int f396F;

    /* JADX INFO: renamed from: G, reason: collision with root package name */
    private long f397G;

    /* JADX INFO: renamed from: H, reason: collision with root package name */
    private long f398H;

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private final D.c f399a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private final LinkedList f400b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private final int f401c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private final int f402d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private final p.e f403e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private final int f404f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private final n.n f405g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private final Handler f406h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private final f f407i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    private int f408j;

    /* JADX INFO: renamed from: k, reason: collision with root package name */
    private boolean f409k;

    /* JADX INFO: renamed from: l, reason: collision with root package name */
    private boolean f410l;

    /* JADX INFO: renamed from: m, reason: collision with root package name */
    private int f411m;

    /* JADX INFO: renamed from: n, reason: collision with root package name */
    private int f412n;

    /* JADX INFO: renamed from: o, reason: collision with root package name */
    private p.j f413o;

    /* JADX INFO: renamed from: p, reason: collision with root package name */
    private x[] f414p;

    /* JADX INFO: renamed from: q, reason: collision with root package name */
    private boolean[] f415q;

    /* JADX INFO: renamed from: r, reason: collision with root package name */
    private boolean[] f416r;

    /* JADX INFO: renamed from: s, reason: collision with root package name */
    private x[] f417s;

    /* JADX INFO: renamed from: t, reason: collision with root package name */
    private int[] f418t;

    /* JADX INFO: renamed from: u, reason: collision with root package name */
    private int[] f419u;

    /* JADX INFO: renamed from: v, reason: collision with root package name */
    private boolean[] f420v;

    /* JADX INFO: renamed from: w, reason: collision with root package name */
    private long f421w;

    /* JADX INFO: renamed from: x, reason: collision with root package name */
    private long f422x;

    /* JADX INFO: renamed from: y, reason: collision with root package name */
    private long f423y;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    private boolean f424z;

    class a implements Runnable {

        /* JADX INFO: renamed from: H, reason: collision with root package name */
        final /* synthetic */ long f425H;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ long f427b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ int f428g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        final /* synthetic */ int f429r;

        /* JADX INFO: renamed from: x, reason: collision with root package name */
        final /* synthetic */ p.j f430x;

        /* JADX INFO: renamed from: y, reason: collision with root package name */
        final /* synthetic */ long f431y;

        a(long j2, int i2, int i3, p.j jVar, long j3, long j4) {
            this.f427b = j2;
            this.f428g = i2;
            this.f429r = i3;
            this.f430x = jVar;
            this.f431y = j3;
            this.f425H = j4;
        }

        @Override // java.lang.Runnable
        public void run() {
            b0.o.d("HlsSampleSource", "notifyLoadStarted.run", 4);
            j.this.f407i.onLoadStarted(j.this.f404f, this.f427b, this.f428g, this.f429r, this.f430x, j.this.N(this.f431y), j.this.N(this.f425H));
        }
    }

    class b implements Runnable {

        /* JADX INFO: renamed from: H, reason: collision with root package name */
        final /* synthetic */ long f432H;

        /* JADX INFO: renamed from: I, reason: collision with root package name */
        final /* synthetic */ long f433I;

        /* JADX INFO: renamed from: L, reason: collision with root package name */
        final /* synthetic */ long f434L;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ long f436b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ int f437g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        final /* synthetic */ int f438r;

        /* JADX INFO: renamed from: x, reason: collision with root package name */
        final /* synthetic */ p.j f439x;

        /* JADX INFO: renamed from: y, reason: collision with root package name */
        final /* synthetic */ long f440y;

        b(long j2, int i2, int i3, p.j jVar, long j3, long j4, long j5, long j6) {
            this.f436b = j2;
            this.f437g = i2;
            this.f438r = i3;
            this.f439x = jVar;
            this.f440y = j3;
            this.f432H = j4;
            this.f433I = j5;
            this.f434L = j6;
        }

        @Override // java.lang.Runnable
        public void run() {
            b0.o.d("HlsSampleSource", "notifyLoadCompleted", 4);
            j.this.f407i.onLoadCompleted(j.this.f404f, this.f436b, this.f437g, this.f438r, this.f439x, j.this.N(this.f440y), j.this.N(this.f432H), this.f433I, this.f434L);
        }
    }

    class c implements Runnable {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ long f441b;

        c(long j2) {
            this.f441b = j2;
        }

        @Override // java.lang.Runnable
        public void run() {
            j.this.f407i.h(j.this.f404f, this.f441b);
        }
    }

    class d implements Runnable {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ IOException f443b;

        d(IOException iOException) {
            this.f443b = iOException;
        }

        @Override // java.lang.Runnable
        public void run() {
            j.this.f407i.a(j.this.f404f, this.f443b);
        }
    }

    class e implements Runnable {

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ p.j f445b;

        /* JADX INFO: renamed from: g, reason: collision with root package name */
        final /* synthetic */ int f446g;

        /* JADX INFO: renamed from: r, reason: collision with root package name */
        final /* synthetic */ long f447r;

        e(p.j jVar, int i2, long j2) {
            this.f445b = jVar;
            this.f446g = i2;
            this.f447r = j2;
        }

        @Override // java.lang.Runnable
        public void run() {
            j.this.f407i.c(j.this.f404f, this.f445b, this.f446g, j.this.N(this.f447r));
        }
    }

    public interface f extends InterfaceC0689a {
    }

    public j(D.c cVar, n.n nVar, int i2, Handler handler, f fVar, int i3) {
        this(cVar, nVar, i2, handler, fVar, i3, 3);
    }

    private boolean A(D.d dVar) {
        if (!dVar.o()) {
            return false;
        }
        int i2 = 0;
        while (true) {
            boolean[] zArr = this.f420v;
            if (i2 >= zArr.length) {
                return false;
            }
            if (zArr[i2] && dVar.l(i2)) {
                return true;
            }
            i2++;
        }
    }

    private boolean B() {
        return this.f423y != Long.MIN_VALUE;
    }

    private boolean C(p.c cVar) {
        return cVar instanceof m;
    }

    private boolean D() {
        return this.f399a.u();
    }

    private void E() {
        int i2;
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        long jY = y();
        boolean z2 = this.f395E != null;
        boolean zC = this.f405g.c(this, this.f421w, jY, this.f394D.d() || z2);
        if (z2 && !D() && (i2 = this.f396F) < this.f401c) {
            if (jElapsedRealtime - this.f397G >= z(i2)) {
                this.f395E = null;
                this.f394D.g(this.f391A, this);
                return;
            }
            return;
        }
        if (this.f394D.d() || !zC) {
            return;
        }
        if (this.f409k && this.f412n == 0) {
            return;
        }
        D.c cVar = this.f399a;
        m mVar = this.f393C;
        long j2 = this.f423y;
        if (j2 == Long.MIN_VALUE) {
            j2 = this.f421w;
        }
        cVar.g(mVar, j2, this.f403e);
        p.e eVar = this.f403e;
        boolean z3 = eVar.f6099c;
        p.c cVar2 = eVar.f6098b;
        eVar.a();
        if (z3) {
            this.f424z = true;
            this.f405g.c(this, this.f421w, -1L, false);
            return;
        }
        if (cVar2 == null) {
            b0.o.d("HlsSampleSource", "nextLoadable is null", 4);
            return;
        }
        if (this.f394D.d()) {
            b0.o.d("HlsSampleSource", "Loader is working", 4);
            return;
        }
        this.f398H = jElapsedRealtime;
        this.f391A = cVar2;
        if (C(cVar2)) {
            m mVar2 = (m) this.f391A;
            if (B()) {
                this.f423y = Long.MIN_VALUE;
            }
            D.d dVar = mVar2.f451k;
            if (this.f400b.isEmpty() || this.f400b.getLast() != dVar) {
                dVar.n(this.f405g.e());
                this.f400b.addLast(dVar);
            }
            J(mVar2.f6089d.f1944e, mVar2.f6086a, mVar2.f6087b, mVar2.f6088c, mVar2.f6193g, mVar2.f6194h);
            this.f392B = mVar2;
        } else {
            p.c cVar3 = this.f391A;
            J(cVar3.f6089d.f1944e, cVar3.f6086a, cVar3.f6087b, cVar3.f6088c, -1L, -1L);
        }
        this.f394D.g(this.f391A, this);
    }

    private void F(p.j jVar, int i2, long j2) {
        Handler handler = this.f406h;
        if (handler == null || this.f407i == null) {
            return;
        }
        handler.post(new e(jVar, i2, j2));
    }

    private void G(long j2) {
        b0.o.d("HlsSampleSource", "notifyLoadCanceled", 4);
        Handler handler = this.f406h;
        if (handler == null || this.f407i == null) {
            return;
        }
        handler.post(new c(j2));
    }

    private void H(long j2, int i2, int i3, p.j jVar, long j3, long j4, long j5, long j6) {
        Handler handler = this.f406h;
        if (handler == null || this.f407i == null) {
            return;
        }
        handler.post(new b(j2, i2, i3, jVar, j3, j4, j5, j6));
    }

    private void I(IOException iOException) {
        Handler handler = this.f406h;
        if (handler == null || this.f407i == null) {
            return;
        }
        handler.post(new d(iOException));
    }

    private void J(long j2, int i2, int i3, p.j jVar, long j3, long j4) {
        Handler handler = this.f406h;
        if (handler == null || this.f407i == null) {
            return;
        }
        handler.post(new a(j2, i2, i3, jVar, j3, j4));
    }

    private void K(long j2) {
        this.f423y = j2;
        this.f424z = false;
        if (this.f394D.d()) {
            this.f394D.c();
        } else {
            q();
            E();
        }
    }

    private void L(long j2) {
        Log.i("HlsSampleSource", "seekToInternal [" + j2 + "]");
        this.f422x = j2;
        this.f421w = j2;
        Arrays.fill(this.f416r, true);
        this.f399a.C();
        K(j2);
    }

    private void M(int i2, boolean z2) {
        AbstractC0399d.e(this.f415q[i2] != z2);
        int i3 = this.f419u[i2];
        AbstractC0399d.e(this.f420v[i3] != z2);
        this.f415q[i2] = z2;
        this.f420v[i3] = z2;
        this.f412n += z2 ? 1 : -1;
    }

    private void i(D.d dVar) {
        char c2;
        int iK = dVar.k();
        int i2 = -1;
        int i3 = 0;
        char c3 = 0;
        while (true) {
            if (i3 >= iK) {
                break;
            }
            String str = dVar.h(i3).f5842g;
            if (b0.k.g(str)) {
                c2 = 3;
            } else if (b0.k.d(str)) {
                c2 = 2;
            } else if (!b0.k.e(str)) {
                c2 = 0;
            }
            if (c2 > c3) {
                i2 = i3;
                c3 = c2;
            } else if (c2 == c3 && i2 != -1) {
                i2 = -1;
            }
            i3++;
        }
        int iP = this.f399a.p();
        c2 = i2 == -1 ? (char) 0 : (char) 1;
        this.f411m = iK;
        if (c2 != 0) {
            this.f411m = (iP - 1) + iK;
        }
        int i4 = this.f411m;
        this.f414p = new x[i4];
        this.f415q = new boolean[i4];
        this.f416r = new boolean[i4];
        this.f417s = new x[i4];
        this.f418t = new int[i4];
        this.f419u = new int[i4];
        this.f420v = new boolean[iK];
        long jH = this.f399a.h();
        int i5 = 0;
        for (int i6 = 0; i6 < iK; i6++) {
            x xVarB = dVar.h(i6).b(jH);
            String strL = b0.k.d(xVarB.f5842g) ? this.f399a.l() : "application/eia-608".equals(xVarB.f5842g) ? this.f399a.m() : null;
            if (i6 == i2) {
                int i7 = 0;
                while (i7 < iP) {
                    this.f419u[i5] = i6;
                    this.f418t[i5] = i7;
                    n nVarI = this.f399a.i(i7);
                    int i8 = i5 + 1;
                    this.f414p[i5] = nVarI == null ? xVarB.a(null) : u(xVarB, nVarI.f457b, strL);
                    i7++;
                    i5 = i8;
                }
            } else {
                this.f419u[i5] = i6;
                this.f418t[i5] = -1;
                this.f414p[i5] = xVarB.e(strL);
                i5++;
            }
        }
    }

    private void m() {
        this.f392B = null;
        this.f391A = null;
        this.f395E = null;
        this.f396F = 0;
    }

    private void q() {
        for (int i2 = 0; i2 < this.f400b.size(); i2++) {
            ((D.d) this.f400b.get(i2)).a();
        }
        this.f400b.clear();
        m();
        this.f393C = null;
    }

    private static x u(x xVar, p.j jVar, String str) {
        int i2 = jVar.f6168d;
        int i3 = i2 == -1 ? -1 : i2;
        int i4 = jVar.f6169e;
        int i5 = i4 == -1 ? -1 : i4;
        String str2 = jVar.f6174j;
        return xVar.c(jVar.f6165a, jVar.f6167c, i3, i5, str2 == null ? str : str2);
    }

    private void w(D.d dVar, long j2) {
        if (!dVar.o()) {
            return;
        }
        int i2 = 0;
        while (true) {
            boolean[] zArr = this.f420v;
            if (i2 >= zArr.length) {
                return;
            }
            if (!zArr[i2]) {
                dVar.d(i2, j2);
            }
            i2++;
        }
    }

    private D.d x() {
        D.d dVar;
        Object first = this.f400b.getFirst();
        while (true) {
            dVar = (D.d) first;
            if (this.f400b.size() <= 1 || A(dVar)) {
                break;
            }
            ((D.d) this.f400b.removeFirst()).a();
            first = this.f400b.getFirst();
        }
        return dVar;
    }

    private long y() {
        if (B()) {
            return this.f423y;
        }
        if (this.f424z || (this.f409k && this.f412n == 0)) {
            return -1L;
        }
        m mVar = this.f392B;
        if (mVar == null) {
            mVar = this.f393C;
        }
        return mVar.f6194h;
    }

    private long z(long j2) {
        return Math.min((j2 - 1) * 1000, 5000L);
    }

    long N(long j2) {
        return j2 / 1000;
    }

    @Override // n.InterfaceC0634B.a
    public x a(int i2) {
        AbstractC0399d.e(this.f409k);
        return this.f414p[i2];
    }

    @Override // n.InterfaceC0634B.a
    public int c() {
        AbstractC0399d.e(this.f409k);
        b0.o.d("HlsSampleSource", "trackCount[" + this.f411m + "]", 4);
        return this.f411m;
    }

    @Override // n.InterfaceC0634B.a
    public void d(int i2, long j2) {
        AbstractC0399d.e(this.f409k);
        M(i2, true);
        this.f417s[i2] = null;
        this.f416r[i2] = false;
        this.f413o = null;
        boolean z2 = this.f410l;
        if (!z2) {
            this.f405g.a(this, this.f402d);
            this.f410l = true;
        }
        if (this.f399a.t()) {
            j2 = 0;
        }
        int i3 = this.f418t[i2];
        if (i3 != -1 && i3 != this.f399a.o()) {
            this.f399a.D(i3);
            L(j2);
        } else if (this.f412n == 1) {
            this.f422x = j2;
            if (z2 && this.f421w == j2) {
                E();
            } else {
                this.f421w = j2;
                K(j2);
            }
        }
    }

    @Override // n.InterfaceC0634B.a
    public void e() throws IOException {
        IOException iOException = this.f395E;
        if (iOException != null && this.f396F > this.f401c) {
            throw iOException;
        }
        if (this.f391A == null) {
            this.f399a.v();
        }
    }

    @Override // n.InterfaceC0634B.a
    public boolean f(int i2, long j2) {
        AbstractC0399d.e(this.f409k);
        AbstractC0399d.e(this.f415q[i2]);
        this.f421w = j2;
        if (!this.f400b.isEmpty()) {
            w(x(), this.f421w);
        }
        E();
        if (this.f424z) {
            return true;
        }
        if (!B() && !this.f400b.isEmpty()) {
            for (int i3 = 0; i3 < this.f400b.size(); i3++) {
                D.d dVar = (D.d) this.f400b.get(i3);
                if (!dVar.o()) {
                    break;
                }
                if (dVar.l(this.f419u[i2])) {
                    return true;
                }
            }
        }
        return false;
    }

    @Override // n.InterfaceC0634B.a
    public int h() {
        return this.f399a.q();
    }

    @Override // n.InterfaceC0634B.a
    public long j(int i2) {
        boolean[] zArr = this.f416r;
        if (!zArr[i2]) {
            return Long.MIN_VALUE;
        }
        zArr[i2] = false;
        return this.f422x;
    }

    @Override // n.InterfaceC0634B.a
    public void k(int i2) {
        AbstractC0399d.e(this.f409k);
        M(i2, false);
        if (this.f412n == 0) {
            this.f399a.B();
            this.f421w = Long.MIN_VALUE;
            if (this.f410l) {
                this.f405g.d(this);
                this.f410l = false;
            }
            if (this.f394D.d()) {
                this.f394D.c();
            } else {
                q();
                this.f405g.b();
            }
        }
    }

    @Override // a0.r.a
    public void l(r.c cVar) {
        AbstractC0399d.e(cVar == this.f391A);
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        long j2 = jElapsedRealtime - this.f398H;
        this.f399a.y(this.f391A);
        if (C(this.f391A)) {
            AbstractC0399d.e(this.f391A == this.f392B);
            this.f393C = this.f392B;
            long jF = this.f391A.f();
            m mVar = this.f392B;
            H(jF, mVar.f6086a, mVar.f6087b, mVar.f6088c, mVar.f6193g, mVar.f6194h, jElapsedRealtime, j2);
        } else {
            long jF2 = this.f391A.f();
            p.c cVar2 = this.f391A;
            H(jF2, cVar2.f6086a, cVar2.f6087b, cVar2.f6088c, -1L, -1L, jElapsedRealtime, j2);
        }
        m();
        E();
    }

    @Override // a0.r.a
    public void n(r.c cVar, IOException iOException) {
        b0.o.d("HlsSampleSource", "onLoadError", 4);
        if (this.f399a.z(this.f391A, iOException)) {
            if (this.f393C == null && !B()) {
                this.f423y = this.f422x;
            }
            m();
        } else {
            this.f395E = iOException;
            this.f396F++;
            b0.o.d("HlsSampleSource", "currentLoadableExceptionCount[" + this.f396F + "]", 4);
            this.f397G = SystemClock.elapsedRealtime();
        }
        I(iOException);
        E();
    }

    @Override // n.InterfaceC0634B.a
    public void o(long j2) {
        AbstractC0399d.e(this.f409k);
        AbstractC0399d.e(this.f412n > 0);
        if (this.f399a.t()) {
            j2 = 0;
        }
        long j3 = B() ? this.f423y : this.f421w;
        this.f421w = j2;
        this.f422x = j2;
        Log.i("HlsSampleSource", "seekToUs[" + j2 + "] currentPositionUs[" + j3 + "]");
        if (j3 == j2) {
            return;
        }
        L(j2);
    }

    @Override // n.InterfaceC0634B
    public InterfaceC0634B.a p() {
        this.f408j++;
        return this;
    }

    @Override // n.InterfaceC0634B.a
    public int r(int i2, long j2, y yVar, C0633A c0633a) {
        AbstractC0399d.e(this.f409k);
        this.f421w = j2;
        if (!this.f416r[i2] && !B()) {
            D.d dVarX = x();
            if (!dVarX.o()) {
                return -2;
            }
            p.j jVar = dVarX.f335b;
            if (!jVar.equals(this.f413o)) {
                F(jVar, dVarX.f334a, dVarX.f336c);
            }
            this.f413o = jVar;
            if (this.f400b.size() > 1) {
                dVarX.c((D.d) this.f400b.get(1));
            }
            int i3 = this.f419u[i2];
            int i4 = 0;
            do {
                i4++;
                if (this.f400b.size() <= i4 || dVarX.l(i3)) {
                    x xVarH = dVarX.h(i3);
                    if (xVarH != null) {
                        if (!xVarH.equals(this.f417s[i2])) {
                            yVar.f5857a = xVarH;
                            this.f417s[i2] = xVarH;
                            return -4;
                        }
                        this.f417s[i2] = xVarH;
                    }
                    if (c0633a == null) {
                        return -2;
                    }
                    if (dVarX.j(i3, c0633a)) {
                        c0633a.f5411d |= c0633a.f5412e < this.f422x ? 134217728 : 0;
                        return -3;
                    }
                    if (this.f424z) {
                        return -1;
                    }
                } else {
                    dVarX = (D.d) this.f400b.get(i4);
                }
            } while (dVarX.o());
            return -2;
        }
        return -2;
    }

    @Override // n.InterfaceC0634B.a
    public void release() {
        AbstractC0399d.e(this.f408j > 0);
        int i2 = this.f408j - 1;
        this.f408j = i2;
        if (i2 != 0 || this.f394D == null) {
            return;
        }
        if (this.f410l) {
            this.f405g.d(this);
            this.f410l = false;
        }
        this.f394D.e();
        this.f394D = null;
    }

    @Override // n.InterfaceC0634B.a
    public boolean s(long j2) {
        if (this.f409k) {
            return true;
        }
        if (!this.f399a.A()) {
            return false;
        }
        if (!this.f400b.isEmpty()) {
            while (true) {
                D.d dVar = (D.d) this.f400b.getFirst();
                if (!dVar.o()) {
                    if (this.f400b.size() <= 1) {
                        break;
                    }
                    ((D.d) this.f400b.removeFirst()).a();
                } else {
                    i(dVar);
                    this.f409k = true;
                    E();
                    return true;
                }
            }
        }
        if (this.f394D == null) {
            this.f394D = new r("Loader:HLS");
            this.f405g.a(this, this.f402d);
            this.f410l = true;
        }
        if (!this.f394D.d()) {
            this.f423y = j2;
            this.f421w = j2;
        }
        E();
        return false;
    }

    @Override // n.InterfaceC0634B.a
    public long t() {
        AbstractC0399d.e(this.f409k);
        AbstractC0399d.e(this.f412n > 0);
        if (B()) {
            return this.f423y;
        }
        if (this.f424z) {
            return -3L;
        }
        long jF = ((D.d) this.f400b.getLast()).f();
        if (this.f400b.size() > 1) {
            jF = Math.max(jF, ((D.d) this.f400b.get(r0.size() - 2)).f());
        }
        return jF == Long.MIN_VALUE ? this.f421w : jF;
    }

    @Override // a0.r.a
    public void v(r.c cVar) {
        G(this.f391A.f());
        if (this.f412n > 0) {
            K(this.f423y);
        } else {
            q();
            this.f405g.b();
        }
    }

    public j(D.c cVar, n.n nVar, int i2, Handler handler, f fVar, int i3, int i4) {
        this.f399a = cVar;
        this.f405g = nVar;
        this.f402d = i2;
        this.f401c = i4;
        this.f406h = handler;
        this.f407i = fVar;
        this.f404f = i3;
        this.f423y = Long.MIN_VALUE;
        this.f396F = 0;
        this.f400b = new LinkedList();
        this.f403e = new p.e();
    }
}
