184 lines
4.9 KiB
Java
184 lines
4.9 KiB
Java
package c.i.a.c;
|
|
|
|
import android.util.Log;
|
|
import c.i.a.c.f2.g;
|
|
import c.i.a.c.h2.m;
|
|
import c.i.a.c.i2.f0;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.google.android.exoplayer2.source.TrackGroupArray;
|
|
/* compiled from: DefaultLoadControl */
|
|
public class l0 implements u0 {
|
|
public final m a;
|
|
public final long b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final long f930c;
|
|
public final long d;
|
|
public final long e;
|
|
public final int f;
|
|
public final boolean g;
|
|
public final long h;
|
|
public final boolean i;
|
|
public int j;
|
|
public boolean k;
|
|
|
|
public l0(m mVar, int i, int i2, int i3, int i4, int i5, boolean z2, int i6, boolean z3) {
|
|
j(i3, 0, "bufferForPlaybackMs", "0");
|
|
j(i4, 0, "bufferForPlaybackAfterRebufferMs", "0");
|
|
j(i, i3, "minBufferMs", "bufferForPlaybackMs");
|
|
j(i, i4, "minBufferMs", "bufferForPlaybackAfterRebufferMs");
|
|
j(i2, i, "maxBufferMs", "minBufferMs");
|
|
j(i6, 0, "backBufferDurationMs", "0");
|
|
this.a = mVar;
|
|
this.b = h0.a((long) i);
|
|
this.f930c = h0.a((long) i2);
|
|
this.d = h0.a((long) i3);
|
|
this.e = h0.a((long) i4);
|
|
this.f = i5;
|
|
this.j = i5 == -1 ? 13107200 : i5;
|
|
this.g = z2;
|
|
this.h = h0.a((long) i6);
|
|
this.i = z3;
|
|
}
|
|
|
|
public static void j(int i, int i2, String str, String str2) {
|
|
boolean z2 = i >= i2;
|
|
AnimatableValueParser.n(z2, str + " cannot be less than " + str2);
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public boolean a() {
|
|
return this.i;
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public long b() {
|
|
return this.h;
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public void c() {
|
|
k(false);
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public void d(k1[] k1VarArr, TrackGroupArray trackGroupArray, g[] gVarArr) {
|
|
int i = this.f;
|
|
if (i == -1) {
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
while (true) {
|
|
int i4 = 13107200;
|
|
if (i2 >= k1VarArr.length) {
|
|
i = Math.max(13107200, i3);
|
|
break;
|
|
}
|
|
if (gVarArr[i2] != null) {
|
|
int x2 = k1VarArr[i2].x();
|
|
if (x2 == 0) {
|
|
i4 = 144310272;
|
|
} else if (x2 != 1) {
|
|
if (x2 == 2) {
|
|
i4 = 131072000;
|
|
} else if (x2 == 3 || x2 == 5 || x2 == 6) {
|
|
i4 = 131072;
|
|
} else if (x2 == 7) {
|
|
i4 = 0;
|
|
} else {
|
|
throw new IllegalArgumentException();
|
|
}
|
|
}
|
|
i3 += i4;
|
|
}
|
|
i2++;
|
|
}
|
|
}
|
|
this.j = i;
|
|
this.a.b(i);
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public void e() {
|
|
k(true);
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public boolean f(long j, float f, boolean z2, long j2) {
|
|
int i;
|
|
int i2 = f0.a;
|
|
if (f != 1.0f) {
|
|
j = Math.round(((double) j) / ((double) f));
|
|
}
|
|
long j3 = z2 ? this.e : this.d;
|
|
if (j2 != -9223372036854775807L) {
|
|
j3 = Math.min(j2 / 2, j3);
|
|
}
|
|
if (j3 > 0 && j < j3) {
|
|
if (!this.g) {
|
|
m mVar = this.a;
|
|
synchronized (mVar) {
|
|
i = mVar.e * mVar.b;
|
|
}
|
|
if (i >= this.j) {
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public boolean g(long j, long j2, float f) {
|
|
int i;
|
|
m mVar = this.a;
|
|
synchronized (mVar) {
|
|
i = mVar.e * mVar.b;
|
|
}
|
|
boolean z2 = true;
|
|
boolean z3 = i >= this.j;
|
|
long j3 = this.b;
|
|
if (f > 1.0f) {
|
|
j3 = Math.min(f0.p(j3, f), this.f930c);
|
|
}
|
|
if (j2 < Math.max(j3, 500000L)) {
|
|
if (!this.g && z3) {
|
|
z2 = false;
|
|
}
|
|
this.k = z2;
|
|
if (!z2 && j2 < 500000) {
|
|
Log.w("DefaultLoadControl", "Target buffer size reached with less than 500ms of buffered media data.");
|
|
}
|
|
} else if (j2 >= this.f930c || z3) {
|
|
this.k = false;
|
|
}
|
|
return this.k;
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public m h() {
|
|
return this.a;
|
|
}
|
|
|
|
@Override // c.i.a.c.u0
|
|
public void i() {
|
|
k(true);
|
|
}
|
|
|
|
public final void k(boolean z2) {
|
|
int i = this.f;
|
|
if (i == -1) {
|
|
i = 13107200;
|
|
}
|
|
this.j = i;
|
|
this.k = false;
|
|
if (z2) {
|
|
m mVar = this.a;
|
|
synchronized (mVar) {
|
|
if (mVar.a) {
|
|
mVar.b(0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|