package com.fyber.inneractive.sdk.player.exoplayer2; import android.annotation.SuppressLint; import android.os.Looper; import com.fyber.inneractive.sdk.player.exoplayer2.e; import com.fyber.inneractive.sdk.player.exoplayer2.h; import com.fyber.inneractive.sdk.player.exoplayer2.q; import com.fyber.inneractive.sdk.player.exoplayer2.source.u; import com.fyber.inneractive.sdk.player.exoplayer2.util.s; import com.ironsource.v8; import com.mbridge.msdk.playercommon.exoplayer2.C; import java.util.Iterator; import java.util.concurrent.CopyOnWriteArraySet; /* loaded from: classes2.dex */ public final class g implements e { public final o[] a; public final com.fyber.inneractive.sdk.player.exoplayer2.trackselection.g b; public final com.fyber.inneractive.sdk.player.exoplayer2.trackselection.f c; public final f d; public final h e; public final CopyOnWriteArraySet f; public final q.c g; public final q.b h; public boolean i; public boolean j; public int k; public int l; public int m; public q n; public Object o; public com.fyber.inneractive.sdk.player.exoplayer2.trackselection.f p; public n q; public h.b r; public int s; public long t; @SuppressLint({"HandlerLeak"}) public g(o[] oVarArr, com.fyber.inneractive.sdk.player.exoplayer2.trackselection.b bVar, c cVar) { StringBuilder sb = new StringBuilder("Init ExoPlayerLib/2.4.4 ["); sb.append(s.e); sb.append(v8.i.e); com.fyber.inneractive.sdk.player.exoplayer2.util.a.b(oVarArr.length > 0); this.a = (o[]) com.fyber.inneractive.sdk.player.exoplayer2.util.a.a(oVarArr); this.b = (com.fyber.inneractive.sdk.player.exoplayer2.trackselection.g) com.fyber.inneractive.sdk.player.exoplayer2.util.a.a(bVar); this.j = false; this.k = 1; this.f = new CopyOnWriteArraySet<>(); com.fyber.inneractive.sdk.player.exoplayer2.trackselection.f fVar = new com.fyber.inneractive.sdk.player.exoplayer2.trackselection.f(new com.fyber.inneractive.sdk.player.exoplayer2.trackselection.e[oVarArr.length]); this.c = fVar; this.n = q.a; this.g = new q.c(); this.h = new q.b(); u uVar = u.d; this.p = fVar; this.q = n.d; f fVar2 = new f(this, Looper.myLooper() != null ? Looper.myLooper() : Looper.getMainLooper()); this.d = fVar2; h.b bVar2 = new h.b(0, 0L); this.r = bVar2; this.e = new h(oVarArr, bVar, cVar, this.j, fVar2, bVar2, this); } public final void a(boolean z) { if (this.j != z) { this.j = z; this.e.f.obtainMessage(1, z ? 1 : 0, 0).sendToTarget(); Iterator it = this.f.iterator(); while (it.hasNext()) { it.next().a(this.k, z); } } } public final void a(int i, long j) { if (i >= 0 && (this.n.c() || i < this.n.b())) { this.l++; this.s = i; boolean c = this.n.c(); long j2 = C.TIME_UNSET; if (!c) { this.n.a(i, this.g, 0L); long j3 = j == C.TIME_UNSET ? this.g.e : j; q.c cVar = this.g; int i2 = cVar.c; long j4 = cVar.g; int i3 = b.a; long j5 = (j3 == C.TIME_UNSET ? -9223372036854775807L : j3 * 1000) + j4; long j6 = this.n.a(i2, this.h, false).d; while (j6 != C.TIME_UNSET && j5 >= j6 && i2 < this.g.d) { j5 -= j6; i2++; j6 = this.n.a(i2, this.h, false).d; } } if (j == C.TIME_UNSET) { this.t = 0L; this.e.f.obtainMessage(3, new h.c(this.n, i, C.TIME_UNSET)).sendToTarget(); return; } this.t = j; h hVar = this.e; q qVar = this.n; int i4 = b.a; if (j != C.TIME_UNSET) { j2 = j * 1000; } hVar.f.obtainMessage(3, new h.c(qVar, i, j2)).sendToTarget(); Iterator it = this.f.iterator(); while (it.hasNext()) { it.next().c(); } return; } throw new l(); } }