package s5; 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 com.tencent.thumbplayer.api.TPErrorCode; 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; import o7.b0; import o7.c0; import o7.s; import q7.d0; import q7.g; import q7.l; import q7.n; import q7.n0; import q7.q; import r7.j; import r7.w; import r7.y; import s5.b; import s5.d; import s5.d3; import s5.g2; import s5.i1; import s5.i3; import s5.p2; import s5.r; import s5.s2; import s7.f; import t5.q1; import t5.s1; import v5.i; import v6.o0; import v6.t; import v6.u0; /* access modifiers changed from: package-private */ public final class w0 extends e implements r { private final d A; private final d3 B; private final o3 C; private final p3 D; private final long E; private int F; private boolean G; private int H; private int I; private boolean J; private int K; private a3 L; private o0 M; private boolean N; private p2.b O; private z1 P; private z1 Q; private m1 R; private m1 S; private AudioTrack T; private Object U; private Surface V; private SurfaceHolder W; private f X; private boolean Y; private TextureView Z; /* renamed from: a0 reason: collision with root package name */ private int f24828a0; /* renamed from: b reason: collision with root package name */ final c0 f24829b; /* renamed from: b0 reason: collision with root package name */ private int f24830b0; /* renamed from: c reason: collision with root package name */ final p2.b f24831c; /* renamed from: c0 reason: collision with root package name */ private int f24832c0; /* renamed from: d reason: collision with root package name */ private final g f24833d; /* renamed from: d0 reason: collision with root package name */ private int f24834d0; /* renamed from: e reason: collision with root package name */ private final Context f24835e; /* renamed from: e0 reason: collision with root package name */ private v5.e f24836e0; /* renamed from: f reason: collision with root package name */ private final p2 f24837f; /* renamed from: f0 reason: collision with root package name */ private v5.e f24838f0; /* renamed from: g reason: collision with root package name */ private final w2[] f24839g; /* renamed from: g0 reason: collision with root package name */ private int f24840g0; /* renamed from: h reason: collision with root package name */ private final b0 f24841h; /* renamed from: h0 reason: collision with root package name */ private u5.e f24842h0; /* renamed from: i reason: collision with root package name */ private final n f24843i; /* renamed from: i0 reason: collision with root package name */ private float f24844i0; /* renamed from: j reason: collision with root package name */ private final i1.f f24845j; /* renamed from: j0 reason: collision with root package name */ private boolean f24846j0; /* renamed from: k reason: collision with root package name */ private final i1 f24847k; /* renamed from: k0 reason: collision with root package name */ private e7.e f24848k0; /* renamed from: l reason: collision with root package name */ private final q<p2.d> f24849l; /* renamed from: l0 reason: collision with root package name */ private boolean f24850l0; /* renamed from: m reason: collision with root package name */ private final CopyOnWriteArraySet<r.a> f24851m; /* renamed from: m0 reason: collision with root package name */ private boolean f24852m0; /* renamed from: n reason: collision with root package name */ private final i3.b f24853n; /* renamed from: n0 reason: collision with root package name */ private d0 f24854n0; /* renamed from: o reason: collision with root package name */ private final List<e> f24855o; /* renamed from: o0 reason: collision with root package name */ private boolean f24856o0; /* renamed from: p reason: collision with root package name */ private final boolean f24857p; /* renamed from: p0 reason: collision with root package name */ private boolean f24858p0; /* renamed from: q reason: collision with root package name */ private final t.a f24859q; /* renamed from: q0 reason: collision with root package name */ private o f24860q0; /* renamed from: r reason: collision with root package name */ private final t5.a f24861r; /* renamed from: r0 reason: collision with root package name */ private y f24862r0; /* renamed from: s reason: collision with root package name */ private final Looper f24863s; /* renamed from: s0 reason: collision with root package name */ private z1 f24864s0; /* renamed from: t reason: collision with root package name */ private final p7.e f24865t; /* renamed from: t0 reason: collision with root package name */ private m2 f24866t0; /* renamed from: u reason: collision with root package name */ private final long f24867u; /* renamed from: u0 reason: collision with root package name */ private int f24868u0; /* renamed from: v reason: collision with root package name */ private final long f24869v; /* renamed from: v0 reason: collision with root package name */ private int f24870v0; /* renamed from: w reason: collision with root package name */ private final q7.d f24871w; /* renamed from: w0 reason: collision with root package name */ private long f24872w0; /* renamed from: x reason: collision with root package name */ private final c f24873x; /* renamed from: y reason: collision with root package name */ private final d f24874y; /* renamed from: z reason: collision with root package name */ private final b f24875z; private static final class b { public static s1 a(Context context, w0 w0Var, boolean z10) { q1 A0 = q1.A0(context); if (A0 == null) { q7.r.i("ExoPlayerImpl", "MediaMetricsService unavailable."); return new s1(LogSessionId.LOG_SESSION_ID_NONE); } if (z10) { w0Var.J0(A0); } return new s1(A0.H0()); } } /* access modifiers changed from: private */ public final class c implements w, u5.r, e7.n, k6.e, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, f.a, d.b, b.AbstractC0354b, d3.b, r.a { private c() { } /* access modifiers changed from: private */ public /* synthetic */ void Q(p2.d dVar) { dVar.W(w0.this.P); } @Override // s5.d.b public void A(float f10) { w0.this.K1(); } @Override // s5.d.b public void B(int i10) { boolean h10 = w0.this.h(); w0.this.T1(h10, i10, w0.X0(h10, i10)); } @Override // s7.f.a public void C(Surface surface) { w0.this.P1(null); } @Override // s5.d3.b public void D(int i10, boolean z10) { w0.this.f24849l.k(30, new x0(i10, z10)); } @Override // u5.r public void a(boolean z10) { if (w0.this.f24846j0 != z10) { w0.this.f24846j0 = z10; w0.this.f24849l.k(23, new e1(z10)); } } @Override // u5.r public void b(Exception exc) { w0.this.f24861r.b(exc); } @Override // k6.e public void c(k6.a aVar) { w0 w0Var = w0.this; w0Var.f24864s0 = w0Var.f24864s0.b().J(aVar).F(); z1 M0 = w0.this.M0(); if (!M0.equals(w0.this.P)) { w0.this.P = M0; w0.this.f24849l.i(14, new d1(this)); } w0.this.f24849l.i(28, new a1(aVar)); w0.this.f24849l.f(); } @Override // r7.w public void d(y yVar) { w0.this.f24862r0 = yVar; w0.this.f24849l.k(25, new b1(yVar)); } @Override // r7.w public void e(String str) { w0.this.f24861r.e(str); } @Override // r7.w public void f(v5.e eVar) { w0.this.f24836e0 = eVar; w0.this.f24861r.f(eVar); } @Override // r7.w public void g(String str, long j10, long j11) { w0.this.f24861r.g(str, j10, j11); } @Override // r7.w public void h(m1 m1Var, i iVar) { w0.this.R = m1Var; w0.this.f24861r.h(m1Var, iVar); } @Override // e7.n public void i(e7.e eVar) { w0.this.f24848k0 = eVar; w0.this.f24849l.k(27, new y0(eVar)); } @Override // u5.r public void j(m1 m1Var, i iVar) { w0.this.S = m1Var; w0.this.f24861r.j(m1Var, iVar); } @Override // u5.r public void k(String str) { w0.this.f24861r.k(str); } @Override // u5.r public void l(String str, long j10, long j11) { w0.this.f24861r.l(str, j10, j11); } @Override // r7.w public void m(int i10, long j10) { w0.this.f24861r.m(i10, j10); } @Override // s5.d3.b public void n(int i10) { o N0 = w0.N0(w0.this.B); if (!N0.equals(w0.this.f24860q0)) { w0.this.f24860q0 = N0; w0.this.f24849l.k(29, new c1(N0)); } } @Override // r7.w public void o(Object obj, long j10) { w0.this.f24861r.o(obj, j10); if (w0.this.U == obj) { w0.this.f24849l.k(26, f1.f24316a); } } public void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i10, int i11) { w0.this.O1(surfaceTexture); w0.this.E1(i10, i11); } public boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) { w0.this.P1(null); w0.this.E1(0, 0); return true; } public void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i10, int i11) { w0.this.E1(i10, i11); } public void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) { } @Override // s5.b.AbstractC0354b public void p() { w0.this.T1(false, -1, 3); } @Override // e7.n public void q(List<e7.b> list) { w0.this.f24849l.k(27, new z0(list)); } @Override // u5.r public void r(long j10) { w0.this.f24861r.r(j10); } @Override // u5.r public void s(v5.e eVar) { w0.this.f24838f0 = eVar; w0.this.f24861r.s(eVar); } public void surfaceChanged(SurfaceHolder surfaceHolder, int i10, int i11, int i12) { w0.this.E1(i11, i12); } public void surfaceCreated(SurfaceHolder surfaceHolder) { if (w0.this.Y) { w0.this.P1(surfaceHolder.getSurface()); } } public void surfaceDestroyed(SurfaceHolder surfaceHolder) { if (w0.this.Y) { w0.this.P1(null); } w0.this.E1(0, 0); } @Override // u5.r public void t(Exception exc) { w0.this.f24861r.t(exc); } @Override // u5.r public void u(v5.e eVar) { w0.this.f24861r.u(eVar); w0.this.S = null; w0.this.f24838f0 = null; } @Override // r7.w public void v(Exception exc) { w0.this.f24861r.v(exc); } @Override // u5.r public void w(int i10, long j10, long j11) { w0.this.f24861r.w(i10, j10, j11); } @Override // r7.w public void x(long j10, int i10) { w0.this.f24861r.x(j10, i10); } @Override // r7.w public void y(v5.e eVar) { w0.this.f24861r.y(eVar); w0.this.R = null; w0.this.f24836e0 = null; } @Override // s5.r.a public void z(boolean z10) { w0.this.W1(); } } /* access modifiers changed from: private */ public static final class d implements j, s7.a, s2.b { /* renamed from: a reason: collision with root package name */ private j f24877a; /* renamed from: b reason: collision with root package name */ private s7.a f24878b; /* renamed from: c reason: collision with root package name */ private j f24879c; /* renamed from: d reason: collision with root package name */ private s7.a f24880d; private d() { } @Override // s7.a public void a(long j10, float[] fArr) { s7.a aVar = this.f24880d; if (aVar != null) { aVar.a(j10, fArr); } s7.a aVar2 = this.f24878b; if (aVar2 != null) { aVar2.a(j10, fArr); } } @Override // s7.a public void d() { s7.a aVar = this.f24880d; if (aVar != null) { aVar.d(); } s7.a aVar2 = this.f24878b; if (aVar2 != null) { aVar2.d(); } } @Override // r7.j public void g(long j10, long j11, m1 m1Var, MediaFormat mediaFormat) { j jVar = this.f24879c; if (jVar != null) { jVar.g(j10, j11, m1Var, mediaFormat); } j jVar2 = this.f24877a; if (jVar2 != null) { jVar2.g(j10, j11, m1Var, mediaFormat); } } @Override // s5.s2.b public void x(int i10, Object obj) { s7.a aVar; if (i10 == 7) { this.f24877a = (j) obj; } else if (i10 == 8) { this.f24878b = (s7.a) obj; } else if (i10 == 10000) { f fVar = (f) obj; if (fVar == null) { aVar = null; this.f24879c = null; } else { this.f24879c = fVar.getVideoFrameMetadataListener(); aVar = fVar.getCameraMotionListener(); } this.f24880d = aVar; } } } /* access modifiers changed from: private */ public static final class e implements e2 { /* renamed from: a reason: collision with root package name */ private final Object f24881a; /* renamed from: b reason: collision with root package name */ private i3 f24882b; public e(Object obj, i3 i3Var) { this.f24881a = obj; this.f24882b = i3Var; } @Override // s5.e2 public Object a() { return this.f24881a; } @Override // s5.e2 public i3 b() { return this.f24882b; } } static { j1.a("goog.exo.exoplayer"); } @SuppressLint({"HandlerLeak"}) public w0(r.b bVar, p2 p2Var) { w0 w0Var; Throwable th2; i1 i1Var; g gVar = new g(); this.f24833d = gVar; try { q7.r.f("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [" + "ExoPlayerLib/2.18.1" + "] [" + n0.f23195e + "]"); Context applicationContext = bVar.f24667a.getApplicationContext(); this.f24835e = applicationContext; t5.a apply = bVar.f24675i.apply(bVar.f24668b); this.f24861r = apply; this.f24854n0 = bVar.f24677k; this.f24842h0 = bVar.f24678l; this.f24828a0 = bVar.f24683q; this.f24830b0 = bVar.f24684r; this.f24846j0 = bVar.f24682p; this.E = bVar.f24691y; c cVar = new c(); this.f24873x = cVar; d dVar = new d(); this.f24874y = dVar; Handler handler = new Handler(bVar.f24676j); w2[] a10 = bVar.f24670d.get().a(handler, cVar, cVar, cVar, cVar); this.f24839g = a10; q7.a.f(a10.length > 0); b0 b0Var = bVar.f24672f.get(); this.f24841h = b0Var; this.f24859q = bVar.f24671e.get(); p7.e eVar = bVar.f24674h.get(); this.f24865t = eVar; this.f24857p = bVar.f24685s; this.L = bVar.f24686t; this.f24867u = bVar.f24687u; this.f24869v = bVar.f24688v; this.N = bVar.f24692z; Looper looper = bVar.f24676j; this.f24863s = looper; q7.d dVar2 = bVar.f24668b; this.f24871w = dVar2; p2 p2Var2 = p2Var == null ? this : p2Var; this.f24837f = p2Var2; this.f24849l = new q<>(looper, dVar2, new m0(this)); this.f24851m = new CopyOnWriteArraySet<>(); this.f24855o = new ArrayList(); this.M = new o0.a(0); c0 c0Var = new c0(new y2[a10.length], new s[a10.length], n3.f24600b, null); this.f24829b = c0Var; this.f24853n = new i3.b(); p2.b e10 = new p2.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, b0Var.d()).e(); this.f24831c = e10; this.O = new p2.b.a().b(e10).a(4).a(10).e(); this.f24843i = dVar2.c(looper, null); n0 n0Var = new n0(this); this.f24845j = n0Var; this.f24866t0 = m2.j(c0Var); apply.T(p2Var2, looper); int i10 = n0.f23191a; try { i1Var = new i1(a10, b0Var, c0Var, bVar.f24673g.get(), eVar, this.F, this.G, apply, this.L, bVar.f24689w, bVar.f24690x, this.N, looper, dVar2, n0Var, i10 < 31 ? new s1() : b.a(applicationContext, this, bVar.A)); w0Var = this; } catch (Throwable th3) { th2 = th3; w0Var = this; w0Var.f24833d.e(); throw th2; } try { w0Var.f24847k = i1Var; w0Var.f24844i0 = 1.0f; w0Var.F = 0; z1 z1Var = z1.G; w0Var.P = z1Var; w0Var.Q = z1Var; w0Var.f24864s0 = z1Var; w0Var.f24868u0 = -1; w0Var.f24840g0 = i10 < 21 ? w0Var.d1(0) : n0.F(applicationContext); w0Var.f24848k0 = e7.e.f13896b; w0Var.f24850l0 = true; w0Var.s(apply); eVar.f(new Handler(looper), apply); w0Var.K0(cVar); long j10 = bVar.f24669c; if (j10 > 0) { i1Var.v(j10); } b bVar2 = new b(bVar.f24667a, handler, cVar); w0Var.f24875z = bVar2; bVar2.b(bVar.f24681o); d dVar3 = new d(bVar.f24667a, handler, cVar); w0Var.A = dVar3; dVar3.m(bVar.f24679m ? w0Var.f24842h0 : null); d3 d3Var = new d3(bVar.f24667a, handler, cVar); w0Var.B = d3Var; d3Var.h(n0.f0(w0Var.f24842h0.f25894c)); o3 o3Var = new o3(bVar.f24667a); w0Var.C = o3Var; o3Var.a(bVar.f24680n != 0); p3 p3Var = new p3(bVar.f24667a); w0Var.D = p3Var; p3Var.a(bVar.f24680n == 2); w0Var.f24860q0 = N0(d3Var); w0Var.f24862r0 = y.f23933e; b0Var.h(w0Var.f24842h0); w0Var.J1(1, 10, Integer.valueOf(w0Var.f24840g0)); w0Var.J1(2, 10, Integer.valueOf(w0Var.f24840g0)); w0Var.J1(1, 3, w0Var.f24842h0); w0Var.J1(2, 4, Integer.valueOf(w0Var.f24828a0)); w0Var.J1(2, 5, Integer.valueOf(w0Var.f24830b0)); w0Var.J1(1, 9, Boolean.valueOf(w0Var.f24846j0)); w0Var.J1(2, 7, dVar); w0Var.J1(6, 8, dVar); gVar.e(); } catch (Throwable th4) { th2 = th4; w0Var.f24833d.e(); throw th2; } } catch (Throwable th5) { th2 = th5; w0Var = this; w0Var.f24833d.e(); throw th2; } } /* access modifiers changed from: private */ public static /* synthetic */ void A1(m2 m2Var, p2.d dVar) { dVar.o0(e1(m2Var)); } /* access modifiers changed from: private */ public static /* synthetic */ void B1(m2 m2Var, p2.d dVar) { dVar.n(m2Var.f24589n); } private m2 C1(m2 m2Var, i3 i3Var, Pair<Object, Long> pair) { int i10; long j10; q7.a.a(i3Var.u() || pair != null); i3 i3Var2 = m2Var.f24576a; m2 i11 = m2Var.i(i3Var); if (i3Var.u()) { t.b k10 = m2.k(); long A0 = n0.A0(this.f24872w0); m2 b10 = i11.c(k10, A0, A0, A0, 0, u0.f26713d, this.f24829b, com.google.common.collect.q.v()).b(k10); b10.f24591p = b10.f24593r; return b10; } Object obj = i11.f24577b.f26697a; boolean z10 = !obj.equals(((Pair) n0.j(pair)).first); t.b bVar = z10 ? new t.b(pair.first) : i11.f24577b; long longValue = ((Long) pair.second).longValue(); long A02 = n0.A0(n()); if (!i3Var2.u()) { A02 -= i3Var2.l(obj, this.f24853n).q(); } if (z10 || longValue < A02) { q7.a.f(!bVar.b()); m2 b11 = i11.c(bVar, longValue, longValue, longValue, 0, z10 ? u0.f26713d : i11.f24583h, z10 ? this.f24829b : i11.f24584i, z10 ? com.google.common.collect.q.v() : i11.f24585j).b(bVar); b11.f24591p = longValue; return b11; } if (i10 == 0) { int f10 = i3Var.f(i11.f24586k.f26697a); if (f10 == -1 || i3Var.j(f10, this.f24853n).f24424c != i3Var.l(bVar.f26697a, this.f24853n).f24424c) { i3Var.l(bVar.f26697a, this.f24853n); j10 = bVar.b() ? this.f24853n.e(bVar.f26698b, bVar.f26699c) : this.f24853n.f24425d; i11 = i11.c(bVar, i11.f24593r, i11.f24593r, i11.f24579d, j10 - i11.f24593r, i11.f24583h, i11.f24584i, i11.f24585j).b(bVar); i11.f24591p = j10; } } else { q7.a.f(!bVar.b()); long max = Math.max(0L, i11.f24592q - (longValue - A02)); j10 = i11.f24591p; if (i11.f24586k.equals(i11.f24577b)) { j10 = longValue + max; } i11 = i11.c(bVar, longValue, longValue, longValue, max, i11.f24583h, i11.f24584i, i11.f24585j); i11.f24591p = j10; } return i11; } private Pair<Object, Long> D1(i3 i3Var, int i10, long j10) { if (i3Var.u()) { this.f24868u0 = i10; if (j10 == -9223372036854775807L) { j10 = 0; } this.f24872w0 = j10; this.f24870v0 = 0; return null; } if (i10 == -1 || i10 >= i3Var.t()) { i10 = i3Var.e(this.G); j10 = i3Var.r(i10, this.f24298a).d(); } return i3Var.n(this.f24298a, this.f24853n, i10, n0.A0(j10)); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void E1(int i10, int i11) { if (i10 != this.f24832c0 || i11 != this.f24834d0) { this.f24832c0 = i10; this.f24834d0 = i11; this.f24849l.k(24, new p0(i10, i11)); } } private long F1(i3 i3Var, t.b bVar, long j10) { i3Var.l(bVar.f26697a, this.f24853n); return j10 + this.f24853n.q(); } private m2 G1(int i10, int i11) { boolean z10 = false; q7.a.a(i10 >= 0 && i11 >= i10 && i11 <= this.f24855o.size()); int w10 = w(); i3 C2 = C(); int size = this.f24855o.size(); this.H++; H1(i10, i11); i3 O0 = O0(); m2 C1 = C1(this.f24866t0, O0, W0(C2, O0)); int i12 = C1.f24580e; if (i12 != 1 && i12 != 4 && i10 < i11 && i11 == size && w10 >= C1.f24576a.t()) { z10 = true; } if (z10) { C1 = C1.g(4); } this.f24847k.o0(i10, i11, this.M); return C1; } private void H1(int i10, int i11) { for (int i12 = i11 - 1; i12 >= i10; i12--) { this.f24855o.remove(i12); } this.M = this.M.c(i10, i11); } private void I1() { if (this.X != null) { P0(this.f24874y).n(10000).m(null).l(); this.X.d(this.f24873x); this.X = null; } TextureView textureView = this.Z; if (textureView != null) { if (textureView.getSurfaceTextureListener() != this.f24873x) { q7.r.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.f24873x); this.W = null; } } private void J1(int i10, int i11, Object obj) { w2[] w2VarArr = this.f24839g; for (w2 w2Var : w2VarArr) { if (w2Var.h() == i10) { P0(w2Var).n(i11).m(obj).l(); } } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void K1() { J1(1, 2, Float.valueOf(this.f24844i0 * this.A.g())); } private List<g2.c> L0(int i10, List<t> list) { ArrayList arrayList = new ArrayList(); for (int i11 = 0; i11 < list.size(); i11++) { g2.c cVar = new g2.c(list.get(i11), this.f24857p); arrayList.add(cVar); this.f24855o.add(i11 + i10, new e(cVar.f24343b, cVar.f24342a.Q())); } this.M = this.M.g(i10, arrayList.size()); return arrayList; } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private z1 M0() { i3 C2 = C(); if (C2.u()) { return this.f24864s0; } return this.f24864s0.b().H(C2.r(w(), this.f24298a).f24439c.f24730e).F(); } /* access modifiers changed from: private */ public static o N0(d3 d3Var) { return new o(0, d3Var.d(), d3Var.c()); } private void N1(List<t> list, int i10, long j10, boolean z10) { int i11; long j11; int V0 = V0(); long currentPosition = getCurrentPosition(); boolean z11 = true; this.H++; if (!this.f24855o.isEmpty()) { H1(0, this.f24855o.size()); } List<g2.c> L0 = L0(0, list); i3 O0 = O0(); if (O0.u() || i10 < O0.t()) { if (z10) { j11 = -9223372036854775807L; i11 = O0.e(this.G); } else if (i10 == -1) { i11 = V0; j11 = currentPosition; } else { i11 = i10; j11 = j10; } m2 C1 = C1(this.f24866t0, O0, D1(O0, i11, j11)); int i12 = C1.f24580e; if (!(i11 == -1 || i12 == 1)) { i12 = (O0.u() || i11 >= O0.t()) ? 4 : 2; } m2 g10 = C1.g(i12); this.f24847k.N0(L0, i11, n0.A0(j11), this.M); if (this.f24866t0.f24577b.f26697a.equals(g10.f24577b.f26697a) || this.f24866t0.f24576a.u()) { z11 = false; } U1(g10, 0, 1, false, z11, 4, U0(g10), -1); return; } throw new q1(O0, i10, j10); } private i3 O0() { return new t2(this.f24855o, this.M); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void O1(SurfaceTexture surfaceTexture) { Surface surface = new Surface(surfaceTexture); P1(surface); this.V = surface; } private s2 P0(s2.b bVar) { int V0 = V0(); i1 i1Var = this.f24847k; i3 i3Var = this.f24866t0.f24576a; if (V0 == -1) { V0 = 0; } return new s2(i1Var, bVar, i3Var, V0, this.f24871w, i1Var.C()); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void P1(Object obj) { boolean z10; ArrayList<s2> arrayList = new ArrayList(); w2[] w2VarArr = this.f24839g; int length = w2VarArr.length; int i10 = 0; while (true) { z10 = true; if (i10 >= length) { break; } w2 w2Var = w2VarArr[i10]; if (w2Var.h() == 2) { arrayList.add(P0(w2Var).n(1).m(obj).l()); } i10++; } Object obj2 = this.U; if (obj2 == null || obj2 == obj) { z10 = false; } else { try { for (s2 s2Var : arrayList) { s2Var.a(this.E); } } catch (InterruptedException unused) { Thread.currentThread().interrupt(); } catch (TimeoutException unused2) { } z10 = false; Object obj3 = this.U; Surface surface = this.V; if (obj3 == surface) { surface.release(); this.V = null; } } this.U = obj; if (z10) { R1(false, q.j(new k1(3), 1003)); } } private Pair<Boolean, Integer> Q0(m2 m2Var, m2 m2Var2, boolean z10, int i10, boolean z11) { i3 i3Var = m2Var2.f24576a; i3 i3Var2 = m2Var.f24576a; if (i3Var2.u() && i3Var.u()) { return new Pair<>(Boolean.FALSE, -1); } int i11 = 3; if (i3Var2.u() != i3Var.u()) { return new Pair<>(Boolean.TRUE, 3); } if (i3Var.r(i3Var.l(m2Var2.f24577b.f26697a, this.f24853n).f24424c, this.f24298a).f24437a.equals(i3Var2.r(i3Var2.l(m2Var.f24577b.f26697a, this.f24853n).f24424c, this.f24298a).f24437a)) { return (!z10 || i10 != 0 || m2Var2.f24577b.f26700d >= m2Var.f24577b.f26700d) ? new Pair<>(Boolean.FALSE, -1) : new Pair<>(Boolean.TRUE, 0); } if (z10 && i10 == 0) { i11 = 1; } else if (z10 && i10 == 1) { i11 = 2; } else if (!z11) { throw new IllegalStateException(); } return new Pair<>(Boolean.TRUE, Integer.valueOf(i11)); } private void R1(boolean z10, q qVar) { m2 m2Var; if (z10) { m2Var = G1(0, this.f24855o.size()).e(null); } else { m2 m2Var2 = this.f24866t0; m2Var = m2Var2.b(m2Var2.f24577b); m2Var.f24591p = m2Var.f24593r; m2Var.f24592q = 0; } m2 g10 = m2Var.g(1); if (qVar != null) { g10 = g10.e(qVar); } this.H++; this.f24847k.g1(); U1(g10, 0, 1, false, g10.f24576a.u() && !this.f24866t0.f24576a.u(), 4, U0(g10), -1); } private void S1() { p2.b bVar = this.O; p2.b H2 = n0.H(this.f24837f, this.f24831c); this.O = H2; if (!H2.equals(bVar)) { this.f24849l.i(13, new r0(this)); } } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void T1(boolean z10, int i10, int i11) { int i12 = 0; boolean z11 = z10 && i10 != -1; if (z11 && i10 != 1) { i12 = 1; } m2 m2Var = this.f24866t0; if (m2Var.f24587l != z11 || m2Var.f24588m != i12) { this.H++; m2 d10 = m2Var.d(z11, i12); this.f24847k.Q0(z11, i12); U1(d10, 0, i11, false, false, 5, -9223372036854775807L, -1); } } private long U0(m2 m2Var) { return m2Var.f24576a.u() ? n0.A0(this.f24872w0) : m2Var.f24577b.b() ? m2Var.f24593r : F1(m2Var.f24576a, m2Var.f24577b, m2Var.f24593r); } private void U1(m2 m2Var, int i10, int i11, boolean z10, boolean z11, int i12, long j10, int i13) { m2 m2Var2 = this.f24866t0; this.f24866t0 = m2Var; Pair<Boolean, Integer> Q0 = Q0(m2Var, m2Var2, z11, i12, !m2Var2.f24576a.equals(m2Var.f24576a)); boolean booleanValue = ((Boolean) Q0.first).booleanValue(); int intValue = ((Integer) Q0.second).intValue(); z1 z1Var = this.P; u1 u1Var = null; if (booleanValue) { if (!m2Var.f24576a.u()) { u1Var = m2Var.f24576a.r(m2Var.f24576a.l(m2Var.f24577b.f26697a, this.f24853n).f24424c, this.f24298a).f24439c; } this.f24864s0 = z1.G; } if (booleanValue || !m2Var2.f24585j.equals(m2Var.f24585j)) { this.f24864s0 = this.f24864s0.b().I(m2Var.f24585j).F(); z1Var = M0(); } boolean z12 = !z1Var.equals(this.P); this.P = z1Var; boolean z13 = m2Var2.f24587l != m2Var.f24587l; boolean z14 = m2Var2.f24580e != m2Var.f24580e; if (z14 || z13) { W1(); } boolean z15 = m2Var2.f24582g; boolean z16 = m2Var.f24582g; boolean z17 = z15 != z16; if (z17) { V1(z16); } if (!m2Var2.f24576a.equals(m2Var.f24576a)) { this.f24849l.i(0, new g0(m2Var, i10)); } if (z11) { this.f24849l.i(11, new q0(i12, a1(i12, m2Var2, i13), Z0(j10))); } if (booleanValue) { this.f24849l.i(1, new s0(u1Var, intValue)); } if (m2Var2.f24581f != m2Var.f24581f) { this.f24849l.i(10, new u0(m2Var)); if (m2Var.f24581f != null) { this.f24849l.i(10, new d0(m2Var)); } } c0 c0Var = m2Var2.f24584i; c0 c0Var2 = m2Var.f24584i; if (c0Var != c0Var2) { this.f24841h.e(c0Var2.f21681e); this.f24849l.i(2, new z(m2Var)); } if (z12) { this.f24849l.i(14, new t0(this.P)); } if (z17) { this.f24849l.i(3, new f0(m2Var)); } if (z14 || z13) { this.f24849l.i(-1, new e0(m2Var)); } if (z14) { this.f24849l.i(4, new v0(m2Var)); } if (z13) { this.f24849l.i(5, new h0(m2Var, i11)); } if (m2Var2.f24588m != m2Var.f24588m) { this.f24849l.i(6, new a0(m2Var)); } if (e1(m2Var2) != e1(m2Var)) { this.f24849l.i(7, new c0(m2Var)); } if (!m2Var2.f24589n.equals(m2Var.f24589n)) { this.f24849l.i(12, new b0(m2Var)); } if (z10) { this.f24849l.i(-1, l0.f24507a); } S1(); this.f24849l.f(); if (m2Var2.f24590o != m2Var.f24590o) { Iterator<r.a> it = this.f24851m.iterator(); while (it.hasNext()) { it.next().z(m2Var.f24590o); } } } private int V0() { if (this.f24866t0.f24576a.u()) { return this.f24868u0; } m2 m2Var = this.f24866t0; return m2Var.f24576a.l(m2Var.f24577b.f26697a, this.f24853n).f24424c; } private void V1(boolean z10) { d0 d0Var = this.f24854n0; if (d0Var == null) { return; } if (z10 && !this.f24856o0) { d0Var.a(0); this.f24856o0 = true; } else if (!z10 && this.f24856o0) { d0Var.b(0); this.f24856o0 = false; } } private Pair<Object, Long> W0(i3 i3Var, i3 i3Var2) { long n10 = n(); int i10 = -1; if (i3Var.u() || i3Var2.u()) { boolean z10 = !i3Var.u() && i3Var2.u(); if (!z10) { i10 = V0(); } if (z10) { n10 = -9223372036854775807L; } return D1(i3Var2, i10, n10); } Pair<Object, Long> n11 = i3Var.n(this.f24298a, this.f24853n, w(), n0.A0(n10)); Object obj = ((Pair) n0.j(n11)).first; if (i3Var2.f(obj) != -1) { return n11; } Object z02 = i1.z0(this.f24298a, this.f24853n, this.F, this.G, obj, i3Var, i3Var2); if (z02 == null) { return D1(i3Var2, -1, -9223372036854775807L); } i3Var2.l(z02, this.f24853n); int i11 = this.f24853n.f24424c; return D1(i3Var2, i11, i3Var2.r(i11, this.f24298a).d()); } /* access modifiers changed from: private */ /* access modifiers changed from: public */ private void W1() { int q10 = q(); boolean z10 = true; if (q10 != 1) { if (q10 == 2 || q10 == 3) { boolean R0 = R0(); o3 o3Var = this.C; if (!h() || R0) { z10 = false; } o3Var.b(z10); this.D.b(h()); return; } else if (q10 != 4) { throw new IllegalStateException(); } } this.C.b(false); this.D.b(false); } /* access modifiers changed from: private */ public static int X0(boolean z10, int i10) { return (!z10 || i10 == 1) ? 1 : 2; } private void X1() { this.f24833d.b(); if (Thread.currentThread() != S0().getThread()) { String C2 = n0.C("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(), S0().getThread().getName()); if (!this.f24850l0) { q7.r.j("ExoPlayerImpl", C2, this.f24852m0 ? null : new IllegalStateException()); this.f24852m0 = true; return; } throw new IllegalStateException(C2); } } private p2.e Z0(long j10) { int i10; Object obj; u1 u1Var; int w10 = w(); Object obj2 = null; if (!this.f24866t0.f24576a.u()) { m2 m2Var = this.f24866t0; Object obj3 = m2Var.f24577b.f26697a; m2Var.f24576a.l(obj3, this.f24853n); i10 = this.f24866t0.f24576a.f(obj3); obj = obj3; obj2 = this.f24866t0.f24576a.r(w10, this.f24298a).f24437a; u1Var = this.f24298a.f24439c; } else { i10 = -1; u1Var = null; obj = null; } long Y0 = n0.Y0(j10); long Y02 = this.f24866t0.f24577b.b() ? n0.Y0(b1(this.f24866t0)) : Y0; t.b bVar = this.f24866t0.f24577b; return new p2.e(obj2, w10, u1Var, obj, i10, Y0, Y02, bVar.f26698b, bVar.f26699c); } private p2.e a1(int i10, m2 m2Var, int i11) { int i12; Object obj; u1 u1Var; int i13; Object obj2; long j10; long j11; i3.b bVar = new i3.b(); if (!m2Var.f24576a.u()) { Object obj3 = m2Var.f24577b.f26697a; m2Var.f24576a.l(obj3, bVar); int i14 = bVar.f24424c; i13 = i14; obj = obj3; i12 = m2Var.f24576a.f(obj3); obj2 = m2Var.f24576a.r(i14, this.f24298a).f24437a; u1Var = this.f24298a.f24439c; } else { i13 = i11; i12 = -1; obj2 = null; u1Var = null; obj = null; } boolean b10 = m2Var.f24577b.b(); if (i10 == 0) { if (b10) { t.b bVar2 = m2Var.f24577b; j11 = bVar.e(bVar2.f26698b, bVar2.f26699c); } else { j11 = m2Var.f24577b.f26701e != -1 ? b1(this.f24866t0) : bVar.f24426e + bVar.f24425d; j10 = j11; long Y0 = n0.Y0(j11); long Y02 = n0.Y0(j10); t.b bVar3 = m2Var.f24577b; return new p2.e(obj2, i13, u1Var, obj, i12, Y0, Y02, bVar3.f26698b, bVar3.f26699c); } } else if (b10) { j11 = m2Var.f24593r; } else { j11 = bVar.f24426e + m2Var.f24593r; j10 = j11; long Y03 = n0.Y0(j11); long Y022 = n0.Y0(j10); t.b bVar32 = m2Var.f24577b; return new p2.e(obj2, i13, u1Var, obj, i12, Y03, Y022, bVar32.f26698b, bVar32.f26699c); } j10 = b1(m2Var); long Y032 = n0.Y0(j11); long Y0222 = n0.Y0(j10); t.b bVar322 = m2Var.f24577b; return new p2.e(obj2, i13, u1Var, obj, i12, Y032, Y0222, bVar322.f26698b, bVar322.f26699c); } private static long b1(m2 m2Var) { i3.d dVar = new i3.d(); i3.b bVar = new i3.b(); m2Var.f24576a.l(m2Var.f24577b.f26697a, bVar); return m2Var.f24578c == -9223372036854775807L ? m2Var.f24576a.r(bVar.f24424c, dVar).e() : bVar.q() + m2Var.f24578c; } /* access modifiers changed from: private */ /* renamed from: c1 */ public void h1(i1.e eVar) { long j10; boolean z10; long j11; int i10 = this.H - eVar.f24404c; this.H = i10; boolean z11 = true; if (eVar.f24405d) { this.I = eVar.f24406e; this.J = true; } if (eVar.f24407f) { this.K = eVar.f24408g; } if (i10 == 0) { i3 i3Var = eVar.f24403b.f24576a; if (!this.f24866t0.f24576a.u() && i3Var.u()) { this.f24868u0 = -1; this.f24872w0 = 0; this.f24870v0 = 0; } if (!i3Var.u()) { List<i3> J2 = ((t2) i3Var).J(); q7.a.f(J2.size() == this.f24855o.size()); for (int i11 = 0; i11 < J2.size(); i11++) { this.f24855o.get(i11).f24882b = J2.get(i11); } } if (this.J) { if (eVar.f24403b.f24577b.equals(this.f24866t0.f24577b) && eVar.f24403b.f24579d == this.f24866t0.f24593r) { z11 = false; } if (z11) { if (i3Var.u() || eVar.f24403b.f24577b.b()) { j11 = eVar.f24403b.f24579d; } else { m2 m2Var = eVar.f24403b; j11 = F1(i3Var, m2Var.f24577b, m2Var.f24579d); } j10 = j11; } else { j10 = -9223372036854775807L; } z10 = z11; } else { j10 = -9223372036854775807L; z10 = false; } this.J = false; U1(eVar.f24403b, 1, this.K, false, z10, this.I, j10, -1); } } private int d1(int i10) { AudioTrack audioTrack = this.T; if (!(audioTrack == null || audioTrack.getAudioSessionId() == i10)) { this.T.release(); this.T = null; } if (this.T == null) { this.T = new AudioTrack(3, TPErrorCode.TP_ERROR_TYPE_DOWNLOAD_PROXY, 4, 2, 2, 0, i10); } return this.T.getAudioSessionId(); } private static boolean e1(m2 m2Var) { return m2Var.f24580e == 3 && m2Var.f24587l && m2Var.f24588m == 0; } /* access modifiers changed from: private */ public /* synthetic */ void g1(p2.d dVar, l lVar) { dVar.i0(this.f24837f, new p2.c(lVar)); } /* access modifiers changed from: private */ public /* synthetic */ void i1(i1.e eVar) { this.f24843i.c(new y(this, eVar)); } /* access modifiers changed from: private */ public static /* synthetic */ void j1(p2.d dVar) { dVar.X(q.j(new k1(1), 1003)); } /* access modifiers changed from: private */ public /* synthetic */ void n1(p2.d dVar) { dVar.F(this.O); } /* access modifiers changed from: private */ public static /* synthetic */ void o1(m2 m2Var, int i10, p2.d dVar) { dVar.l0(m2Var.f24576a, i10); } /* access modifiers changed from: private */ public static /* synthetic */ void p1(int i10, p2.e eVar, p2.e eVar2, p2.d dVar) { dVar.B(i10); dVar.Q(eVar, eVar2, i10); } /* access modifiers changed from: private */ public static /* synthetic */ void r1(m2 m2Var, p2.d dVar) { dVar.U(m2Var.f24581f); } /* access modifiers changed from: private */ public static /* synthetic */ void s1(m2 m2Var, p2.d dVar) { dVar.X(m2Var.f24581f); } /* access modifiers changed from: private */ public static /* synthetic */ void t1(m2 m2Var, p2.d dVar) { dVar.Y(m2Var.f24584i.f21680d); } /* access modifiers changed from: private */ public static /* synthetic */ void v1(m2 m2Var, p2.d dVar) { dVar.A(m2Var.f24582g); dVar.G(m2Var.f24582g); } /* access modifiers changed from: private */ public static /* synthetic */ void w1(m2 m2Var, p2.d dVar) { dVar.d0(m2Var.f24587l, m2Var.f24580e); } /* access modifiers changed from: private */ public static /* synthetic */ void x1(m2 m2Var, p2.d dVar) { dVar.L(m2Var.f24580e); } /* access modifiers changed from: private */ public static /* synthetic */ void y1(m2 m2Var, int i10, p2.d dVar) { dVar.j0(m2Var.f24587l, i10); } /* access modifiers changed from: private */ public static /* synthetic */ void z1(m2 m2Var, p2.d dVar) { dVar.z(m2Var.f24588m); } @Override // s5.p2 public int A() { X1(); return this.f24866t0.f24588m; } @Override // s5.p2 public int B() { X1(); return this.F; } @Override // s5.p2 public i3 C() { X1(); return this.f24866t0.f24576a; } @Override // s5.p2 public boolean D() { X1(); return this.G; } @Override // s5.r public void E(u5.e eVar, boolean z10) { X1(); if (!this.f24858p0) { if (!n0.c(this.f24842h0, eVar)) { this.f24842h0 = eVar; J1(1, 3, eVar); this.B.h(n0.f0(eVar.f25894c)); this.f24849l.i(20, new i0(eVar)); } this.A.m(z10 ? eVar : null); this.f24841h.h(eVar); boolean h10 = h(); int p10 = this.A.p(h10, q()); T1(h10, p10, X0(h10, p10)); this.f24849l.f(); } } public void J0(t5.b bVar) { q7.a.e(bVar); this.f24861r.C(bVar); } public void K0(r.a aVar) { this.f24851m.add(aVar); } public void L1(List<t> list) { X1(); M1(list, true); } public void M1(List<t> list, boolean z10) { X1(); N1(list, -1, -9223372036854775807L, z10); } public void Q1(boolean z10) { X1(); this.A.p(h(), 1); R1(z10, null); this.f24848k0 = e7.e.f13896b; } public boolean R0() { X1(); return this.f24866t0.f24590o; } public Looper S0() { return this.f24863s; } public long T0() { X1(); if (this.f24866t0.f24576a.u()) { return this.f24872w0; } m2 m2Var = this.f24866t0; if (m2Var.f24586k.f26700d != m2Var.f24577b.f26700d) { return m2Var.f24576a.r(w(), this.f24298a).f(); } long j10 = m2Var.f24591p; if (this.f24866t0.f24586k.b()) { m2 m2Var2 = this.f24866t0; i3.b l10 = m2Var2.f24576a.l(m2Var2.f24586k.f26697a, this.f24853n); long i10 = l10.i(this.f24866t0.f24586k.f26698b); j10 = i10 == Long.MIN_VALUE ? l10.f24425d : i10; } m2 m2Var3 = this.f24866t0; return n0.Y0(F1(m2Var3.f24576a, m2Var3.f24586k, j10)); } /* renamed from: Y0 */ public q l() { X1(); return this.f24866t0.f24581f; } @Override // s5.p2 public void a() { X1(); boolean h10 = h(); int i10 = 2; int p10 = this.A.p(h10, 2); T1(h10, p10, X0(h10, p10)); m2 m2Var = this.f24866t0; if (m2Var.f24580e == 1) { m2 e10 = m2Var.e(null); if (e10.f24576a.u()) { i10 = 4; } m2 g10 = e10.g(i10); this.H++; this.f24847k.j0(); U1(g10, 1, 1, false, false, 5, -9223372036854775807L, -1); } } @Override // s5.p2 public void b(float f10) { X1(); float p10 = n0.p(f10, 0.0f, 1.0f); if (this.f24844i0 != p10) { this.f24844i0 = p10; K1(); this.f24849l.k(22, new j0(p10)); } } @Override // s5.p2 public void c(Surface surface) { X1(); I1(); P1(surface); int i10 = surface == null ? 0 : -1; E1(i10, i10); } @Override // s5.p2 public void d(o2 o2Var) { X1(); if (o2Var == null) { o2Var = o2.f24616d; } if (!this.f24866t0.f24589n.equals(o2Var)) { m2 f10 = this.f24866t0.f(o2Var); this.H++; this.f24847k.S0(o2Var); U1(f10, 0, 1, false, false, 5, -9223372036854775807L, -1); } } @Override // s5.p2 public boolean e() { X1(); return this.f24866t0.f24577b.b(); } @Override // s5.p2 public long f() { X1(); return n0.Y0(this.f24866t0.f24592q); } @Override // s5.p2 public void g(int i10, long j10) { X1(); this.f24861r.R(); i3 i3Var = this.f24866t0.f24576a; if (i10 < 0 || (!i3Var.u() && i10 >= i3Var.t())) { throw new q1(i3Var, i10, j10); } int i11 = 1; this.H++; if (e()) { q7.r.i("ExoPlayerImpl", "seekTo ignored because an ad is playing"); i1.e eVar = new i1.e(this.f24866t0); eVar.b(1); this.f24845j.a(eVar); return; } if (q() != 1) { i11 = 2; } int w10 = w(); m2 C1 = C1(this.f24866t0.g(i11), i3Var, D1(i3Var, i10, j10)); this.f24847k.B0(i3Var, i10, n0.A0(j10)); U1(C1, 0, 1, true, true, 1, U0(C1), w10); } @Override // s5.p2 public long getCurrentPosition() { X1(); return n0.Y0(U0(this.f24866t0)); } @Override // s5.p2 public long getDuration() { X1(); if (!e()) { return G(); } m2 m2Var = this.f24866t0; t.b bVar = m2Var.f24577b; m2Var.f24576a.l(bVar.f26697a, this.f24853n); return n0.Y0(this.f24853n.e(bVar.f26698b, bVar.f26699c)); } @Override // s5.p2 public boolean h() { X1(); return this.f24866t0.f24587l; } @Override // s5.p2 public int i() { X1(); if (this.f24866t0.f24576a.u()) { return this.f24870v0; } m2 m2Var = this.f24866t0; return m2Var.f24576a.f(m2Var.f24577b.f26697a); } @Override // s5.p2 public int k() { X1(); if (e()) { return this.f24866t0.f24577b.f26699c; } return -1; } @Override // s5.p2 public void m(boolean z10) { X1(); int p10 = this.A.p(z10, q()); T1(z10, p10, X0(z10, p10)); } @Override // s5.p2 public long n() { X1(); if (!e()) { return getCurrentPosition(); } m2 m2Var = this.f24866t0; m2Var.f24576a.l(m2Var.f24577b.f26697a, this.f24853n); m2 m2Var2 = this.f24866t0; return m2Var2.f24578c == -9223372036854775807L ? m2Var2.f24576a.r(w(), this.f24298a).d() : this.f24853n.p() + n0.Y0(this.f24866t0.f24578c); } @Override // s5.p2 public long o() { X1(); if (!e()) { return T0(); } m2 m2Var = this.f24866t0; return m2Var.f24586k.equals(m2Var.f24577b) ? n0.Y0(this.f24866t0.f24591p) : getDuration(); } @Override // s5.p2 public int q() { X1(); return this.f24866t0.f24580e; } @Override // s5.r public m1 r() { X1(); return this.R; } @Override // s5.p2 public void release() { AudioTrack audioTrack; q7.r.f("ExoPlayerImpl", "Release " + Integer.toHexString(System.identityHashCode(this)) + " [" + "ExoPlayerLib/2.18.1" + "] [" + n0.f23195e + "] [" + j1.b() + "]"); X1(); if (n0.f23191a < 21 && (audioTrack = this.T) != null) { audioTrack.release(); this.T = null; } this.f24875z.b(false); this.B.g(); this.C.b(false); this.D.b(false); this.A.i(); if (!this.f24847k.l0()) { this.f24849l.k(10, k0.f24497a); } this.f24849l.j(); this.f24843i.k(null); this.f24865t.e(this.f24861r); m2 g10 = this.f24866t0.g(1); this.f24866t0 = g10; m2 b10 = g10.b(g10.f24577b); this.f24866t0 = b10; b10.f24591p = b10.f24593r; this.f24866t0.f24592q = 0; this.f24861r.release(); this.f24841h.f(); I1(); Surface surface = this.V; if (surface != null) { surface.release(); this.V = null; } if (this.f24856o0) { ((d0) q7.a.e(this.f24854n0)).b(0); this.f24856o0 = false; } this.f24848k0 = e7.e.f13896b; this.f24858p0 = true; } @Override // s5.p2 public void s(p2.d dVar) { q7.a.e(dVar); this.f24849l.c(dVar); } @Override // s5.p2 public void stop() { X1(); Q1(false); } @Override // s5.p2 public n3 t() { X1(); return this.f24866t0.f24584i.f21680d; } @Override // s5.p2 public int v() { X1(); if (e()) { return this.f24866t0.f24577b.f26698b; } return -1; } @Override // s5.p2 public int w() { X1(); int V0 = V0(); if (V0 == -1) { return 0; } return V0; } @Override // s5.p2 public void x(int i10) { X1(); if (this.F != i10) { this.F = i10; this.f24847k.U0(i10); this.f24849l.i(8, new o0(i10)); S1(); this.f24849l.f(); } } @Override // s5.r public void y(t tVar) { X1(); L1(Collections.singletonList(tVar)); } }