package com.applovin.impl; import com.applovin.impl.i2; import com.mbridge.msdk.playercommon.exoplayer2.C; /* loaded from: classes.dex */ final class ap extends i2 { public ap(ho hoVar, long j, long j2, int i, int i2) { super(new i2.b(), new a(i, hoVar, i2), j, 0L, j + 1, 0L, j2, 188L, 940); } public static final class a implements i2.f { private final ho a; private final bh b = new bh(); private final int c; private final int d; public a(int i, ho hoVar, int i2) { this.c = i; this.a = hoVar; this.d = i2; } @Override // com.applovin.impl.i2.f public void a() { this.b.a(xp.f); } private i2.e a(bh bhVar, long j, long j2) { int a; int a2; int e = bhVar.e(); long j3 = -1; long j4 = -1; long j5 = -9223372036854775807L; while (bhVar.a() >= 188 && (a2 = (a = ep.a(bhVar.c(), bhVar.d(), e)) + 188) <= e) { long a3 = ep.a(bhVar, a, this.c); if (a3 != C.TIME_UNSET) { long b = this.a.b(a3); if (b > j) { if (j5 == C.TIME_UNSET) { return i2.e.a(b, j2); } return i2.e.a(j2 + j4); } if (100000 + b > j) { return i2.e.a(j2 + a); } j4 = a; j5 = b; } bhVar.f(a2); j3 = a2; } if (j5 != C.TIME_UNSET) { return i2.e.b(j5, j2 + j3); } return i2.e.d; } @Override // com.applovin.impl.i2.f public i2.e a(l8 l8Var, long j) { long f = l8Var.f(); int min = (int) Math.min(this.d, l8Var.a() - f); this.b.d(min); l8Var.c(this.b.c(), 0, min); return a(this.b, j, f); } } }