MD5 校验值:328357c6f846d37b47ed4cc8f5415f3d
j2.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package d.f.a.b; import android.annotation.SuppressLint; import android.content.Context; import android.graphics.SurfaceTexture; import android.media.AudioTrack; import android.media.MediaFormat; import android.media.metrics.LogSessionId; import android.os.Handler; import android.os.Looper; import android.util.Pair; import android.view.Surface; import android.view.SurfaceHolder; import android.view.TextureView; import d.f.a.b.f3; import d.f.a.b.g4.l0; import d.f.a.b.g4.v0; import d.f.a.b.h3; import d.f.a.b.i2; import d.f.a.b.j2; import d.f.a.b.k2; import d.f.a.b.k4.s; import d.f.a.b.l4.a0.f; import d.f.a.b.s3; import d.f.a.b.u1; import d.f.a.b.u3; import d.f.a.b.v1; import d.f.a.b.z2; import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.List; import java.util.concurrent.CopyOnWriteArraySet; import java.util.concurrent.TimeoutException; public final class j2 extends w1 implements i2 { private final v1 A; private final s3 B; private final w3 C; private final x3 D; private final long E; private int F; private boolean G; private int H; private int I; private boolean J; private int K; private q3 L; private d.f.a.b.g4.v0 M; private boolean N; private f3.b O; private u2 P; private u2 Q; private n2 R; private n2 S; private AudioTrack T; private Object U; private Surface V; private SurfaceHolder W; private d.f.a.b.l4.a0.f X; private boolean Y; private TextureView Z; private int a0; final d.f.a.b.i4.d0 f4935b; private int b0; final f3.b f4936c; private int c0; private final d.f.a.b.k4.k f4937d; private int d0; private final Context f4938e; private d.f.a.b.a4.e e0; private final f3 f4939f; private d.f.a.b.a4.e f0; private final l3[] f4940g; private int g0; private final d.f.a.b.i4.c0 f4941h; private d.f.a.b.z3.p h0; private final d.f.a.b.k4.r f4942i; private float i0; private final k2.f f4943j; private boolean j0; private final k2 f4944k; private d.f.a.b.h4.e k0; private final d.f.a.b.k4.s<f3.d> f4945l; private boolean l0; private final CopyOnWriteArraySet<i2.a> f4946m; private boolean m0; private final u3.b n; private d.f.a.b.k4.d0 n0; private final List<e> o; private boolean o0; private final boolean p; private boolean p0; private final l0.a q; private f2 q0; private final d.f.a.b.y3.n1 r; private d.f.a.b.l4.z r0; private final Looper s; private u2 s0; private final d.f.a.b.j4.l t; private d3 t0; private final long u; private int u0; private final long v; private int v0; private final d.f.a.b.k4.h w; private long w0; private final c x; private final d y; private final u1 z; private static final class b { public static d.f.a.b.y3.u1 a(Context context, j2 j2Var, boolean z) { d.f.a.b.y3.s1 B0 = d.f.a.b.y3.s1.B0(context); if (B0 == null) { d.f.a.b.k4.t.i("ExoPlayerImpl", "MediaMetricsService unavailable."); return new d.f.a.b.y3.u1(LogSessionId.LOG_SESSION_ID_NONE); } if (z) { j2Var.y0(B0); } return new d.f.a.b.y3.u1(B0.I0()); } } public final class c implements d.f.a.b.l4.y, d.f.a.b.z3.t, d.f.a.b.h4.n, d.f.a.b.e4.f, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, f.a, v1.b, u1.b, s3.b, i2.a { private c() { } public void K(f3.d dVar) { dVar.e0(j2.this.P); } @Override public void A(n2 n2Var) { d.f.a.b.l4.x.a(this, n2Var); } @Override public void B(n2 n2Var) { d.f.a.b.z3.s.a(this, n2Var); } @Override public void C(int i2) { final f2 C0 = j2.C0(j2.this.B); if (C0.equals(j2.this.q0)) { return; } j2.this.q0 = C0; j2.this.f4945l.j(29, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).c0(f2.this); } }); } @Override public void D(boolean z) { h2.a(this, z); } @Override public void E() { j2.this.O1(false, -1, 3); } @Override public void F(boolean z) { j2.this.R1(); } @Override public void G(float f2) { j2.this.F1(); } @Override public void a(int i2) { boolean s = j2.this.s(); j2.this.O1(s, i2, j2.M0(s, i2)); } @Override public void b(final boolean z) { if (j2.this.j0 == z) { return; } j2.this.j0 = z; j2.this.f4945l.j(23, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).b(z); } }); } @Override public void c(Exception exc) { j2.this.r.c(exc); } @Override public void d(n2 n2Var, d.f.a.b.a4.i iVar) { j2.this.S = n2Var; j2.this.r.d(n2Var, iVar); } @Override public void e(d.f.a.b.a4.e eVar) { j2.this.r.e(eVar); j2.this.S = null; j2.this.f0 = null; } @Override public void f(String str) { j2.this.r.f(str); } @Override public void g(d.f.a.b.a4.e eVar) { j2.this.f0 = eVar; j2.this.r.g(eVar); } @Override public void h(Object obj, long j2) { j2.this.r.h(obj, j2); if (j2.this.U == obj) { j2.this.f4945l.j(26, new s.a() { @Override public final void b(Object obj2) { ((f3.d) obj2).M(); } }); } } @Override public void i(String str, long j2, long j3) { j2.this.r.i(str, j2, j3); } @Override public void j(Surface surface) { j2.this.K1(null); } @Override public void k(final List<d.f.a.b.h4.c> list) { j2.this.f4945l.j(27, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).k(list); } }); } @Override public void l(d.f.a.b.a4.e eVar) { j2.this.e0 = eVar; j2.this.r.l(eVar); } @Override public void m(n2 n2Var, d.f.a.b.a4.i iVar) { j2.this.R = n2Var; j2.this.r.m(n2Var, iVar); } @Override public void n(long j2) { j2.this.r.n(j2); } @Override public void o(Exception exc) { j2.this.r.o(exc); } @Override public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i2, int i3) { j2.this.J1(surfaceTexture); j2.this.z1(i2, i3); } @Override public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) { j2.this.K1(null); j2.this.z1(0, 0); return true; } @Override public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i2, int i3) { j2.this.z1(i2, i3); } @Override public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { } @Override public void p(Exception exc) { j2.this.r.p(exc); } @Override public void q(final d.f.a.b.l4.z zVar) { j2.this.r0 = zVar; j2.this.f4945l.j(25, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).q(d.f.a.b.l4.z.this); } }); } @Override public void r(final d.f.a.b.h4.e eVar) { j2.this.k0 = eVar; j2.this.f4945l.j(27, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).r(d.f.a.b.h4.e.this); } }); } @Override public void s(d.f.a.b.a4.e eVar) { j2.this.r.s(eVar); j2.this.R = null; j2.this.e0 = null; } @Override public void surfaceChanged(SurfaceHolder surfaceHolder, int i2, int i3, int i4) { j2.this.z1(i3, i4); } @Override public void surfaceCreated(SurfaceHolder surfaceHolder) { if (j2.this.Y) { j2.this.K1(surfaceHolder.getSurface()); } } @Override public void surfaceDestroyed(SurfaceHolder surfaceHolder) { if (j2.this.Y) { j2.this.K1(null); } j2.this.z1(0, 0); } @Override public void t(String str) { j2.this.r.t(str); } @Override public void u(String str, long j2, long j3) { j2.this.r.u(str, j2, j3); } @Override public void v(final int i2, final boolean z) { j2.this.f4945l.j(30, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).o0(i2, z); } }); } @Override public void w(final d.f.a.b.e4.a aVar) { j2 j2Var = j2.this; j2Var.s0 = j2Var.s0.a().I(aVar).F(); u2 B0 = j2.this.B0(); if (!B0.equals(j2.this.P)) { j2.this.P = B0; j2.this.f4945l.h(14, new s.a() { @Override public final void b(Object obj) { j2.c.this.K((f3.d) obj); } }); } j2.this.f4945l.h(28, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).w(d.f.a.b.e4.a.this); } }); j2.this.f4945l.d(); } @Override public void x(int i2, long j2, long j3) { j2.this.r.x(i2, j2, j3); } @Override public void y(int i2, long j2) { j2.this.r.y(i2, j2); } @Override public void z(long j2, int i2) { j2.this.r.z(j2, i2); } } public static final class d implements d.f.a.b.l4.v, d.f.a.b.l4.a0.b, h3.b { private d.f.a.b.l4.v p; private d.f.a.b.l4.a0.b q; private d.f.a.b.l4.v r; private d.f.a.b.l4.a0.b s; private d() { } @Override public void a(long j2, float[] fArr) { d.f.a.b.l4.a0.b bVar = this.s; if (bVar != null) { bVar.a(j2, fArr); } d.f.a.b.l4.a0.b bVar2 = this.q; if (bVar2 != null) { bVar2.a(j2, fArr); } } @Override public void f() { d.f.a.b.l4.a0.b bVar = this.s; if (bVar != null) { bVar.f(); } d.f.a.b.l4.a0.b bVar2 = this.q; if (bVar2 != null) { bVar2.f(); } } @Override public void g(long j2, long j3, n2 n2Var, MediaFormat mediaFormat) { d.f.a.b.l4.v vVar = this.r; if (vVar != null) { vVar.g(j2, j3, n2Var, mediaFormat); } d.f.a.b.l4.v vVar2 = this.p; if (vVar2 != null) { vVar2.g(j2, j3, n2Var, mediaFormat); } } @Override public void o(int i2, Object obj) { d.f.a.b.l4.a0.b cameraMotionListener; if (i2 == 7) { this.p = (d.f.a.b.l4.v) obj; return; } if (i2 == 8) { this.q = (d.f.a.b.l4.a0.b) obj; return; } if (i2 != 10000) { return; } d.f.a.b.l4.a0.f fVar = (d.f.a.b.l4.a0.f) obj; if (fVar == null) { cameraMotionListener = null; this.r = null; } else { this.r = fVar.getVideoFrameMetadataListener(); cameraMotionListener = fVar.getCameraMotionListener(); } this.s = cameraMotionListener; } } public static final class e implements y2 { private final Object a; private u3 f4947b; public e(Object obj, u3 u3Var) { this.a = obj; this.f4947b = u3Var; } @Override public Object h() { return this.a; } @Override public u3 i() { return this.f4947b; } } static { l2.a("goog.exo.exoplayer"); } @SuppressLint({"HandlerLeak"}) public j2(i2.b bVar, f3 f3Var) { j2 j2Var; d.f.a.b.k4.k kVar = new d.f.a.b.k4.k(); this.f4937d = kVar; try { d.f.a.b.k4.t.f("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.1] [" + d.f.a.b.k4.m0.f5142e + "]"); Context applicationContext = bVar.a.getApplicationContext(); this.f4938e = applicationContext; d.f.a.b.y3.n1 apply = bVar.f4866i.apply(bVar.f4859b); this.r = apply; this.n0 = bVar.f4868k; this.h0 = bVar.f4869l; this.a0 = bVar.q; this.b0 = bVar.r; this.j0 = bVar.p; this.E = bVar.y; c cVar = new c(); this.x = cVar; d dVar = new d(); this.y = dVar; Handler handler = new Handler(bVar.f4867j); l3[] a2 = bVar.f4861d.get().a(handler, cVar, cVar, cVar, cVar); this.f4940g = a2; d.f.a.b.k4.e.f(a2.length > 0); d.f.a.b.i4.c0 c0Var = bVar.f4863f.get(); this.f4941h = c0Var; this.q = bVar.f4862e.get(); d.f.a.b.j4.l lVar = bVar.f4865h.get(); this.t = lVar; this.p = bVar.s; this.L = bVar.t; this.u = bVar.u; this.v = bVar.v; this.N = bVar.z; Looper looper = bVar.f4867j; this.s = looper; d.f.a.b.k4.h hVar = bVar.f4859b; this.w = hVar; f3 f3Var2 = f3Var == null ? this : f3Var; this.f4939f = f3Var2; this.f4945l = new d.f.a.b.k4.s<>(looper, hVar, new s.b() { @Override public final void a(Object obj, d.f.a.b.k4.p pVar) { j2.this.W0((f3.d) obj, pVar); } }); this.f4946m = new CopyOnWriteArraySet<>(); this.o = new ArrayList(); this.M = new v0.a(0); d.f.a.b.i4.d0 d0Var = new d.f.a.b.i4.d0(new o3[a2.length], new d.f.a.b.i4.v[a2.length], v3.p, null); this.f4935b = d0Var; this.n = new u3.b(); f3.b e2 = new f3.b.a().c(1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28).d(29, c0Var.d()).e(); this.f4936c = e2; this.O = new f3.b.a().b(e2).a(4).a(10).e(); this.f4942i = hVar.d(looper, null); k2.f fVar = new k2.f() { @Override public final void a(k2.e eVar) { j2.this.a1(eVar); } }; this.f4943j = fVar; this.t0 = d3.j(d0Var); apply.m0(f3Var2, looper); int i2 = d.f.a.b.k4.m0.a; try { k2 k2Var = new k2(a2, c0Var, d0Var, bVar.f4864g.get(), lVar, this.F, this.G, apply, this.L, bVar.w, bVar.x, this.N, looper, hVar, fVar, i2 < 31 ? new d.f.a.b.y3.u1() : b.a(applicationContext, this, bVar.A)); j2Var = this; try { j2Var.f4944k = k2Var; j2Var.i0 = 1.0f; j2Var.F = 0; u2 u2Var = u2.p; j2Var.P = u2Var; j2Var.Q = u2Var; j2Var.s0 = u2Var; j2Var.u0 = -1; j2Var.g0 = i2 < 21 ? j2Var.S0(0) : d.f.a.b.k4.m0.E(applicationContext); j2Var.k0 = d.f.a.b.h4.e.p; j2Var.l0 = true; j2Var.o(apply); lVar.h(new Handler(looper), apply); j2Var.z0(cVar); long j2 = bVar.f4860c; if (j2 > 0) { k2Var.s(j2); } u1 u1Var = new u1(bVar.a, handler, cVar); j2Var.z = u1Var; u1Var.b(bVar.o); v1 v1Var = new v1(bVar.a, handler, cVar); j2Var.A = v1Var; v1Var.m(bVar.f4870m ? j2Var.h0 : null); s3 s3Var = new s3(bVar.a, handler, cVar); j2Var.B = s3Var; s3Var.h(d.f.a.b.k4.m0.e0(j2Var.h0.t)); w3 w3Var = new w3(bVar.a); j2Var.C = w3Var; w3Var.a(bVar.n != 0); x3 x3Var = new x3(bVar.a); j2Var.D = x3Var; x3Var.a(bVar.n == 2); j2Var.q0 = C0(s3Var); j2Var.r0 = d.f.a.b.l4.z.p; c0Var.h(j2Var.h0); j2Var.E1(1, 10, Integer.valueOf(j2Var.g0)); j2Var.E1(2, 10, Integer.valueOf(j2Var.g0)); j2Var.E1(1, 3, j2Var.h0); j2Var.E1(2, 4, Integer.valueOf(j2Var.a0)); j2Var.E1(2, 5, Integer.valueOf(j2Var.b0)); j2Var.E1(1, 9, Boolean.valueOf(j2Var.j0)); j2Var.E1(2, 7, dVar); j2Var.E1(6, 8, dVar); kVar.e(); } catch (Throwable th) { th = th; j2Var.f4937d.e(); throw th; } } catch (Throwable th2) { th = th2; j2Var = this; } } catch (Throwable th3) { th = th3; j2Var = this; } } private List<z2.c> A0(int i2, List<d.f.a.b.g4.l0> list) { ArrayList arrayList = new ArrayList(); for (int i3 = 0; i3 < list.size(); i3++) { z2.c cVar = new z2.c(list.get(i3), this.p); arrayList.add(cVar); this.o.add(i3 + i2, new e(cVar.f5535b, cVar.a.T())); } this.M = this.M.d(i2, arrayList.size()); return arrayList; } private long A1(u3 u3Var, l0.b bVar, long j2) { u3Var.k(bVar.a, this.n); return j2 + this.n.p(); } public u2 B0() { u3 M = M(); if (M.t()) { return this.s0; } return this.s0.a().H(M.q(E(), this.a).v.v).F(); } private d3 B1(int i2, int i3) { boolean z = false; d.f.a.b.k4.e.a(i2 >= 0 && i3 >= i2 && i3 <= this.o.size()); int E = E(); u3 M = M(); int size = this.o.size(); this.H++; C1(i2, i3); u3 D0 = D0(); d3 x1 = x1(this.t0, D0, L0(M, D0)); int i4 = x1.f4384f; if (i4 != 1 && i4 != 4 && i2 < i3 && i3 == size && E >= x1.f4380b.s()) { z = true; } if (z) { x1 = x1.g(4); } this.f4944k.p0(i2, i3, this.M); return x1; } public static f2 C0(s3 s3Var) { return new f2(0, s3Var.d(), s3Var.c()); } private void C1(int i2, int i3) { for (int i4 = i3 - 1; i4 >= i2; i4--) { this.o.remove(i4); } this.M = this.M.a(i2, i3); } private u3 D0() { return new i3(this.o, this.M); } private void D1() { if (this.X != null) { E0(this.y).n(10000).m(null).l(); this.X.d(this.x); this.X = null; } TextureView textureView = this.Z; if (textureView != null) { if (textureView.getSurfaceTextureListener() != this.x) { d.f.a.b.k4.t.i("ExoPlayerImpl", "SurfaceTextureListener already unset or replaced."); } else { this.Z.setSurfaceTextureListener(null); } this.Z = null; } SurfaceHolder surfaceHolder = this.W; if (surfaceHolder != null) { surfaceHolder.removeCallback(this.x); this.W = null; } } private h3 E0(h3.b bVar) { int K0 = K0(); k2 k2Var = this.f4944k; u3 u3Var = this.t0.f4380b; if (K0 == -1) { K0 = 0; } return new h3(k2Var, bVar, u3Var, K0, this.w, k2Var.B()); } private void E1(int i2, int i3, Object obj) { for (l3 l3Var : this.f4940g) { if (l3Var.j() == i2) { E0(l3Var).n(i3).m(obj).l(); } } } private Pair<Boolean, Integer> F0(d3 d3Var, d3 d3Var2, boolean z, int i2, boolean z2) { u3 u3Var = d3Var2.f4380b; u3 u3Var2 = d3Var.f4380b; if (u3Var2.t() && u3Var.t()) { return new Pair<>(Boolean.FALSE, -1); } int i3 = 3; if (u3Var2.t() != u3Var.t()) { return new Pair<>(Boolean.TRUE, 3); } if (u3Var.q(u3Var.k(d3Var2.f4381c.a, this.n).s, this.a).t.equals(u3Var2.q(u3Var2.k(d3Var.f4381c.a, this.n).s, this.a).t)) { return (z && i2 == 0 && d3Var2.f4381c.f4551d < d3Var.f4381c.f4551d) ? new Pair<>(Boolean.TRUE, 0) : new Pair<>(Boolean.FALSE, -1); } if (z && i2 == 0) { i3 = 1; } else if (z && i2 == 1) { i3 = 2; } else if (!z2) { throw new IllegalStateException(); } return new Pair<>(Boolean.TRUE, Integer.valueOf(i3)); } public void F1() { E1(1, 2, Float.valueOf(this.i0 * this.A.g())); } private void I1(List<d.f.a.b.g4.l0> list, int i2, long j2, boolean z) { int i3; long j3; int K0 = K0(); long R = R(); this.H++; if (!this.o.isEmpty()) { C1(0, this.o.size()); } List<z2.c> A0 = A0(0, list); u3 D0 = D0(); if (!D0.t() && i2 >= D0.s()) { throw new q2(D0, i2, j2); } if (z) { j3 = -9223372036854775807L; i3 = D0.d(this.G); } else if (i2 == -1) { i3 = K0; j3 = R; } else { i3 = i2; j3 = j2; } d3 x1 = x1(this.t0, D0, y1(D0, i3, j3)); int i4 = x1.f4384f; if (i3 != -1 && i4 != 1) { i4 = (D0.t() || i3 >= D0.s()) ? 4 : 2; } d3 g2 = x1.g(i4); this.f4944k.O0(A0, i3, d.f.a.b.k4.m0.A0(j3), this.M); P1(g2, 0, 1, false, (this.t0.f4381c.a.equals(g2.f4381c.a) || this.t0.f4380b.t()) ? false : true, 4, J0(g2), -1); } private long J0(d3 d3Var) { return d3Var.f4380b.t() ? d.f.a.b.k4.m0.A0(this.w0) : d3Var.f4381c.b() ? d3Var.s : A1(d3Var.f4380b, d3Var.f4381c, d3Var.s); } public void J1(SurfaceTexture surfaceTexture) { Surface surface = new Surface(surfaceTexture); K1(surface); this.V = surface; } private int K0() { if (this.t0.f4380b.t()) { return this.u0; } d3 d3Var = this.t0; return d3Var.f4380b.k(d3Var.f4381c.a, this.n).s; } public void K1(Object obj) { boolean z; ArrayList arrayList = new ArrayList(); l3[] l3VarArr = this.f4940g; int length = l3VarArr.length; int i2 = 0; while (true) { z = true; if (i2 >= length) { break; } l3 l3Var = l3VarArr[i2]; if (l3Var.j() == 2) { arrayList.add(E0(l3Var).n(1).m(obj).l()); } i2++; } Object obj2 = this.U; if (obj2 == null || obj2 == obj) { z = false; } else { try { Iterator it = arrayList.iterator(); while (it.hasNext()) { ((h3) it.next()).a(this.E); } } catch (InterruptedException unused) { Thread.currentThread().interrupt(); } catch (TimeoutException unused2) { } z = false; Object obj3 = this.U; Surface surface = this.V; if (obj3 == surface) { surface.release(); this.V = null; } } this.U = obj; if (z) { M1(false, g2.i(new m2(3), 1003)); } } private Pair<Object, Long> L0(u3 u3Var, u3 u3Var2) { long n = n(); if (u3Var.t() || u3Var2.t()) { boolean z = !u3Var.t() && u3Var2.t(); int K0 = z ? -1 : K0(); if (z) { n = -9223372036854775807L; } return y1(u3Var2, K0, n); } Pair<Object, Long> m2 = u3Var.m(this.a, this.n, E(), d.f.a.b.k4.m0.A0(n)); Object obj = ((Pair) d.f.a.b.k4.m0.i(m2)).first; if (u3Var2.e(obj) != -1) { return m2; } Object A0 = k2.A0(this.a, this.n, this.F, this.G, obj, u3Var, u3Var2); if (A0 == null) { return y1(u3Var2, -1, -9223372036854775807L); } u3Var2.k(A0, this.n); int i2 = this.n.s; return y1(u3Var2, i2, u3Var2.q(i2, this.a).c()); } public static int M0(boolean z, int i2) { return (!z || i2 == 1) ? 1 : 2; } private void M1(boolean z, g2 g2Var) { d3 b2; if (z) { b2 = B1(0, this.o.size()).e(null); } else { d3 d3Var = this.t0; b2 = d3Var.b(d3Var.f4381c); b2.q = b2.s; b2.r = 0L; } d3 g2 = b2.g(1); if (g2Var != null) { g2 = g2.e(g2Var); } d3 d3Var2 = g2; this.H++; this.f4944k.i1(); P1(d3Var2, 0, 1, false, d3Var2.f4380b.t() && !this.t0.f4380b.t(), 4, J0(d3Var2), -1); } private void N1() { f3.b bVar = this.O; f3.b G = d.f.a.b.k4.m0.G(this.f4939f, this.f4936c); this.O = G; if (G.equals(bVar)) { return; } this.f4945l.h(13, new s.a() { @Override public final void b(Object obj) { j2.this.i1((f3.d) obj); } }); } private f3.e O0(long j2) { int i2; t2 t2Var; Object obj; int E = E(); Object obj2 = null; if (this.t0.f4380b.t()) { i2 = -1; t2Var = null; obj = null; } else { d3 d3Var = this.t0; Object obj3 = d3Var.f4381c.a; d3Var.f4380b.k(obj3, this.n); i2 = this.t0.f4380b.e(obj3); obj = obj3; obj2 = this.t0.f4380b.q(E, this.a).t; t2Var = this.a.v; } long X0 = d.f.a.b.k4.m0.X0(j2); long X02 = this.t0.f4381c.b() ? d.f.a.b.k4.m0.X0(Q0(this.t0)) : X0; l0.b bVar = this.t0.f4381c; return new f3.e(obj2, E, t2Var, obj, i2, X0, X02, bVar.f4549b, bVar.f4550c); } public void O1(boolean z, int i2, int i3) { int i4 = 0; boolean z2 = z && i2 != -1; if (z2 && i2 != 1) { i4 = 1; } d3 d3Var = this.t0; if (d3Var.f4391m == z2 && d3Var.n == i4) { return; } this.H++; d3 d2 = d3Var.d(z2, i4); this.f4944k.R0(z2, i4); P1(d2, 0, i3, false, false, 5, -9223372036854775807L, -1); } private f3.e P0(int i2, d3 d3Var, int i3) { int i4; int i5; Object obj; t2 t2Var; Object obj2; long j2; long j3; u3.b bVar = new u3.b(); if (d3Var.f4380b.t()) { i4 = i3; i5 = -1; obj = null; t2Var = null; obj2 = null; } else { Object obj3 = d3Var.f4381c.a; d3Var.f4380b.k(obj3, bVar); int i6 = bVar.s; i4 = i6; obj2 = obj3; i5 = d3Var.f4380b.e(obj3); obj = d3Var.f4380b.q(i6, this.a).t; t2Var = this.a.v; } boolean b2 = d3Var.f4381c.b(); if (i2 == 0) { if (b2) { l0.b bVar2 = d3Var.f4381c; j2 = bVar.d(bVar2.f4549b, bVar2.f4550c); j3 = Q0(d3Var); } else { j2 = d3Var.f4381c.f4552e != -1 ? Q0(this.t0) : bVar.u + bVar.t; j3 = j2; } } else if (b2) { j2 = d3Var.s; j3 = Q0(d3Var); } else { j2 = bVar.u + d3Var.s; j3 = j2; } long X0 = d.f.a.b.k4.m0.X0(j2); long X02 = d.f.a.b.k4.m0.X0(j3); l0.b bVar3 = d3Var.f4381c; return new f3.e(obj, i4, t2Var, obj2, i5, X0, X02, bVar3.f4549b, bVar3.f4550c); } private void P1(final d3 d3Var, final int i2, final int i3, boolean z, boolean z2, final int i4, long j2, int i5) { d3 d3Var2 = this.t0; this.t0 = d3Var; Pair<Boolean, Integer> F0 = F0(d3Var, d3Var2, z2, i4, !d3Var2.f4380b.equals(d3Var.f4380b)); boolean booleanValue = ((Boolean) F0.first).booleanValue(); final int intValue = ((Integer) F0.second).intValue(); u2 u2Var = this.P; if (booleanValue) { r3 = d3Var.f4380b.t() ? null : d3Var.f4380b.q(d3Var.f4380b.k(d3Var.f4381c.a, this.n).s, this.a).v; this.s0 = u2.p; } if (booleanValue || !d3Var2.f4389k.equals(d3Var.f4389k)) { this.s0 = this.s0.a().J(d3Var.f4389k).F(); u2Var = B0(); } boolean z3 = !u2Var.equals(this.P); this.P = u2Var; boolean z4 = d3Var2.f4391m != d3Var.f4391m; boolean z5 = d3Var2.f4384f != d3Var.f4384f; if (z5 || z4) { R1(); } boolean z6 = d3Var2.f4386h; boolean z7 = d3Var.f4386h; boolean z8 = z6 != z7; if (z8) { Q1(z7); } if (!d3Var2.f4380b.equals(d3Var.f4380b)) { this.f4945l.h(0, new s.a() { @Override public final void b(Object obj) { f3.d dVar = (f3.d) obj; dVar.U(d3.this.f4380b, i2); } }); } if (z2) { final f3.e P0 = P0(i4, d3Var2, i5); final f3.e O0 = O0(j2); this.f4945l.h(11, new s.a() { @Override public final void b(Object obj) { j2.k1(i4, P0, O0, (f3.d) obj); } }); } if (booleanValue) { this.f4945l.h(1, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).O(t2.this, intValue); } }); } if (d3Var2.f4385g != d3Var.f4385g) { this.f4945l.h(10, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).k0(d3.this.f4385g); } }); if (d3Var.f4385g != null) { this.f4945l.h(10, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).Q(d3.this.f4385g); } }); } } d.f.a.b.i4.d0 d0Var = d3Var2.f4388j; d.f.a.b.i4.d0 d0Var2 = d3Var.f4388j; if (d0Var != d0Var2) { this.f4941h.e(d0Var2.f4887e); this.f4945l.h(2, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).H(d3.this.f4388j.f4886d); } }); } if (z3) { final u2 u2Var2 = this.P; this.f4945l.h(14, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).e0(u2.this); } }); } if (z8) { this.f4945l.h(3, new s.a() { @Override public final void b(Object obj) { j2.q1(d3.this, (f3.d) obj); } }); } if (z5 || z4) { this.f4945l.h(-1, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).C(r0.f4391m, d3.this.f4384f); } }); } if (z5) { this.f4945l.h(4, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).Y(d3.this.f4384f); } }); } if (z4) { this.f4945l.h(5, new s.a() { @Override public final void b(Object obj) { f3.d dVar = (f3.d) obj; dVar.Z(d3.this.f4391m, i3); } }); } if (d3Var2.n != d3Var.n) { this.f4945l.h(6, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).B(d3.this.n); } }); } if (T0(d3Var2) != T0(d3Var)) { this.f4945l.h(7, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).q0(j2.T0(d3.this)); } }); } if (!d3Var2.o.equals(d3Var.o)) { this.f4945l.h(12, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).v(d3.this.o); } }); } if (z) { this.f4945l.h(-1, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).N(); } }); } N1(); this.f4945l.d(); if (d3Var2.p != d3Var.p) { Iterator<i2.a> it = this.f4946m.iterator(); while (it.hasNext()) { it.next().F(d3Var.p); } } } private static long Q0(d3 d3Var) { u3.d dVar = new u3.d(); u3.b bVar = new u3.b(); d3Var.f4380b.k(d3Var.f4381c.a, bVar); return d3Var.f4382d == -9223372036854775807L ? d3Var.f4380b.q(bVar.s, dVar).d() : bVar.p() + d3Var.f4382d; } private void Q1(boolean z) { d.f.a.b.k4.d0 d0Var = this.n0; if (d0Var != null) { if (z && !this.o0) { d0Var.a(0); this.o0 = true; } else { if (z || !this.o0) { return; } d0Var.b(0); this.o0 = false; } } } public void Y0(k2.e eVar) { long j2; boolean z; long j3; int i2 = this.H - eVar.f5100c; this.H = i2; boolean z2 = true; if (eVar.f5101d) { this.I = eVar.f5102e; this.J = true; } if (eVar.f5103f) { this.K = eVar.f5104g; } if (i2 == 0) { u3 u3Var = eVar.f5099b.f4380b; if (!this.t0.f4380b.t() && u3Var.t()) { this.u0 = -1; this.w0 = 0L; this.v0 = 0; } if (!u3Var.t()) { List<u3> J = ((i3) u3Var).J(); d.f.a.b.k4.e.f(J.size() == this.o.size()); for (int i3 = 0; i3 < J.size(); i3++) { this.o.get(i3).f4947b = J.get(i3); } } if (this.J) { if (eVar.f5099b.f4381c.equals(this.t0.f4381c) && eVar.f5099b.f4383e == this.t0.s) { z2 = false; } if (z2) { if (u3Var.t() || eVar.f5099b.f4381c.b()) { j3 = eVar.f5099b.f4383e; } else { d3 d3Var = eVar.f5099b; j3 = A1(u3Var, d3Var.f4381c, d3Var.f4383e); } j2 = j3; } else { j2 = -9223372036854775807L; } z = z2; } else { j2 = -9223372036854775807L; z = false; } this.J = false; P1(eVar.f5099b, 1, this.K, false, z, this.I, j2, -1); } } public void R1() { int w = w(); if (w != 1) { if (w == 2 || w == 3) { this.C.b(s() && !G0()); this.D.b(s()); return; } else if (w != 4) { throw new IllegalStateException(); } } this.C.b(false); this.D.b(false); } private int S0(int i2) { AudioTrack audioTrack = this.T; if (audioTrack != null && audioTrack.getAudioSessionId() != i2) { this.T.release(); this.T = null; } if (this.T == null) { this.T = new AudioTrack(3, 4000, 4, 2, 2, 0, i2); } return this.T.getAudioSessionId(); } private void S1() { this.f4937d.b(); if (Thread.currentThread() != H0().getThread()) { String B = d.f.a.b.k4.m0.B("Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://exoplayer.dev/issues/player-accessed-on-wrong-thread", Thread.currentThread().getName(), H0().getThread().getName()); if (this.l0) { throw new IllegalStateException(B); } d.f.a.b.k4.t.j("ExoPlayerImpl", B, this.m0 ? null : new IllegalStateException()); this.m0 = true; } } private static boolean T0(d3 d3Var) { return d3Var.f4384f == 3 && d3Var.f4391m && d3Var.n == 0; } public void W0(f3.d dVar, d.f.a.b.k4.p pVar) { dVar.j0(this.f4939f, new f3.c(pVar)); } public void a1(final k2.e eVar) { this.f4942i.j(new Runnable() { @Override public final void run() { j2.this.Y0(eVar); } }); } public void i1(f3.d dVar) { dVar.R(this.O); } public static void k1(int i2, f3.e eVar, f3.e eVar2, f3.d dVar) { dVar.E(i2); dVar.A(eVar, eVar2, i2); } public static void q1(d3 d3Var, f3.d dVar) { dVar.D(d3Var.f4386h); dVar.K(d3Var.f4386h); } private d3 x1(d3 d3Var, u3 u3Var, Pair<Object, Long> pair) { long j2; d.f.a.b.k4.e.a(u3Var.t() || pair != null); u3 u3Var2 = d3Var.f4380b; d3 i2 = d3Var.i(u3Var); if (u3Var.t()) { l0.b k2 = d3.k(); long A0 = d.f.a.b.k4.m0.A0(this.w0); d3 b2 = i2.c(k2, A0, A0, A0, 0L, d.f.a.b.g4.a1.p, this.f4935b, d.f.b.b.q.x()).b(k2); b2.q = b2.s; return b2; } Object obj = i2.f4381c.a; boolean z = !obj.equals(((Pair) d.f.a.b.k4.m0.i(pair)).first); l0.b bVar = z ? new l0.b(pair.first) : i2.f4381c; long longValue = ((Long) pair.second).longValue(); long A02 = d.f.a.b.k4.m0.A0(n()); if (!u3Var2.t()) { A02 -= u3Var2.k(obj, this.n).p(); } if (z || longValue < A02) { d.f.a.b.k4.e.f(!bVar.b()); d3 b3 = i2.c(bVar, longValue, longValue, longValue, 0L, z ? d.f.a.b.g4.a1.p : i2.f4387i, z ? this.f4935b : i2.f4388j, z ? d.f.b.b.q.x() : i2.f4389k).b(bVar); b3.q = longValue; return b3; } if (longValue == A02) { int e2 = u3Var.e(i2.f4390l.a); if (e2 == -1 || u3Var.i(e2, this.n).s != u3Var.k(bVar.a, this.n).s) { u3Var.k(bVar.a, this.n); j2 = bVar.b() ? this.n.d(bVar.f4549b, bVar.f4550c) : this.n.t; i2 = i2.c(bVar, i2.s, i2.s, i2.f4383e, j2 - i2.s, i2.f4387i, i2.f4388j, i2.f4389k).b(bVar); } return i2; } d.f.a.b.k4.e.f(!bVar.b()); long max = Math.max(0L, i2.r - (longValue - A02)); j2 = i2.q; if (i2.f4390l.equals(i2.f4381c)) { j2 = longValue + max; } i2 = i2.c(bVar, longValue, longValue, longValue, max, i2.f4387i, i2.f4388j, i2.f4389k); i2.q = j2; return i2; } private Pair<Object, Long> y1(u3 u3Var, int i2, long j2) { if (u3Var.t()) { this.u0 = i2; if (j2 == -9223372036854775807L) { j2 = 0; } this.w0 = j2; this.v0 = 0; return null; } if (i2 == -1 || i2 >= u3Var.s()) { i2 = u3Var.d(this.G); j2 = u3Var.q(i2, this.a).c(); } return u3Var.m(this.a, this.n, i2, d.f.a.b.k4.m0.A0(j2)); } public void z1(final int i2, final int i3) { if (i2 == this.c0 && i3 == this.d0) { return; } this.c0 = i2; this.d0 = i3; this.f4945l.j(24, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).g0(i2, i3); } }); } @Override public int B() { S1(); if (this.t0.f4380b.t()) { return this.v0; } d3 d3Var = this.t0; return d3Var.f4380b.e(d3Var.f4381c.a); } @Override public void C(d.f.a.b.g4.l0 l0Var) { S1(); G1(Collections.singletonList(l0Var)); } @Override public int D() { S1(); if (m()) { return this.t0.f4381c.f4549b; } return -1; } @Override public int E() { S1(); int K0 = K0(); if (K0 == -1) { return 0; } return K0; } @Override public void F(final int i2) { S1(); if (this.F != i2) { this.F = i2; this.f4944k.V0(i2); this.f4945l.h(8, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).j(i2); } }); N1(); this.f4945l.d(); } } public boolean G0() { S1(); return this.t0.p; } public void G1(List<d.f.a.b.g4.l0> list) { S1(); H1(list, true); } @Override public int H() { S1(); if (m()) { return this.t0.f4381c.f4550c; } return -1; } public Looper H0() { return this.s; } public void H1(List<d.f.a.b.g4.l0> list, boolean z) { S1(); I1(list, -1, -9223372036854775807L, z); } public long I0() { S1(); if (this.t0.f4380b.t()) { return this.w0; } d3 d3Var = this.t0; if (d3Var.f4390l.f4551d != d3Var.f4381c.f4551d) { return d3Var.f4380b.q(E(), this.a).e(); } long j2 = d3Var.q; if (this.t0.f4390l.b()) { d3 d3Var2 = this.t0; u3.b k2 = d3Var2.f4380b.k(d3Var2.f4390l.a, this.n); long h2 = k2.h(this.t0.f4390l.f4549b); j2 = h2 == Long.MIN_VALUE ? k2.t : h2; } d3 d3Var3 = this.t0; return d.f.a.b.k4.m0.X0(A1(d3Var3.f4380b, d3Var3.f4390l, j2)); } @Override public int J() { S1(); return this.t0.n; } @Override public int K() { S1(); return this.F; } @Override public long L() { S1(); if (!m()) { return b(); } d3 d3Var = this.t0; l0.b bVar = d3Var.f4381c; d3Var.f4380b.k(bVar.a, this.n); return d.f.a.b.k4.m0.X0(this.n.d(bVar.f4549b, bVar.f4550c)); } public void L1(boolean z) { S1(); this.A.p(s(), 1); M1(z, null); this.k0 = d.f.a.b.h4.e.p; } @Override public u3 M() { S1(); return this.t0.f4380b; } @Override public int N() { S1(); return this.g0; } @Override public g2 j() { S1(); return this.t0.f4385g; } @Override public boolean P() { S1(); return this.G; } @Override public long R() { S1(); return d.f.a.b.k4.m0.X0(J0(this.t0)); } @Override public void S(final d.f.a.b.z3.p pVar, boolean z) { S1(); if (this.p0) { return; } if (!d.f.a.b.k4.m0.b(this.h0, pVar)) { this.h0 = pVar; E1(1, 3, pVar); this.B.h(d.f.a.b.k4.m0.e0(pVar.t)); this.f4945l.h(20, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).F(d.f.a.b.z3.p.this); } }); } this.A.m(z ? pVar : null); this.f4941h.h(pVar); boolean s = s(); int p = this.A.p(s, w()); O1(s, p, M0(s, p)); this.f4945l.d(); } @Override public void a() { AudioTrack audioTrack; d.f.a.b.k4.t.f("ExoPlayerImpl", "Release " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.1] [" + d.f.a.b.k4.m0.f5142e + "] [" + l2.b() + "]"); S1(); if (d.f.a.b.k4.m0.a < 21 && (audioTrack = this.T) != null) { audioTrack.release(); this.T = null; } this.z.b(false); this.B.g(); this.C.b(false); this.D.b(false); this.A.i(); if (!this.f4944k.m0()) { this.f4945l.j(10, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).Q(g2.i(new m2(1), 1003)); } }); } this.f4945l.i(); this.f4942i.i(null); this.t.b(this.r); d3 g2 = this.t0.g(1); this.t0 = g2; d3 b2 = g2.b(g2.f4381c); this.t0 = b2; b2.q = b2.s; this.t0.r = 0L; this.r.a(); this.f4941h.f(); D1(); Surface surface = this.V; if (surface != null) { surface.release(); this.V = null; } if (this.o0) { ((d.f.a.b.k4.d0) d.f.a.b.k4.e.e(this.n0)).b(0); this.o0 = false; } this.k0 = d.f.a.b.h4.e.p; this.p0 = true; } @Override public void e(final boolean z) { S1(); if (this.j0 == z) { return; } this.j0 = z; E1(1, 9, Boolean.valueOf(z)); this.f4945l.j(23, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).b(z); } }); } @Override public e3 f() { S1(); return this.t0.o; } @Override public void g(e3 e3Var) { S1(); if (e3Var == null) { e3Var = e3.p; } if (this.t0.o.equals(e3Var)) { return; } d3 f2 = this.t0.f(e3Var); this.H++; this.f4944k.T0(e3Var); P1(f2, 0, 1, false, false, 5, -9223372036854775807L, -1); } @Override public void h() { S1(); boolean s = s(); int p = this.A.p(s, 2); O1(s, p, M0(s, p)); d3 d3Var = this.t0; if (d3Var.f4384f != 1) { return; } d3 e2 = d3Var.e(null); d3 g2 = e2.g(e2.f4380b.t() ? 4 : 2); this.H++; this.f4944k.k0(); P1(g2, 1, 1, false, false, 5, -9223372036854775807L, -1); } @Override public void i(float f2) { S1(); final float o = d.f.a.b.k4.m0.o(f2, 0.0f, 1.0f); if (this.i0 == o) { return; } this.i0 = o; F1(); this.f4945l.j(22, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).V(o); } }); } @Override public void k(boolean z) { S1(); int p = this.A.p(z, w()); O1(z, p, M0(z, p)); } @Override public void l(Surface surface) { S1(); D1(); K1(surface); int i2 = surface == null ? 0 : -1; z1(i2, i2); } @Override public boolean m() { S1(); return this.t0.f4381c.b(); } @Override public long n() { S1(); if (!m()) { return R(); } d3 d3Var = this.t0; d3Var.f4380b.k(d3Var.f4381c.a, this.n); d3 d3Var2 = this.t0; return d3Var2.f4382d == -9223372036854775807L ? d3Var2.f4380b.q(E(), this.a).c() : this.n.o() + d.f.a.b.k4.m0.X0(this.t0.f4382d); } @Override public void o(f3.d dVar) { d.f.a.b.k4.e.e(dVar); this.f4945l.a(dVar); } @Override public long p() { S1(); return d.f.a.b.k4.m0.X0(this.t0.r); } @Override public void q(int i2, long j2) { S1(); this.r.d0(); u3 u3Var = this.t0.f4380b; if (i2 < 0 || (!u3Var.t() && i2 >= u3Var.s())) { throw new q2(u3Var, i2, j2); } this.H++; if (m()) { d.f.a.b.k4.t.i("ExoPlayerImpl", "seekTo ignored because an ad is playing"); k2.e eVar = new k2.e(this.t0); eVar.b(1); this.f4943j.a(eVar); return; } int i3 = w() != 1 ? 2 : 1; int E = E(); d3 x1 = x1(this.t0.g(i3), u3Var, y1(u3Var, i2, j2)); this.f4944k.C0(u3Var, i2, d.f.a.b.k4.m0.A0(j2)); P1(x1, 0, 1, true, true, 1, J0(x1), E); } @Override public long r() { S1(); if (!m()) { return I0(); } d3 d3Var = this.t0; return d3Var.f4390l.equals(d3Var.f4381c) ? d.f.a.b.k4.m0.X0(this.t0.q) : L(); } @Override public boolean s() { S1(); return this.t0.f4391m; } @Override public void stop() { S1(); L1(false); } @Override public void u(final boolean z) { S1(); if (this.G != z) { this.G = z; this.f4944k.Y0(z); this.f4945l.h(9, new s.a() { @Override public final void b(Object obj) { ((f3.d) obj).f0(z); } }); N1(); this.f4945l.d(); } } @Override public int w() { S1(); return this.t0.f4384f; } @Override public n2 x() { S1(); return this.R; } @Override public v3 y() { S1(); return this.t0.f4388j.f4886d; } public void y0(d.f.a.b.y3.p1 p1Var) { d.f.a.b.k4.e.e(p1Var); this.r.S(p1Var); } @Override public void z(boolean z) { S1(); this.f4944k.t(z); Iterator<i2.a> it = this.f4946m.iterator(); while (it.hasNext()) { it.next().D(z); } } public void z0(i2.a aVar) { this.f4946m.add(aVar); } }