- 28,932 files - Full Java source code - Smali files - Resources Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
512 lines
14 KiB
Java
512 lines
14 KiB
Java
package com.applovin.impl;
|
|
|
|
import android.content.Context;
|
|
import android.media.MediaCrypto;
|
|
import android.media.MediaFormat;
|
|
import android.os.Handler;
|
|
import com.applovin.impl.f9;
|
|
import com.applovin.impl.hd;
|
|
import com.applovin.impl.q1;
|
|
import com.applovin.impl.qi;
|
|
import com.applovin.impl.r1;
|
|
import com.ironsource.mediationsdk.utils.IronSourceConstants;
|
|
import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes;
|
|
import com.unity3d.ads.core.domain.HandleInvocationsFromAdViewer;
|
|
import java.nio.ByteBuffer;
|
|
import java.util.ArrayList;
|
|
import java.util.Collections;
|
|
import java.util.List;
|
|
|
|
/* loaded from: classes.dex */
|
|
public class id extends ld implements gd {
|
|
private final Context J0;
|
|
private final q1.a K0;
|
|
private final r1 L0;
|
|
private int M0;
|
|
private boolean N0;
|
|
private f9 O0;
|
|
private long P0;
|
|
private boolean Q0;
|
|
private boolean R0;
|
|
private boolean S0;
|
|
private boolean T0;
|
|
private qi.a U0;
|
|
|
|
private static boolean c0() {
|
|
if (xp.a == 23) {
|
|
String str = xp.d;
|
|
if ("ZTE B2017G".equals(str) || "AXON 7 mini".equals(str)) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
private static boolean h(String str) {
|
|
if (xp.a < 24 && "OMX.SEC.aac.dec".equals(str) && "samsung".equals(xp.c)) {
|
|
String str2 = xp.b;
|
|
if (str2.startsWith("zeroflte") || str2.startsWith("herolte") || str2.startsWith("heroqlte")) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public void d0() {
|
|
this.R0 = true;
|
|
}
|
|
|
|
@Override // com.applovin.impl.qi, com.applovin.impl.ri
|
|
public String getName() {
|
|
return "MediaCodecAudioRenderer";
|
|
}
|
|
|
|
@Override // com.applovin.impl.e2, com.applovin.impl.qi
|
|
public gd l() {
|
|
return this;
|
|
}
|
|
|
|
public id(Context context, hd.b bVar, md mdVar, boolean z, Handler handler, q1 q1Var, r1 r1Var) {
|
|
super(1, bVar, mdVar, z, 44100.0f);
|
|
this.J0 = context.getApplicationContext();
|
|
this.L0 = r1Var;
|
|
this.K0 = new q1.a(handler, q1Var);
|
|
r1Var.a(new b());
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void g(String str) {
|
|
this.K0.a(str);
|
|
}
|
|
|
|
public id(Context context, md mdVar, boolean z, Handler handler, q1 q1Var, r1 r1Var) {
|
|
this(context, hd.b.a, mdVar, z, handler, q1Var, r1Var);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public q5 a(kd kdVar, f9 f9Var, f9 f9Var2) {
|
|
q5 a2 = kdVar.a(f9Var, f9Var2);
|
|
int i = a2.e;
|
|
if (a(kdVar, f9Var2) > this.M0) {
|
|
i |= 64;
|
|
}
|
|
int i2 = i;
|
|
return new q5(kdVar.a, f9Var, f9Var2, i2 != 0 ? 0 : a2.d, i2);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void x() {
|
|
super.x();
|
|
this.L0.j();
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void y() {
|
|
e0();
|
|
this.L0.pause();
|
|
super.y();
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void v() {
|
|
this.S0 = true;
|
|
try {
|
|
this.L0.b();
|
|
try {
|
|
super.v();
|
|
} finally {
|
|
}
|
|
} catch (Throwable th) {
|
|
try {
|
|
super.v();
|
|
throw th;
|
|
} finally {
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void w() {
|
|
try {
|
|
super.w();
|
|
} finally {
|
|
if (this.S0) {
|
|
this.S0 = false;
|
|
this.L0.reset();
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.qi
|
|
public boolean c() {
|
|
return super.c() && this.L0.c();
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.qi
|
|
public boolean d() {
|
|
return this.L0.g() || super.d();
|
|
}
|
|
|
|
@Override // com.applovin.impl.gd
|
|
public long p() {
|
|
if (b() == 2) {
|
|
e0();
|
|
}
|
|
return this.P0;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void Q() {
|
|
super.Q();
|
|
this.L0.i();
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void V() {
|
|
try {
|
|
this.L0.f();
|
|
} catch (r1.e e) {
|
|
throw a(e, e.c, e.b, IronSourceConstants.errorCode_isReadyException);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void b(p5 p5Var) {
|
|
if (!this.Q0 || p5Var.d()) {
|
|
return;
|
|
}
|
|
if (Math.abs(p5Var.f - this.P0) > 500000) {
|
|
this.P0 = p5Var.f;
|
|
}
|
|
this.Q0 = false;
|
|
}
|
|
|
|
private void e0() {
|
|
long a2 = this.L0.a(c());
|
|
if (a2 != Long.MIN_VALUE) {
|
|
if (!this.R0) {
|
|
a2 = Math.max(this.P0, a2);
|
|
}
|
|
this.P0 = a2;
|
|
this.R0 = false;
|
|
}
|
|
}
|
|
|
|
public final class b implements r1.c {
|
|
private b() {
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void b(long j) {
|
|
if (id.this.U0 != null) {
|
|
id.this.U0.a(j);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void a(Exception exc) {
|
|
pc.a("MediaCodecAudioRenderer", "Audio sink error", exc);
|
|
id.this.K0.b(exc);
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void b() {
|
|
id.this.d0();
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void a() {
|
|
if (id.this.U0 != null) {
|
|
id.this.U0.a();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void a(long j) {
|
|
id.this.K0.b(j);
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void a(boolean z) {
|
|
id.this.K0.b(z);
|
|
}
|
|
|
|
@Override // com.applovin.impl.r1.c
|
|
public void a(int i, long j, long j2) {
|
|
id.this.K0.b(i, j, j2);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public boolean c(f9 f9Var) {
|
|
return this.L0.a(f9Var);
|
|
}
|
|
|
|
private int a(kd kdVar, f9 f9Var) {
|
|
int i;
|
|
if (!"OMX.google.raw.decoder".equals(kdVar.a) || (i = xp.a) >= 24 || (i == 23 && xp.d(this.J0))) {
|
|
return f9Var.n;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
public int a(kd kdVar, f9 f9Var, f9[] f9VarArr) {
|
|
int a2 = a(kdVar, f9Var);
|
|
if (f9VarArr.length == 1) {
|
|
return a2;
|
|
}
|
|
for (f9 f9Var2 : f9VarArr) {
|
|
if (kdVar.a(f9Var, f9Var2).d != 0) {
|
|
a2 = Math.max(a2, a(kdVar, f9Var2));
|
|
}
|
|
}
|
|
return a2;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public float a(float f, f9 f9Var, f9[] f9VarArr) {
|
|
int i = -1;
|
|
for (f9 f9Var2 : f9VarArr) {
|
|
int i2 = f9Var2.A;
|
|
if (i2 != -1) {
|
|
i = Math.max(i, i2);
|
|
}
|
|
}
|
|
if (i == -1) {
|
|
return -1.0f;
|
|
}
|
|
return f * i;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public List a(md mdVar, f9 f9Var, boolean z) {
|
|
kd a2;
|
|
String str = f9Var.m;
|
|
if (str == null) {
|
|
return Collections.emptyList();
|
|
}
|
|
if (this.L0.a(f9Var) && (a2 = nd.a()) != null) {
|
|
return Collections.singletonList(a2);
|
|
}
|
|
List a3 = nd.a(mdVar.a(str, z, false), f9Var);
|
|
if (MimeTypes.AUDIO_E_AC3_JOC.equals(str)) {
|
|
ArrayList arrayList = new ArrayList(a3);
|
|
arrayList.addAll(mdVar.a(MimeTypes.AUDIO_E_AC3, z, false));
|
|
a3 = arrayList;
|
|
}
|
|
return Collections.unmodifiableList(a3);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public hd.a a(kd kdVar, f9 f9Var, MediaCrypto mediaCrypto, float f) {
|
|
this.M0 = a(kdVar, f9Var, t());
|
|
this.N0 = h(kdVar.a);
|
|
MediaFormat a2 = a(f9Var, kdVar.c, this.M0, f);
|
|
this.O0 = (!MimeTypes.AUDIO_RAW.equals(kdVar.b) || MimeTypes.AUDIO_RAW.equals(f9Var.m)) ? null : f9Var;
|
|
return hd.a.a(kdVar, a2, f9Var, mediaCrypto);
|
|
}
|
|
|
|
@Override // com.applovin.impl.gd
|
|
public ph a() {
|
|
return this.L0.a();
|
|
}
|
|
|
|
@Override // com.applovin.impl.e2, com.applovin.impl.rh.b
|
|
public void a(int i, Object obj) {
|
|
if (i == 2) {
|
|
this.L0.a(((Float) obj).floatValue());
|
|
return;
|
|
}
|
|
if (i == 3) {
|
|
this.L0.a((l1) obj);
|
|
return;
|
|
}
|
|
if (i != 6) {
|
|
switch (i) {
|
|
case 9:
|
|
this.L0.b(((Boolean) obj).booleanValue());
|
|
break;
|
|
case 10:
|
|
this.L0.a(((Integer) obj).intValue());
|
|
break;
|
|
case 11:
|
|
this.U0 = (qi.a) obj;
|
|
break;
|
|
default:
|
|
super.a(i, obj);
|
|
break;
|
|
}
|
|
return;
|
|
}
|
|
this.L0.a((v1) obj);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void a(Exception exc) {
|
|
pc.a("MediaCodecAudioRenderer", "Audio codec error", exc);
|
|
this.K0.a(exc);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void a(String str, long j, long j2) {
|
|
this.K0.a(str, j, j2);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void a(boolean z, boolean z2) {
|
|
super.a(z, z2);
|
|
this.K0.b(this.E0);
|
|
if (q().a) {
|
|
this.L0.e();
|
|
} else {
|
|
this.L0.d();
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public q5 a(g9 g9Var) {
|
|
q5 a2 = super.a(g9Var);
|
|
this.K0.a(g9Var.b, a2);
|
|
return a2;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public void a(f9 f9Var, MediaFormat mediaFormat) {
|
|
int i;
|
|
int i2;
|
|
f9 f9Var2 = this.O0;
|
|
int[] iArr = null;
|
|
if (f9Var2 != null) {
|
|
f9Var = f9Var2;
|
|
} else if (I() != null) {
|
|
if (MimeTypes.AUDIO_RAW.equals(f9Var.m)) {
|
|
i = f9Var.B;
|
|
} else if (xp.a >= 24 && mediaFormat.containsKey("pcm-encoding")) {
|
|
i = mediaFormat.getInteger("pcm-encoding");
|
|
} else if (mediaFormat.containsKey("v-bits-per-sample")) {
|
|
i = xp.d(mediaFormat.getInteger("v-bits-per-sample"));
|
|
} else {
|
|
i = MimeTypes.AUDIO_RAW.equals(f9Var.m) ? f9Var.B : 2;
|
|
}
|
|
f9 a2 = new f9.b().f(MimeTypes.AUDIO_RAW).j(i).e(f9Var.C).f(f9Var.D).c(mediaFormat.getInteger("channel-count")).n(mediaFormat.getInteger("sample-rate")).a();
|
|
if (this.N0 && a2.z == 6 && (i2 = f9Var.z) < 6) {
|
|
iArr = new int[i2];
|
|
for (int i3 = 0; i3 < f9Var.z; i3++) {
|
|
iArr[i3] = i3;
|
|
}
|
|
}
|
|
f9Var = a2;
|
|
}
|
|
try {
|
|
this.L0.a(f9Var, 0, iArr);
|
|
} catch (r1.a e) {
|
|
throw a(e, e.a, IronSourceConstants.errorCode_biddingDataException);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld, com.applovin.impl.e2
|
|
public void a(long j, boolean z) {
|
|
super.a(j, z);
|
|
if (this.T0) {
|
|
this.L0.h();
|
|
} else {
|
|
this.L0.b();
|
|
}
|
|
this.P0 = j;
|
|
this.Q0 = true;
|
|
this.R0 = true;
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public boolean a(long j, long j2, hd hdVar, ByteBuffer byteBuffer, int i, int i2, int i3, long j3, boolean z, boolean z2, f9 f9Var) {
|
|
b1.a(byteBuffer);
|
|
if (this.O0 != null && (i2 & 2) != 0) {
|
|
((hd) b1.a(hdVar)).a(i, false);
|
|
return true;
|
|
}
|
|
if (z) {
|
|
if (hdVar != null) {
|
|
hdVar.a(i, false);
|
|
}
|
|
this.E0.f += i3;
|
|
this.L0.i();
|
|
return true;
|
|
}
|
|
try {
|
|
if (!this.L0.a(byteBuffer, j3, i3)) {
|
|
return false;
|
|
}
|
|
if (hdVar != null) {
|
|
hdVar.a(i, false);
|
|
}
|
|
this.E0.e += i3;
|
|
return true;
|
|
} catch (r1.b e) {
|
|
throw a(e, e.c, e.b, IronSourceConstants.errorCode_biddingDataException);
|
|
} catch (r1.e e2) {
|
|
throw a(e2, f9Var, e2.b, IronSourceConstants.errorCode_isReadyException);
|
|
}
|
|
}
|
|
|
|
@Override // com.applovin.impl.gd
|
|
public void a(ph phVar) {
|
|
this.L0.a(phVar);
|
|
}
|
|
|
|
@Override // com.applovin.impl.ld
|
|
public int a(md mdVar, f9 f9Var) {
|
|
if (!Cif.g(f9Var.m)) {
|
|
return ri.a(0);
|
|
}
|
|
int i = xp.a >= 21 ? 32 : 0;
|
|
boolean z = f9Var.F != 0;
|
|
boolean d = ld.d(f9Var);
|
|
int i2 = 8;
|
|
if (d && this.L0.a(f9Var) && (!z || nd.a() != null)) {
|
|
return ri.a(4, 8, i);
|
|
}
|
|
if (MimeTypes.AUDIO_RAW.equals(f9Var.m) && !this.L0.a(f9Var)) {
|
|
return ri.a(1);
|
|
}
|
|
if (!this.L0.a(xp.b(2, f9Var.z, f9Var.A))) {
|
|
return ri.a(1);
|
|
}
|
|
List a2 = a(mdVar, f9Var, false);
|
|
if (a2.isEmpty()) {
|
|
return ri.a(1);
|
|
}
|
|
if (!d) {
|
|
return ri.a(2);
|
|
}
|
|
kd kdVar = (kd) a2.get(0);
|
|
boolean b2 = kdVar.b(f9Var);
|
|
if (b2 && kdVar.c(f9Var)) {
|
|
i2 = 16;
|
|
}
|
|
return ri.a(b2 ? 4 : 3, i2, i);
|
|
}
|
|
|
|
public MediaFormat a(f9 f9Var, String str, int i, float f) {
|
|
MediaFormat mediaFormat = new MediaFormat();
|
|
mediaFormat.setString("mime", str);
|
|
mediaFormat.setInteger("channel-count", f9Var.z);
|
|
mediaFormat.setInteger("sample-rate", f9Var.A);
|
|
sd.a(mediaFormat, f9Var.o);
|
|
sd.a(mediaFormat, "max-input-size", i);
|
|
int i2 = xp.a;
|
|
if (i2 >= 23) {
|
|
mediaFormat.setInteger(HandleInvocationsFromAdViewer.KEY_DOWNLOAD_PRIORITY, 0);
|
|
if (f != -1.0f && !c0()) {
|
|
mediaFormat.setFloat("operating-rate", f);
|
|
}
|
|
}
|
|
if (i2 <= 28 && "audio/ac4".equals(f9Var.m)) {
|
|
mediaFormat.setInteger("ac4-is-sync", 1);
|
|
}
|
|
if (i2 >= 24 && this.L0.b(xp.b(4, f9Var.z, f9Var.A)) == 2) {
|
|
mediaFormat.setInteger("pcm-encoding", 4);
|
|
}
|
|
return mediaFormat;
|
|
}
|
|
}
|