Idle Tower v2.48版本的 MD5 值为:56f20496f6a85726b376356ed2ecee23
以下内容为反编译后的 rs.java 源代码,内容仅作参考
package com.yandex.mobile.ads.impl;
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.yandex.mobile.ads.exo.metadata.Metadata;
import com.yandex.mobile.ads.impl.dr0;
import com.yandex.mobile.ads.impl.ec0;
import com.yandex.mobile.ads.impl.hr0;
import com.yandex.mobile.ads.impl.i11;
import com.yandex.mobile.ads.impl.nc0;
import com.yandex.mobile.ads.impl.os;
import com.yandex.mobile.ads.impl.qc0;
import com.yandex.mobile.ads.impl.r80;
import com.yandex.mobile.ads.impl.rs;
import com.yandex.mobile.ads.impl.ts;
import com.yandex.mobile.ads.impl.u41;
import com.yandex.mobile.ads.impl.v61;
import com.yandex.mobile.ads.impl.vb;
import com.yandex.mobile.ads.impl.w31;
import com.yandex.mobile.ads.impl.yb;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeoutException;
public final class rs extends le implements os {
private int A;
private int B;
private boolean C;
private int D;
private q01 E;
private i11 F;
private dr0.a G;
private ec0 H;
private AudioTrack I;
private Object J;
private Surface K;
private TextureView L;
private int M;
private int N;
private int O;
private int P;
private ub Q;
private float R;
private boolean S;
private boolean T;
private boolean U;
private dp V;
private ec0 W;
private xq0 X;
private int Y;
private long Z;
final p71 b;
final dr0.a c;
private final gk d;
private final dr0 e;
private final pv0[] f;
private final o71 g;
private final my h;
private final ts i;
private final r80<dr0.b> j;
private final CopyOnWriteArraySet<os.a> k;
private final v61.b l;
private final ArrayList m;
private final boolean n;
private final nc0.a o;
private final w8 p;
private final Looper q;
private final ad r;
private final q51 s;
private final b t;
private final vb u;
private final yb v;
private final u41 w;
private final oi1 x;
private final kj1 y;
private final long z;
private static final class a {
public static gr0 a(Context context, rs rsVar, boolean z) {
fc0 a2 = fc0.a(context);
if (a2 == null) {
p90.d("ExoPlayerImpl", "MediaMetricsService unavailable.");
return new gr0(LogSessionId.LOG_SESSION_ID_NONE);
}
if (z) {
rsVar.a(a2);
}
return new gr0(a2.b());
}
}
public final class b implements sf1, ac, j61, le0, SurfaceHolder.Callback, TextureView.SurfaceTextureListener, w31.b, yb.b, vb.b, u41.a, os.a {
private b() {
}
@Override
public final void a(String str, long j, long j2) {
rs.this.p.a(str, j, j2);
}
@Override
public final void b(yv yvVar, cn cnVar) {
rs.this.getClass();
rs.this.p.b(yvVar, cnVar);
}
@Override
public final void c(ym ymVar) {
rs.this.p.c(ymVar);
rs.this.getClass();
rs.this.getClass();
}
@Override
public final void d(ym ymVar) {
rs.this.getClass();
rs.this.p.d(ymVar);
}
@Override
public final void onCues(final List<am> list) {
r80 r80Var = rs.this.j;
r80Var.a(27, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).onCues(list);
}
});
r80Var.a();
}
@Override
public final void onSkipSilenceEnabledChanged(final boolean z) {
if (rs.this.S == z) {
return;
}
rs.this.S = z;
r80 r80Var = rs.this.j;
r80Var.a(23, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).onSkipSilenceEnabledChanged(z);
}
});
r80Var.a();
}
@Override
public final void onSurfaceTextureAvailable(SurfaceTexture surfaceTexture, int i, int i2) {
rs.a(rs.this, surfaceTexture);
rs.this.a(i, i2);
}
@Override
public final boolean onSurfaceTextureDestroyed(SurfaceTexture surfaceTexture) {
rs.this.a((Surface) null);
rs.this.a(0, 0);
return true;
}
@Override
public final void onSurfaceTextureSizeChanged(SurfaceTexture surfaceTexture, int i, int i2) {
rs.this.a(i, i2);
}
@Override
public final void onSurfaceTextureUpdated(SurfaceTexture surfaceTexture) {
}
@Override
public final void surfaceChanged(SurfaceHolder surfaceHolder, int i, int i2, int i3) {
rs.this.a(i2, i3);
}
@Override
public final void surfaceCreated(SurfaceHolder surfaceHolder) {
rs.this.getClass();
}
@Override
public final void surfaceDestroyed(SurfaceHolder surfaceHolder) {
rs.this.getClass();
rs.this.a(0, 0);
}
b(rs rsVar, int i) {
this();
}
@Override
public final void a(final wf1 wf1Var) {
rs.this.getClass();
r80 r80Var = rs.this.j;
r80Var.a(25, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).a(wf1.this);
}
});
r80Var.a();
}
@Override
public final void b(int i, long j) {
rs.this.p.b(i, j);
}
@Override
public final void b(ym ymVar) {
rs.this.getClass();
rs.this.p.b(ymVar);
}
@Override
public final void c(Exception exc) {
rs.this.p.c(exc);
}
public final void c() {
final dp b = rs.b(rs.this.w);
if (b.equals(rs.this.V)) {
return;
}
rs.this.V = b;
r80 r80Var = rs.this.j;
r80Var.a(29, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).a(dp.this);
}
});
r80Var.a();
}
@Override
public final void a(Object obj, long j) {
rs.this.p.a(obj, j);
if (rs.this.J == obj) {
r80 r80Var = rs.this.j;
r80Var.a(26, new r80.a() {
@Override
public final void invoke(Object obj2) {
((dr0.b) obj2).onRenderedFirstFrame();
}
});
r80Var.a();
}
}
@Override
public final void b(String str, long j, long j2) {
rs.this.p.b(str, j, j2);
}
@Override
public final void b(String str) {
rs.this.p.b(str);
}
@Override
public final void b(Exception exc) {
rs.this.p.b(exc);
}
@Override
public final void b() {
rs.this.a((Surface) null);
}
@Override
public final void a(String str) {
rs.this.p.a(str);
}
@Override
public final void a(int i, long j) {
rs.this.p.a(i, j);
}
@Override
public final void a(yv yvVar, cn cnVar) {
rs.this.getClass();
rs.this.p.a(yvVar, cnVar);
}
@Override
public final void a(long j) {
rs.this.p.a(j);
}
@Override
public final void a(int i, long j, long j2) {
rs.this.p.a(i, j, j2);
}
@Override
public final void a(ym ymVar) {
rs.this.p.a(ymVar);
rs.this.getClass();
rs.this.getClass();
}
@Override
public final void a(Exception exc) {
rs.this.p.a(exc);
}
@Override
public final void a(final cm cmVar) {
rs.this.getClass();
r80 r80Var = rs.this.j;
r80Var.a(27, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).a(cm.this);
}
});
r80Var.a();
}
@Override
public final void a(final Metadata metadata) {
rs rsVar = rs.this;
ec0 ec0Var = rsVar.W;
ec0Var.getClass();
ec0.a aVar = new ec0.a(ec0Var, 0);
for (int i = 0; i < metadata.c(); i++) {
metadata.a(i).a(aVar);
}
rsVar.W = new ec0(aVar, 0);
ec0 c = rs.c(rs.this);
if (!c.equals(rs.this.H)) {
rs.this.H = c;
rs.this.j.a(14, new r80.a() {
@Override
public final void invoke(Object obj) {
rs.b.this.a((dr0.b) obj);
}
});
}
rs.this.j.a(28, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).a(Metadata.this);
}
});
rs.this.j.a();
}
public void a(dr0.b bVar) {
bVar.a(rs.this.H);
}
@Override
public final void a(Surface surface) {
rs.this.a(surface);
}
public final void a(final boolean z, final int i) {
r80 r80Var = rs.this.j;
r80Var.a(30, new r80.a() {
@Override
public final void invoke(Object obj) {
dr0.b bVar = (dr0.b) obj;
bVar.a(z, i);
}
});
r80Var.a();
}
@Override
public final void a() {
rs.h(rs.this);
}
}
private static final class c implements xe1, eh, hr0.b {
private xe1 b;
private eh c;
private xe1 d;
private eh e;
private c() {
}
@Override
public final void a(int i, Object obj) {
if (i == 7) {
this.b = (xe1) obj;
return;
}
if (i == 8) {
this.c = (eh) obj;
return;
}
if (i != 10000) {
return;
}
w31 w31Var = (w31) obj;
if (w31Var == null) {
this.d = null;
this.e = null;
} else {
this.d = w31Var.b();
this.e = w31Var.a();
}
}
@Override
public final void f() {
eh ehVar = this.e;
if (ehVar != null) {
ehVar.f();
}
eh ehVar2 = this.c;
if (ehVar2 != null) {
ehVar2.f();
}
}
c(int i) {
this();
}
@Override
public final void a(long j, long j2, yv yvVar, MediaFormat mediaFormat) {
xe1 xe1Var = this.d;
if (xe1Var != null) {
xe1Var.a(j, j2, yvVar, mediaFormat);
}
xe1 xe1Var2 = this.b;
if (xe1Var2 != null) {
xe1Var2.a(j, j2, yvVar, mediaFormat);
}
}
@Override
public final void a(long j, float[] fArr) {
eh ehVar = this.e;
if (ehVar != null) {
ehVar.a(j, fArr);
}
eh ehVar2 = this.c;
if (ehVar2 != null) {
ehVar2.a(j, fArr);
}
}
}
public static final class d implements pc0 {
private final Object f10038a;
private v61 b;
public d(v61 v61Var, Object obj) {
this.f10038a = obj;
this.b = v61Var;
}
@Override
public final v61 b() {
return this.b;
}
@Override
public final Object a() {
return this.f10038a;
}
}
static {
us.a("goog.exo.exoplayer");
}
public rs(os.b bVar) {
gr0 a2;
final rs rsVar = this;
gk gkVar = new gk();
rsVar.d = gkVar;
try {
p90.c("ExoPlayerImpl", "Init " + Integer.toHexString(System.identityHashCode(this)) + " [ExoPlayerLib/2.18.1] [" + da1.e + "]");
Context applicationContext = bVar.f9797a.getApplicationContext();
w8 apply = bVar.h.apply(bVar.b);
rsVar.p = apply;
rsVar.Q = bVar.j;
rsVar.M = bVar.k;
int i = 0;
rsVar.S = false;
rsVar.z = bVar.p;
b bVar2 = new b(rsVar, i);
rsVar.t = bVar2;
Object cVar = new c(i);
Handler handler = new Handler(bVar.i);
pv0[] a3 = bVar.c.get().a(handler, bVar2, bVar2, bVar2, bVar2);
rsVar.f = a3;
pa.b(a3.length > 0);
o71 o71Var = bVar.e.get();
rsVar.g = o71Var;
rsVar.o = bVar.d.get();
ad adVar = bVar.g.get();
rsVar.r = adVar;
rsVar.n = bVar.l;
rsVar.E = bVar.m;
Looper looper = bVar.i;
rsVar.q = looper;
q51 q51Var = bVar.b;
rsVar.s = q51Var;
rsVar.e = rsVar;
rsVar.j = new r80<>(looper, q51Var, new r80.b() {
@Override
public final void a(Object obj, qv qvVar) {
rs.this.a((dr0.b) obj, qvVar);
}
});
rsVar.k = new CopyOnWriteArraySet<>();
rsVar.m = new ArrayList();
rsVar.F = new i11.a();
p71 p71Var = new p71(new rv0[a3.length], new et[a3.length], e81.b, null);
rsVar.b = p71Var;
rsVar.l = new v61.b();
dr0.a a4 = new dr0.a.C0415a().a(1, 2, 3, 13, 14, 15, 16, 17, 18, 19, 31, 20, 30, 21, 22, 23, 24, 25, 26, 27, 28).a(o71Var.c(), 29).a();
rsVar.c = a4;
rsVar.G = new dr0.a.C0415a().a(a4).a(4).a(10).a();
rsVar.h = q51Var.a(looper, null);
ts.e eVar = new ts.e() {
@Override
public final void a(ts.d dVar) {
rs.this.b(dVar);
}
};
rsVar.X = xq0.a(p71Var);
apply.a(rsVar, looper);
int i2 = da1.f8931a;
if (i2 < 31) {
a2 = new gr0();
} else {
a2 = a.a(applicationContext, rsVar, bVar.q);
}
gr0 gr0Var = a2;
t80 t80Var = bVar.f.get();
q01 q01Var = rsVar.E;
try {
rsVar = this;
rsVar.i = new ts(a3, o71Var, p71Var, t80Var, adVar, 0, apply, q01Var, bVar.n, bVar.o, false, looper, q51Var, eVar, gr0Var);
rsVar.R = 1.0f;
ec0 ec0Var = ec0.G;
rsVar.H = ec0Var;
rsVar.W = ec0Var;
rsVar.Y = -1;
if (i2 < 21) {
rsVar.P = f();
} else {
rsVar.P = da1.a(applicationContext);
}
int i3 = cm.f8879a;
rsVar.T = true;
rsVar.b(apply);
adVar.a(new Handler(looper), apply);
rsVar.a(bVar2);
vb vbVar = new vb(bVar.f9797a, handler, bVar2);
rsVar.u = vbVar;
vbVar.a();
yb ybVar = new yb(bVar.f9797a, handler, bVar2);
rsVar.v = ybVar;
ybVar.d();
u41 u41Var = new u41(bVar.f9797a, handler, bVar2);
rsVar.w = u41Var;
u41Var.a(da1.c(rsVar.Q.c));
oi1 oi1Var = new oi1(bVar.f9797a);
rsVar.x = oi1Var;
oi1Var.a();
kj1 kj1Var = new kj1(bVar.f9797a);
rsVar.y = kj1Var;
kj1Var.a();
rsVar.V = b(u41Var);
int i4 = wf1.e;
o71Var.a(rsVar.Q);
rsVar.a(1, 10, Integer.valueOf(rsVar.P));
rsVar.a(2, 10, Integer.valueOf(rsVar.P));
rsVar.a(1, 3, rsVar.Q);
rsVar.a(2, 4, Integer.valueOf(rsVar.M));
rsVar.a(2, 5, (Object) 0);
rsVar.a(1, 9, Boolean.valueOf(rsVar.S));
rsVar.a(2, 7, cVar);
rsVar.a(6, 8, cVar);
gkVar.e();
} catch (Throwable th) {
th = th;
rsVar = this;
rsVar.d.e();
throw th;
}
} catch (Throwable th2) {
th = th2;
}
}
public static int a(boolean z, int i) {
return (!z || i == 1) ? 1 : 2;
}
public static void c(dr0.b bVar) {
bVar.b(ns.a(new dt(1), 1003));
}
private void h() {
dr0.a aVar = this.G;
dr0 dr0Var = this.e;
dr0.a aVar2 = this.c;
int i = da1.f8931a;
boolean isPlayingAd = dr0Var.isPlayingAd();
boolean isCurrentMediaItemSeekable = dr0Var.isCurrentMediaItemSeekable();
boolean hasPreviousMediaItem = dr0Var.hasPreviousMediaItem();
boolean hasNextMediaItem = dr0Var.hasNextMediaItem();
boolean isCurrentMediaItemLive = dr0Var.isCurrentMediaItemLive();
boolean isCurrentMediaItemDynamic = dr0Var.isCurrentMediaItemDynamic();
boolean c2 = dr0Var.getCurrentTimeline().c();
boolean z = !isPlayingAd;
boolean z2 = false;
dr0.a.C0415a a2 = new dr0.a.C0415a().a(aVar2).a(z, 4).a(isCurrentMediaItemSeekable && !isPlayingAd, 5).a(hasPreviousMediaItem && !isPlayingAd, 6).a(!c2 && (hasPreviousMediaItem || !isCurrentMediaItemLive || isCurrentMediaItemSeekable) && !isPlayingAd, 7).a(hasNextMediaItem && !isPlayingAd, 8).a(!c2 && (hasNextMediaItem || (isCurrentMediaItemLive && isCurrentMediaItemDynamic)) && !isPlayingAd, 9).a(z, 10).a(isCurrentMediaItemSeekable && !isPlayingAd, 11);
if (isCurrentMediaItemSeekable && !isPlayingAd) {
z2 = true;
}
dr0.a a3 = a2.a(z2, 12).a();
this.G = a3;
if (a3.equals(aVar)) {
return;
}
this.j.a(13, new r80.a() {
@Override
public final void invoke(Object obj) {
rs.this.d((dr0.b) obj);
}
});
}
public final void e() {
i();
}
@Override
public final long getContentPosition() {
i();
if (isPlayingAd()) {
xq0 xq0Var = this.X;
xq0Var.f10475a.a(xq0Var.b.f9391a, this.l);
xq0 xq0Var2 = this.X;
if (xq0Var2.c == -9223372036854775807L) {
return da1.b(xq0Var2.f10475a.a(getCurrentMediaItemIndex(), this.f9523a, 0L).m);
}
return da1.b(this.l.e) + da1.b(this.X.c);
}
return getCurrentPosition();
}
@Override
public final int getCurrentAdGroupIndex() {
i();
if (isPlayingAd()) {
return this.X.b.b;
}
return -1;
}
@Override
public final int getCurrentAdIndexInAdGroup() {
i();
if (isPlayingAd()) {
return this.X.b.c;
}
return -1;
}
@Override
public final int getCurrentMediaItemIndex() {
i();
int c2 = c();
if (c2 == -1) {
return 0;
}
return c2;
}
@Override
public final int getCurrentPeriodIndex() {
i();
if (this.X.f10475a.c()) {
return 0;
}
xq0 xq0Var = this.X;
return xq0Var.f10475a.a(xq0Var.b.f9391a);
}
@Override
public final long getCurrentPosition() {
long j;
i();
xq0 xq0Var = this.X;
if (xq0Var.f10475a.c()) {
j = da1.a(this.Z);
} else if (xq0Var.b.a()) {
j = xq0Var.r;
} else {
v61 v61Var = xq0Var.f10475a;
nc0.b bVar = xq0Var.b;
long j2 = xq0Var.r;
v61Var.a(bVar.f9391a, this.l);
j = this.l.e + j2;
}
return da1.b(j);
}
@Override
public final v61 getCurrentTimeline() {
i();
return this.X.f10475a;
}
@Override
public final e81 getCurrentTracks() {
i();
return this.X.i.d;
}
@Override
public final long getDuration() {
i();
if (isPlayingAd()) {
xq0 xq0Var = this.X;
nc0.b bVar = xq0Var.b;
xq0Var.f10475a.a(bVar.f9391a, this.l);
return da1.b(this.l.a(bVar.b, bVar.c));
}
v61 currentTimeline = getCurrentTimeline();
if (currentTimeline.c()) {
return -9223372036854775807L;
}
return da1.b(currentTimeline.a(getCurrentMediaItemIndex(), this.f9523a, 0L).n);
}
@Override
public final boolean getPlayWhenReady() {
i();
return this.X.l;
}
@Override
public final int getPlaybackState() {
i();
return this.X.e;
}
@Override
public final int getPlaybackSuppressionReason() {
i();
return this.X.m;
}
@Override
public final long getTotalBufferedDuration() {
i();
return da1.b(this.X.q);
}
@Override
public final float getVolume() {
i();
return this.R;
}
@Override
public final boolean isPlayingAd() {
i();
return this.X.b.a();
}
@Override
public final void prepare() {
i();
boolean playWhenReady = getPlayWhenReady();
int a2 = this.v.a(playWhenReady, 2);
a(a2, (!playWhenReady || a2 == 1) ? 1 : 2, playWhenReady);
xq0 xq0Var = this.X;
if (xq0Var.e != 1) {
return;
}
xq0 a3 = xq0Var.a((ns) null);
xq0 a4 = a3.a(a3.f10475a.c() ? 4 : 2);
this.A++;
this.i.i();
a(a4, 1, 1, false, 5, -9223372036854775807L);
}
@Override
public final void release() {
AudioTrack audioTrack;
StringBuilder a2 = v60.a("Release ");
a2.append(Integer.toHexString(System.identityHashCode(this)));
a2.append(" [");
a2.append("ExoPlayerLib/2.18.1");
a2.append("] [");
a2.append(da1.e);
a2.append("] [");
a2.append(us.a());
a2.append("]");
p90.c("ExoPlayerImpl", a2.toString());
i();
if (da1.f8931a < 21 && (audioTrack = this.I) != null) {
audioTrack.release();
this.I = null;
}
this.u.a();
this.w.c();
this.x.a(false);
this.y.a(false);
this.v.c();
if (!this.i.k()) {
r80<dr0.b> r80Var = this.j;
r80Var.a(10, new r80.a() {
@Override
public final void invoke(Object obj) {
rs.c((dr0.b) obj);
}
});
r80Var.a();
}
this.j.b();
this.h.a();
this.r.a(this.p);
xq0 a3 = this.X.a(1);
this.X = a3;
xq0 a4 = a3.a(a3.b);
this.X = a4;
a4.p = a4.r;
this.X.q = 0L;
this.p.release();
this.g.d();
g();
Surface surface = this.K;
if (surface != null) {
surface.release();
this.K = null;
}
int i = cm.f8879a;
}
@Override
public final void setPlayWhenReady(boolean z) {
i();
int a2 = this.v.a(z, getPlaybackState());
int i = 1;
if (z && a2 != 1) {
i = 2;
}
a(a2, i, z);
}
@Override
public final void setVideoTextureView(TextureView textureView) {
i();
if (textureView == null) {
i();
g();
a((Surface) null);
a(0, 0);
return;
}
g();
this.L = textureView;
if (textureView.getSurfaceTextureListener() != null) {
p90.d("ExoPlayerImpl", "Replacing existing SurfaceTextureListener.");
}
textureView.setSurfaceTextureListener(this.t);
SurfaceTexture surfaceTexture = textureView.isAvailable() ? textureView.getSurfaceTexture() : null;
if (surfaceTexture == null) {
a((Surface) null);
a(0, 0);
} else {
Surface surface = new Surface(surfaceTexture);
a(surface);
this.K = surface;
a(textureView.getWidth(), textureView.getHeight());
}
}
@Override
public final void setVolume(float f) {
i();
int i = da1.f8931a;
final float max = Math.max(0.0f, Math.min(f, 1.0f));
if (this.R == max) {
return;
}
this.R = max;
a(1, 2, Float.valueOf(this.v.b() * max));
r80<dr0.b> r80Var = this.j;
r80Var.a(22, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).onVolumeChanged(max);
}
});
r80Var.a();
}
@Override
public final void stop() {
i();
i();
this.v.a(getPlayWhenReady(), 1);
a((ns) null);
int i = cm.f8879a;
}
public static void e(xq0 xq0Var, dr0.b bVar) {
bVar.onPlayerStateChanged(xq0Var.l, xq0Var.e);
}
public static void f(xq0 xq0Var, dr0.b bVar) {
bVar.onPlaybackStateChanged(xq0Var.e);
}
public static void g(xq0 xq0Var, dr0.b bVar) {
bVar.onPlaybackSuppressionReasonChanged(xq0Var.m);
}
public static void i(xq0 xq0Var, dr0.b bVar) {
bVar.a(xq0Var.n);
}
public final void d() {
i();
}
public static void d(xq0 xq0Var, dr0.b bVar) {
boolean z = xq0Var.g;
bVar.b();
bVar.onIsLoadingChanged(xq0Var.g);
}
public static void e(rs rsVar) {
rsVar.a(1, 2, Float.valueOf(rsVar.R * rsVar.v.b()));
}
private int f() {
AudioTrack audioTrack = this.I;
if (audioTrack != null && audioTrack.getAudioSessionId() != 0) {
this.I.release();
this.I = null;
}
if (this.I == null) {
this.I = new AudioTrack(3, 4000, 4, 2, 2, 0, 0);
}
return this.I.getAudioSessionId();
}
private void g() {
TextureView textureView = this.L;
if (textureView != null) {
if (textureView.getSurfaceTextureListener() != this.t) {
p90.d("ExoPlayerImpl", "SurfaceTextureListener already unset or replaced.");
} else {
this.L.setSurfaceTextureListener(null);
}
this.L = null;
}
}
private void i() {
this.d.b();
if (Thread.currentThread() != this.q.getThread()) {
Object[] objArr = {Thread.currentThread().getName(), this.q.getThread().getName()};
int i = da1.f8931a;
String format = String.format(Locale.US, "Player is accessed on the wrong thread.\nCurrent thread: '%s'\nExpected thread: '%s'\nSee https://exoplayer.dev/issues/player-accessed-on-wrong-thread", objArr);
if (!this.T) {
p90.b("ExoPlayerImpl", format, this.U ? null : new IllegalStateException());
this.U = true;
return;
}
throw new IllegalStateException(format);
}
}
@Override
public final void b(dr0.b bVar) {
bVar.getClass();
this.j.a((r80<dr0.b>) bVar);
}
private int c() {
if (this.X.f10475a.c()) {
return this.Y;
}
xq0 xq0Var = this.X;
return xq0Var.f10475a.a(xq0Var.b.f9391a, this.l).c;
}
public void b(final ts.d dVar) {
this.h.a(new Runnable() {
@Override
public final void run() {
rs.this.a(dVar);
}
});
}
public void d(dr0.b bVar) {
bVar.a(this.G);
}
static void a(rs rsVar, SurfaceTexture surfaceTexture) {
rsVar.getClass();
Surface surface = new Surface(surfaceTexture);
rsVar.a(surface);
rsVar.K = surface;
}
public static void b(xq0 xq0Var, dr0.b bVar) {
bVar.b(xq0Var.f);
}
public static void b(xq0 xq0Var, int i, dr0.b bVar) {
bVar.onPlayWhenReadyChanged(xq0Var.l, i);
}
public static dp b(u41 u41Var) {
return new dp(0, u41Var.b(), u41Var.a());
}
public static void c(xq0 xq0Var, dr0.b bVar) {
bVar.a(xq0Var.i.d);
}
static ec0 c(rs rsVar) {
v61 currentTimeline = rsVar.getCurrentTimeline();
if (currentTimeline.c()) {
return rsVar.W;
}
bc0 bc0Var = currentTimeline.a(rsVar.getCurrentMediaItemIndex(), rsVar.f9523a, 0L).c;
ec0 ec0Var = rsVar.W;
ec0Var.getClass();
return new ec0(new ec0.a(ec0Var, 0).a(bc0Var.d), 0);
}
@Override
public final void a(dr0.b bVar) {
bVar.getClass();
this.j.b(bVar);
}
public void a(dr0.b bVar, qv qvVar) {
bVar.a();
}
public final void a(os.a aVar) {
this.k.add(aVar);
}
@Override
public final ns a() {
i();
return this.X.f;
}
@Override
public final void a(it0 it0Var) {
long j;
long j2;
i();
List singletonList = Collections.singletonList(it0Var);
i();
i();
c();
getCurrentPosition();
this.A++;
if (!this.m.isEmpty()) {
int size = this.m.size();
for (int i = size - 1; i >= 0; i--) {
this.m.remove(i);
}
this.F = this.F.c(size);
}
ArrayList arrayList = new ArrayList();
for (int i2 = 0; i2 < singletonList.size(); i2++) {
qc0.c cVar = new qc0.c((nc0) singletonList.get(i2), this.n);
arrayList.add(cVar);
this.m.add(i2 + 0, new d(cVar.f9928a.f(), cVar.b));
}
i11.a b2 = this.F.b(arrayList.size());
this.F = b2;
vr0 vr0Var = new vr0(this.m, b2);
if (!vr0Var.c() && -1 >= vr0Var.b()) {
throw new w10();
}
int a2 = vr0Var.a(false);
xq0 a3 = a(this.X, vr0Var, a(vr0Var, a2, -9223372036854775807L));
int i3 = a3.e;
if (a2 != -1 && i3 != 1) {
i3 = (vr0Var.c() || a2 >= vr0Var.b()) ? 4 : 2;
}
xq0 a4 = a3.a(i3);
this.i.a(a2, da1.a(-9223372036854775807L), this.F, arrayList);
boolean z = (this.X.b.f9391a.equals(a4.b.f9391a) || this.X.f10475a.c()) ? false : true;
if (a4.f10475a.c()) {
j2 = da1.a(this.Z);
} else if (a4.b.a()) {
j2 = a4.r;
} else {
v61 v61Var = a4.f10475a;
nc0.b bVar = a4.b;
long j3 = a4.r;
v61Var.a(bVar.f9391a, this.l);
j = j3 + this.l.e;
a(a4, 0, 1, z, 4, j);
}
j = j2;
a(a4, 0, 1, z, 4, j);
}
static void h(rs rsVar) {
int playbackState = rsVar.getPlaybackState();
if (playbackState != 1) {
if (playbackState == 2 || playbackState == 3) {
rsVar.i();
rsVar.x.a(rsVar.getPlayWhenReady() && !rsVar.X.o);
rsVar.y.a(rsVar.getPlayWhenReady());
return;
}
if (playbackState != 4) {
throw new IllegalStateException();
}
}
rsVar.x.a(false);
rsVar.y.a(false);
}
public static void h(xq0 xq0Var, dr0.b bVar) {
bVar.onIsPlayingChanged(xq0Var.e == 3 && xq0Var.l && xq0Var.m == 0);
}
public final void a(fc0 fc0Var) {
this.p.a(fc0Var);
}
private void a(ns nsVar) {
long j;
long j2;
xq0 xq0Var = this.X;
xq0 a2 = xq0Var.a(xq0Var.b);
a2.p = a2.r;
a2.q = 0L;
xq0 a3 = a2.a(1);
if (nsVar != null) {
a3 = a3.a(nsVar);
}
xq0 xq0Var2 = a3;
this.A++;
this.i.q();
boolean z = xq0Var2.f10475a.c() && !this.X.f10475a.c();
if (xq0Var2.f10475a.c()) {
j2 = da1.a(this.Z);
} else if (xq0Var2.b.a()) {
j2 = xq0Var2.r;
} else {
v61 v61Var = xq0Var2.f10475a;
nc0.b bVar = xq0Var2.b;
long j3 = xq0Var2.r;
v61Var.a(bVar.f9391a, this.l);
j = j3 + this.l.e;
a(xq0Var2, 0, 1, z, 4, j);
}
j = j2;
a(xq0Var2, 0, 1, z, 4, j);
}
public void a(ts.d dVar) {
long j;
boolean z;
int i = this.A - dVar.c;
this.A = i;
boolean z2 = true;
if (dVar.d) {
this.B = dVar.e;
this.C = true;
}
if (dVar.f) {
this.D = dVar.g;
}
if (i == 0) {
v61 v61Var = dVar.b.f10475a;
if (!this.X.f10475a.c() && v61Var.c()) {
this.Y = -1;
this.Z = 0L;
}
if (!v61Var.c()) {
List<v61> d2 = ((vr0) v61Var).d();
pa.b(d2.size() == this.m.size());
for (int i2 = 0; i2 < d2.size(); i2++) {
((d) this.m.get(i2)).b = d2.get(i2);
}
}
long j2 = -9223372036854775807L;
if (this.C) {
if (dVar.b.b.equals(this.X.b) && dVar.b.d == this.X.r) {
z2 = false;
}
if (z2) {
if (!v61Var.c() && !dVar.b.b.a()) {
xq0 xq0Var = dVar.b;
nc0.b bVar = xq0Var.b;
long j3 = xq0Var.d;
v61Var.a(bVar.f9391a, this.l);
j2 = j3 + this.l.e;
} else {
j2 = dVar.b.d;
}
}
z = z2;
j = j2;
} else {
j = -9223372036854775807L;
z = false;
}
this.C = false;
a(dVar.b, 1, this.D, z, this.B, j);
}
}
private void a(final xq0 xq0Var, final int i, final int i2, boolean z, final int i3, long j) {
Pair pair;
int i4;
final bc0 bc0Var;
boolean z2;
boolean z3;
boolean z4;
Object obj;
int i5;
bc0 bc0Var2;
Object obj2;
int i6;
long j2;
long j3;
long j4;
long a2;
Object obj3;
bc0 bc0Var3;
Object obj4;
int i7;
xq0 xq0Var2 = this.X;
this.X = xq0Var;
boolean z5 = !xq0Var2.f10475a.equals(xq0Var.f10475a);
v61 v61Var = xq0Var2.f10475a;
v61 v61Var2 = xq0Var.f10475a;
if (v61Var2.c() && v61Var.c()) {
pair = new Pair(Boolean.FALSE, -1);
} else if (v61Var2.c() != v61Var.c()) {
pair = new Pair(Boolean.TRUE, 3);
} else if (!v61Var.a(v61Var.a(xq0Var2.b.f9391a, this.l).c, this.f9523a, 0L).f10289a.equals(v61Var2.a(v61Var2.a(xq0Var.b.f9391a, this.l).c, this.f9523a, 0L).f10289a)) {
if (z && i3 == 0) {
i4 = 1;
} else if (z && i3 == 1) {
i4 = 2;
} else {
if (!z5) {
throw new IllegalStateException();
}
i4 = 3;
}
pair = new Pair(Boolean.TRUE, Integer.valueOf(i4));
} else if (z && i3 == 0 && xq0Var2.b.d < xq0Var.b.d) {
pair = new Pair(Boolean.TRUE, 0);
} else {
pair = new Pair(Boolean.FALSE, -1);
}
boolean booleanValue = ((Boolean) pair.first).booleanValue();
final int intValue = ((Integer) pair.second).intValue();
ec0 ec0Var = this.H;
if (booleanValue) {
bc0 bc0Var4 = !xq0Var.f10475a.c() ? xq0Var.f10475a.a(xq0Var.f10475a.a(xq0Var.b.f9391a, this.l).c, this.f9523a, 0L).c : null;
this.W = ec0.G;
bc0Var = bc0Var4;
} else {
bc0Var = null;
}
if (booleanValue || !xq0Var2.j.equals(xq0Var.j)) {
ec0 ec0Var2 = this.W;
ec0Var2.getClass();
ec0.a aVar = new ec0.a(ec0Var2, 0);
List<Metadata> list = xq0Var.j;
for (int i8 = 0; i8 < list.size(); i8++) {
Metadata metadata = list.get(i8);
for (int i9 = 0; i9 < metadata.c(); i9++) {
metadata.a(i9).a(aVar);
}
}
this.W = new ec0(aVar, 0);
v61 currentTimeline = getCurrentTimeline();
if (currentTimeline.c()) {
ec0Var = this.W;
} else {
bc0 bc0Var5 = currentTimeline.a(getCurrentMediaItemIndex(), this.f9523a, 0L).c;
ec0 ec0Var3 = this.W;
ec0Var3.getClass();
ec0Var = new ec0(new ec0.a(ec0Var3, 0).a(bc0Var5.d), 0);
}
}
boolean z6 = !ec0Var.equals(this.H);
this.H = ec0Var;
boolean z7 = xq0Var2.l != xq0Var.l;
boolean z8 = xq0Var2.e != xq0Var.e;
if (z8 || z7) {
int playbackState = getPlaybackState();
if (playbackState != 1) {
if (playbackState == 2 || playbackState == 3) {
i();
this.x.a(getPlayWhenReady() && !this.X.o);
this.y.a(getPlayWhenReady());
} else if (playbackState != 4) {
throw new IllegalStateException();
}
}
this.x.a(false);
this.y.a(false);
}
boolean z9 = xq0Var2.g != xq0Var.g;
if (!xq0Var2.f10475a.equals(xq0Var.f10475a)) {
this.j.a(0, new r80.a() {
@Override
public final void invoke(Object obj5) {
rs.a(xq0.this, i, (dr0.b) obj5);
}
});
}
if (z) {
v61.b bVar = new v61.b();
if (xq0Var2.f10475a.c()) {
z2 = z7;
z3 = z9;
obj = null;
i5 = -1;
bc0Var2 = null;
obj2 = null;
i6 = -1;
} else {
Object obj5 = xq0Var2.b.f9391a;
xq0Var2.f10475a.a(obj5, bVar);
int i10 = bVar.c;
int a3 = xq0Var2.f10475a.a(obj5);
z2 = z7;
z3 = z9;
obj2 = obj5;
obj = xq0Var2.f10475a.a(i10, this.f9523a, 0L).f10289a;
bc0Var2 = this.f9523a.c;
i5 = i10;
i6 = a3;
}
if (i3 == 0) {
if (xq0Var2.b.a()) {
nc0.b bVar2 = xq0Var2.b;
j4 = bVar.a(bVar2.b, bVar2.c);
a2 = a(xq0Var2);
} else if (xq0Var2.b.e != -1) {
j4 = a(this.X);
a2 = j4;
} else {
j2 = bVar.e;
j3 = bVar.d;
j4 = j2 + j3;
a2 = j4;
}
} else if (xq0Var2.b.a()) {
j4 = xq0Var2.r;
a2 = a(xq0Var2);
} else {
j2 = bVar.e;
j3 = xq0Var2.r;
j4 = j2 + j3;
a2 = j4;
}
long b2 = da1.b(j4);
long b3 = da1.b(a2);
nc0.b bVar3 = xq0Var2.b;
final dr0.c cVar = new dr0.c(obj, i5, bc0Var2, obj2, i6, b2, b3, bVar3.b, bVar3.c);
int currentMediaItemIndex = getCurrentMediaItemIndex();
if (this.X.f10475a.c()) {
z4 = z8;
obj3 = null;
bc0Var3 = null;
obj4 = null;
i7 = -1;
} else {
xq0 xq0Var3 = this.X;
Object obj6 = xq0Var3.b.f9391a;
xq0Var3.f10475a.a(obj6, this.l);
int a4 = this.X.f10475a.a(obj6);
z4 = z8;
Object obj7 = this.X.f10475a.a(currentMediaItemIndex, this.f9523a, 0L).f10289a;
i7 = a4;
bc0Var3 = this.f9523a.c;
obj3 = obj7;
obj4 = obj6;
}
long b4 = da1.b(j);
long b5 = this.X.b.a() ? da1.b(a(this.X)) : b4;
nc0.b bVar4 = this.X.b;
final dr0.c cVar2 = new dr0.c(obj3, currentMediaItemIndex, bc0Var3, obj4, i7, b4, b5, bVar4.b, bVar4.c);
this.j.a(11, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.a(i3, cVar, cVar2, (dr0.b) obj8);
}
});
} else {
z2 = z7;
z3 = z9;
z4 = z8;
}
if (booleanValue) {
this.j.a(1, new r80.a() {
@Override
public final void invoke(Object obj8) {
((dr0.b) obj8).a(bc0.this, intValue);
}
});
}
if (xq0Var2.f != xq0Var.f) {
this.j.a(10, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.a(xq0.this, (dr0.b) obj8);
}
});
if (xq0Var.f != null) {
this.j.a(10, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.b(xq0.this, (dr0.b) obj8);
}
});
}
}
p71 p71Var = xq0Var2.i;
p71 p71Var2 = xq0Var.i;
if (p71Var != p71Var2) {
this.g.a(p71Var2.e);
this.j.a(2, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.c(xq0.this, (dr0.b) obj8);
}
});
}
if (z6) {
final ec0 ec0Var4 = this.H;
this.j.a(14, new r80.a() {
@Override
public final void invoke(Object obj8) {
((dr0.b) obj8).a(ec0.this);
}
});
}
if (z3) {
this.j.a(3, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.d(xq0.this, (dr0.b) obj8);
}
});
}
if (z4 || z2) {
this.j.a(-1, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.e(xq0.this, (dr0.b) obj8);
}
});
}
if (z4) {
this.j.a(4, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.f(xq0.this, (dr0.b) obj8);
}
});
}
if (z2) {
this.j.a(5, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.b(xq0.this, i2, (dr0.b) obj8);
}
});
}
if (xq0Var2.m != xq0Var.m) {
this.j.a(6, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.g(xq0.this, (dr0.b) obj8);
}
});
}
if ((xq0Var2.e == 3 && xq0Var2.l && xq0Var2.m == 0) != (xq0Var.e == 3 && xq0Var.l && xq0Var.m == 0)) {
this.j.a(7, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.h(xq0.this, (dr0.b) obj8);
}
});
}
if (!xq0Var2.n.equals(xq0Var.n)) {
this.j.a(12, new r80.a() {
@Override
public final void invoke(Object obj8) {
rs.i(xq0.this, (dr0.b) obj8);
}
});
}
h();
this.j.a();
if (xq0Var2.o != xq0Var.o) {
Iterator<os.a> it = this.k.iterator();
while (it.hasNext()) {
it.next().a();
}
}
}
public static void a(xq0 xq0Var, int i, dr0.b bVar) {
v61 v61Var = xq0Var.f10475a;
bVar.a(i);
}
public static void a(int i, dr0.c cVar, dr0.c cVar2, dr0.b bVar) {
bVar.c();
bVar.a(cVar, cVar2, i);
}
public static void a(xq0 xq0Var, dr0.b bVar) {
bVar.a(xq0Var.f);
}
private static long a(xq0 xq0Var) {
v61.d dVar = new v61.d();
v61.b bVar = new v61.b();
xq0Var.f10475a.a(xq0Var.b.f9391a, bVar);
long j = xq0Var.c;
if (j == -9223372036854775807L) {
return xq0Var.f10475a.a(bVar.c, dVar, 0L).m;
}
return bVar.e + j;
}
private xq0 a(xq0 xq0Var, v61 v61Var, Pair<Object, Long> pair) {
nc0.b bVar;
p71 p71Var;
xq0 a2;
long j;
pa.a(v61Var.c() || pair != null);
v61 v61Var2 = xq0Var.f10475a;
xq0 a3 = xq0Var.a(v61Var);
if (v61Var.c()) {
nc0.b a4 = xq0.a();
long a5 = da1.a(this.Z);
xq0 a6 = a3.a(a4, a5, a5, a5, 0L, i71.d, this.b, com.yandex.mobile.ads.embedded.guava.collect.p.i()).a(a4);
a6.p = a6.r;
return a6;
}
Object obj = a3.b.f9391a;
int i = da1.f8931a;
boolean z = !obj.equals(pair.first);
nc0.b bVar2 = z ? new nc0.b(pair.first) : a3.b;
long longValue = ((Long) pair.second).longValue();
long a7 = da1.a(getContentPosition());
if (!v61Var2.c()) {
a7 -= v61Var2.a(obj, this.l).e;
}
if (z || longValue < a7) {
pa.b(!bVar2.a());
i71 i71Var = z ? i71.d : a3.h;
if (z) {
bVar = bVar2;
p71Var = this.b;
} else {
bVar = bVar2;
p71Var = a3.i;
}
xq0 a8 = a3.a(bVar, longValue, longValue, longValue, 0L, i71Var, p71Var, z ? com.yandex.mobile.ads.embedded.guava.collect.p.i() : a3.j).a(bVar);
a8.p = longValue;
return a8;
}
if (longValue == a7) {
int a9 = v61Var.a(a3.k.f9391a);
if (a9 != -1 && v61Var.a(a9, this.l, false).c == v61Var.a(bVar2.f9391a, this.l).c) {
return a3;
}
v61Var.a(bVar2.f9391a, this.l);
if (bVar2.a()) {
j = this.l.a(bVar2.b, bVar2.c);
} else {
j = this.l.d;
}
a2 = a3.a(bVar2, a3.r, a3.r, a3.d, j - a3.r, a3.h, a3.i, a3.j).a(bVar2);
a2.p = j;
} else {
pa.b(!bVar2.a());
long max = Math.max(0L, a3.q - (longValue - a7));
long j2 = a3.p;
if (a3.k.equals(a3.b)) {
j2 = longValue + max;
}
a2 = a3.a(bVar2, longValue, longValue, longValue, max, a3.h, a3.i, a3.j);
a2.p = j2;
}
return a2;
}
private Pair<Object, Long> a(v61 v61Var, int i, long j) {
if (v61Var.c()) {
this.Y = i;
if (j == -9223372036854775807L) {
j = 0;
}
this.Z = j;
return null;
}
if (i == -1 || i >= v61Var.b()) {
i = v61Var.a(false);
j = da1.b(v61Var.a(i, this.f9523a, 0L).m);
}
return v61Var.a(this.f9523a, this.l, i, da1.a(j));
}
public void a(Surface surface) {
ArrayList arrayList = new ArrayList();
boolean z = false;
for (pv0 pv0Var : this.f) {
if (pv0Var.m() == 2) {
int c2 = c();
ts tsVar = this.i;
arrayList.add(new hr0(tsVar, pv0Var, this.X.f10475a, c2 == -1 ? 0 : c2, this.s, tsVar.d()).a(1).a(surface).e());
}
}
Object obj = this.J;
if (obj != null && obj != surface) {
try {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
((hr0) it.next()).a(this.z);
}
} catch (InterruptedException unused) {
Thread.currentThread().interrupt();
} catch (TimeoutException unused2) {
z = true;
}
Object obj2 = this.J;
Surface surface2 = this.K;
if (obj2 == surface2) {
surface2.release();
this.K = null;
}
}
this.J = surface;
if (z) {
a(ns.a(new dt(3), 1003));
}
}
public void a(final int i, final int i2) {
if (i == this.N && i2 == this.O) {
return;
}
this.N = i;
this.O = i2;
r80<dr0.b> r80Var = this.j;
r80Var.a(24, new r80.a() {
@Override
public final void invoke(Object obj) {
((dr0.b) obj).onSurfaceSizeChanged(i, i2);
}
});
r80Var.a();
}
public void a(int i, int i2, boolean z) {
int i3 = 0;
boolean z2 = z && i != -1;
if (z2 && i != 1) {
i3 = 1;
}
xq0 xq0Var = this.X;
if (xq0Var.l == z2 && xq0Var.m == i3) {
return;
}
this.A++;
xq0 xq0Var2 = new xq0(xq0Var.f10475a, xq0Var.b, xq0Var.c, xq0Var.d, xq0Var.e, xq0Var.f, xq0Var.g, xq0Var.h, xq0Var.i, xq0Var.j, xq0Var.k, z2, i3, xq0Var.n, xq0Var.p, xq0Var.q, xq0Var.r, xq0Var.o);
this.i.a(z2, i3);
a(xq0Var2, 0, i2, false, 5, -9223372036854775807L);
}
private void a(int i, int i2, Object obj) {
for (pv0 pv0Var : this.f) {
if (pv0Var.m() == i) {
int c2 = c();
ts tsVar = this.i;
new hr0(tsVar, pv0Var, this.X.f10475a, c2 == -1 ? 0 : c2, this.s, tsVar.d()).a(i2).a(obj).e();
}
}
}
}