package com.applovin.impl; import android.media.MediaCodec; import android.media.MediaCrypto; import android.media.MediaCryptoException; import android.media.MediaFormat; import android.os.Bundle; import android.os.SystemClock; import com.applovin.exoplayer2.common.base.Ascii; import com.applovin.impl.g1; import com.applovin.impl.hd; import com.applovin.impl.nd; import com.applovin.impl.p5; import com.applovin.impl.z6; import com.facebook.ads.AdError; import com.ironsource.mediationsdk.utils.IronSourceConstants; import com.mbridge.msdk.playercommon.exoplayer2.C; import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes; import csdk.gluads.Consts; import java.nio.ByteBuffer; import java.nio.ByteOrder; import java.util.ArrayDeque; import java.util.ArrayList; import java.util.List; import java.util.UUID; /* loaded from: classes.dex */ public abstract class ld extends e2 { private static final byte[] I0 = {0, 0, 1, 103, 66, -64, Ascii.VT, -38, 37, -112, 0, 0, 1, 104, -50, Ascii.SI, 19, 32, 0, 0, 1, 101, -120, -124, Ascii.CR, -50, 113, Ascii.CAN, -96, 0, 47, -65, Ascii.FS, 49, -61, 39, 93, 120}; private final long[] A; private boolean A0; private f9 B; private boolean B0; private f9 C; private boolean C0; private z6 D; private a8 D0; private z6 E; protected n5 E0; private MediaCrypto F; private long F0; private boolean G; private long G0; private long H; private int H0; private float I; private float J; private hd K; private f9 L; private MediaFormat M; private boolean N; private float O; private ArrayDeque P; private a Q; private kd R; private int S; private boolean T; private boolean U; private boolean V; private boolean W; private boolean X; private boolean Y; private boolean Z; private boolean a0; private boolean b0; private boolean c0; private s2 d0; private long e0; private int f0; private int g0; private ByteBuffer h0; private boolean i0; private boolean j0; private boolean k0; private boolean l0; private boolean m0; private final hd.b n; private boolean n0; private final md o; private int o0; private final boolean p; private int p0; private final float q; private int q0; private final p5 r; private boolean r0; private final p5 s; private boolean s0; private final p5 t; private boolean t0; private final g2 u; private long u0; private final eo v; private long v0; private final ArrayList w; private boolean w0; private final MediaCodec.BufferInfo x; private boolean x0; private final long[] y; private boolean y0; private final long[] z; private boolean z0; private boolean B() { if (this.r0) { this.p0 = 1; if (this.U || this.W) { this.q0 = 3; return false; } this.q0 = 1; } return true; } private boolean O() { return this.g0 >= 0; } private void Z() { this.g0 = -1; this.h0 = null; } public final hd I() { return this.K; } public final kd J() { return this.R; } public boolean K() { return false; } public final MediaFormat L() { return this.M; } public final long M() { return this.G0; } public float N() { return this.I; } public void Q() { } public void V() { } public abstract float a(float f, f9 f9Var, f9[] f9VarArr); public abstract int a(md mdVar, f9 f9Var); public abstract hd.a a(kd kdVar, f9 f9Var, MediaCrypto mediaCrypto, float f); public abstract q5 a(kd kdVar, f9 f9Var, f9 f9Var2); public abstract List a(md mdVar, f9 f9Var, boolean z); public final void a(a8 a8Var) { this.D0 = a8Var; } public abstract void a(f9 f9Var, MediaFormat mediaFormat); public void a(p5 p5Var) { } public abstract void a(Exception exc); public abstract void a(String str, long j, long j2); public void a(boolean z) { this.A0 = z; } public abstract boolean a(long j, long j2, hd hdVar, ByteBuffer byteBuffer, int i, int i2, int i3, long j3, boolean z, boolean z2, f9 f9Var); public final void a0() { this.z0 = true; } public abstract void b(p5 p5Var); public void b(boolean z) { this.B0 = z; } public boolean b(kd kdVar) { return true; } public void c(boolean z) { this.C0 = z; } @Override // com.applovin.impl.qi public boolean c() { return this.x0; } public boolean c(f9 f9Var) { return false; } public abstract void g(String str); @Override // com.applovin.impl.e2, com.applovin.impl.ri public final int m() { return 8; } @Override // com.applovin.impl.e2 public void x() { } @Override // com.applovin.impl.e2 public void y() { } public static class a extends Exception { public final String a; public final boolean b; public final kd c; public final String d; public final a f; public a(f9 f9Var, Throwable th, boolean z, int i) { this("Decoder init failed: [" + i + "], " + f9Var, th, f9Var.m, z, null, a(i), null); } public a(f9 f9Var, Throwable th, boolean z, kd kdVar) { this("Decoder init failed: " + kdVar.a + ", " + f9Var, th, f9Var.m, z, kdVar, xp.a >= 21 ? a(th) : null, null); } private static String a(int i) { return "com.applovin.exoplayer2.mediacodec.MediaCodecRenderer_" + (i < 0 ? "neg_" : "") + Math.abs(i); } private a(String str, Throwable th, String str2, boolean z, kd kdVar, String str3, a aVar) { super(str, th); this.a = str2; this.b = z; this.c = kdVar; this.d = str3; this.f = aVar; } private static String a(Throwable th) { if (th instanceof MediaCodec.CodecException) { return ((MediaCodec.CodecException) th).getDiagnosticInfo(); } return null; } /* JADX INFO: Access modifiers changed from: private */ public a a(a aVar) { return new a(getMessage(), getCause(), this.a, this.b, this.c, this.d, aVar); } } public ld(int i, hd.b bVar, md mdVar, boolean z, float f) { super(i); this.n = bVar; this.o = (md) b1.a(mdVar); this.p = z; this.q = f; this.r = p5.i(); this.s = new p5(0); this.t = new p5(2); g2 g2Var = new g2(); this.u = g2Var; this.v = new eo(); this.w = new ArrayList(); this.x = new MediaCodec.BufferInfo(); this.I = 1.0f; this.J = 1.0f; this.H = C.TIME_UNSET; this.y = new long[10]; this.z = new long[10]; this.A = new long[10]; this.F0 = C.TIME_UNSET; this.G0 = C.TIME_UNSET; g2Var.g(0); g2Var.c.order(ByteOrder.nativeOrder()); this.O = -1.0f; this.S = 0; this.o0 = 0; this.f0 = -1; this.g0 = -1; this.e0 = C.TIME_UNSET; this.u0 = C.TIME_UNSET; this.v0 = C.TIME_UNSET; this.p0 = 0; this.q0 = 0; } public final void P() { f9 f9Var; if (this.K != null || this.k0 || (f9Var = this.B) == null) { return; } if (this.E == null && c(f9Var)) { b(this.B); return; } b(this.E); String str = this.B.m; z6 z6Var = this.D; if (z6Var != null) { if (this.F == null) { l9 a2 = a(z6Var); if (a2 == null) { if (this.D.getError() == null) { return; } } else { try { MediaCrypto mediaCrypto = new MediaCrypto(a2.a, a2.b); this.F = mediaCrypto; this.G = !a2.c && mediaCrypto.requiresSecureDecoderComponent(str); } catch (MediaCryptoException e) { throw a(e, this.B, 6006); } } } if (l9.d) { int b = this.D.b(); if (b == 1) { z6.a aVar = (z6.a) b1.a(this.D.getError()); throw a(aVar, this.B, aVar.a); } if (b != 4) { return; } } } try { a(this.F, this.G); } catch (a e2) { throw a(e2, this.B, IronSourceConstants.NT_LOAD); } } public final void f(long j) { f9 f9Var = (f9) this.v.c(j); if (f9Var == null && this.N) { f9Var = (f9) this.v.c(); } if (f9Var != null) { this.C = f9Var; } else if (!this.N || this.C == null) { return; } a(this.C, this.M); this.N = false; } private static boolean f(String str) { return xp.a == 29 && "c2.android.aac.decoder".equals(str); } @Override // com.applovin.impl.e2 public void v() { this.B = null; this.F0 = C.TIME_UNSET; this.G0 = C.TIME_UNSET; this.H0 = 0; H(); } @Override // com.applovin.impl.e2 public void w() { try { A(); U(); } finally { c((z6) null); } } private void A() { this.m0 = false; this.u.b(); this.t.b(); this.l0 = false; this.k0 = false; } /* JADX WARN: Multi-variable type inference failed */ public void U() { try { hd hdVar = this.K; if (hdVar != null) { hdVar.a(); this.E0.b++; g(this.R.a); } this.K = null; try { MediaCrypto mediaCrypto = this.F; if (mediaCrypto != null) { mediaCrypto.release(); } } finally { } } catch (Throwable th) { this.K = null; try { MediaCrypto mediaCrypto2 = this.F; if (mediaCrypto2 != null) { mediaCrypto2.release(); } throw th; } finally { } } } public final boolean G() { boolean H = H(); if (H) { P(); } return H; } public boolean H() { if (this.K == null) { return false; } if (this.q0 != 3 && !this.U && ((!this.V || this.t0) && (!this.W || !this.s0))) { F(); return false; } U(); return true; } private void F() { try { this.K.b(); } finally { W(); } } public void W() { Y(); Z(); this.e0 = C.TIME_UNSET; this.s0 = false; this.r0 = false; this.a0 = false; this.b0 = false; this.i0 = false; this.j0 = false; this.w.clear(); this.u0 = C.TIME_UNSET; this.v0 = C.TIME_UNSET; s2 s2Var = this.d0; if (s2Var != null) { s2Var.a(); } this.p0 = 0; this.q0 = 0; this.o0 = this.n0 ? 1 : 0; } public void X() { W(); this.D0 = null; this.d0 = null; this.P = null; this.R = null; this.L = null; this.M = null; this.N = false; this.t0 = false; this.O = -1.0f; this.S = 0; this.T = false; this.U = false; this.V = false; this.W = false; this.X = false; this.Y = false; this.Z = false; this.c0 = false; this.n0 = false; this.o0 = 0; this.G = false; } private boolean e(int i) { g9 r = r(); this.r.b(); int a2 = a(r, this.r, i | 4); if (a2 == -5) { a(r); return true; } if (a2 != -4 || !this.r.e()) { return false; } this.w0 = true; R(); return false; } private List d(boolean z) { List a2 = a(this.o, this.B, z); if (a2.isEmpty() && z) { a2 = a(this.o, this.B, false); if (!a2.isEmpty()) { pc.d("MediaCodecRenderer", "Drm session requires secure decoder for " + this.B.m + ", but no secure decoder available. Trying to proceed with " + a2 + Consts.STRING_PERIOD); } } return a2; } private void Y() { this.f0 = -1; this.s.c = null; } private boolean E() { hd hdVar = this.K; if (hdVar == null || this.p0 == 2 || this.w0) { return false; } if (this.f0 < 0) { int d = hdVar.d(); this.f0 = d; if (d < 0) { return false; } this.s.c = this.K.a(d); this.s.b(); } if (this.p0 == 1) { if (!this.c0) { this.s0 = true; this.K.a(this.f0, 0, 0, 0L, 4); Y(); } this.p0 = 2; return false; } if (this.a0) { this.a0 = false; ByteBuffer byteBuffer = this.s.c; byte[] bArr = I0; byteBuffer.put(bArr); this.K.a(this.f0, 0, bArr.length, 0L, 0); Y(); this.r0 = true; return true; } if (this.o0 == 1) { for (int i = 0; i < this.L.o.size(); i++) { this.s.c.put((byte[]) this.L.o.get(i)); } this.o0 = 2; } int position = this.s.c.position(); g9 r = r(); try { int a2 = a(r, this.s, 0); if (j()) { this.v0 = this.u0; } if (a2 == -3) { return false; } if (a2 == -5) { if (this.o0 == 2) { this.s.b(); this.o0 = 1; } a(r); return true; } if (this.s.e()) { if (this.o0 == 2) { this.s.b(); this.o0 = 1; } this.w0 = true; if (!this.r0) { R(); return false; } try { if (!this.c0) { this.s0 = true; this.K.a(this.f0, 0, 0, 0L, 4); Y(); } return false; } catch (MediaCodec.CryptoException e) { throw a(e, this.B, t2.a(e.getErrorCode())); } } if (!this.r0 && !this.s.f()) { this.s.b(); if (this.o0 == 2) { this.o0 = 1; } return true; } boolean h = this.s.h(); if (h) { this.s.b.a(position); } if (this.T && !h) { zf.a(this.s.c); if (this.s.c.position() == 0) { return true; } this.T = false; } p5 p5Var = this.s; long j = p5Var.f; s2 s2Var = this.d0; if (s2Var != null) { j = s2Var.a(this.B, p5Var); this.u0 = Math.max(this.u0, this.d0.a(this.B)); } long j2 = j; if (this.s.d()) { this.w.add(Long.valueOf(j2)); } if (this.y0) { this.v.a(j2, this.B); this.y0 = false; } this.u0 = Math.max(this.u0, j2); this.s.g(); if (this.s.c()) { a(this.s); } b(this.s); try { if (h) { this.K.a(this.f0, 0, this.s.b, j2, 0); } else { this.K.a(this.f0, 0, this.s.c.limit(), j2, 0); } Y(); this.r0 = true; this.o0 = 0; this.E0.c++; return true; } catch (MediaCodec.CryptoException e2) { throw a(e2, this.B, t2.a(e2.getErrorCode())); } } catch (p5.a e3) { a(e3); e(0); F(); return true; } } private boolean D() { if (this.r0) { this.p0 = 1; if (this.U || this.W) { this.q0 = 3; return false; } this.q0 = 2; } else { b0(); } return true; } private void C() { if (!this.r0) { T(); } else { this.p0 = 1; this.q0 = 3; } } private boolean c(long j, long j2) { boolean z; boolean a2; hd hdVar; ByteBuffer byteBuffer; int i; MediaCodec.BufferInfo bufferInfo; int a3; if (!O()) { if (this.X && this.s0) { try { a3 = this.K.a(this.x); } catch (IllegalStateException unused) { R(); if (this.x0) { U(); } return false; } } else { a3 = this.K.a(this.x); } if (a3 < 0) { if (a3 == -2) { S(); return true; } if (this.c0 && (this.w0 || this.p0 == 2)) { R(); } return false; } if (this.b0) { this.b0 = false; this.K.a(a3, false); return true; } MediaCodec.BufferInfo bufferInfo2 = this.x; if (bufferInfo2.size == 0 && (bufferInfo2.flags & 4) != 0) { R(); return false; } this.g0 = a3; ByteBuffer b = this.K.b(a3); this.h0 = b; if (b != null) { b.position(this.x.offset); ByteBuffer byteBuffer2 = this.h0; MediaCodec.BufferInfo bufferInfo3 = this.x; byteBuffer2.limit(bufferInfo3.offset + bufferInfo3.size); } if (this.Y) { MediaCodec.BufferInfo bufferInfo4 = this.x; if (bufferInfo4.presentationTimeUs == 0 && (bufferInfo4.flags & 4) != 0) { long j3 = this.u0; if (j3 != C.TIME_UNSET) { bufferInfo4.presentationTimeUs = j3; } } } this.i0 = c(this.x.presentationTimeUs); long j4 = this.v0; long j5 = this.x.presentationTimeUs; this.j0 = j4 == j5; f(j5); } if (this.X && this.s0) { try { hdVar = this.K; byteBuffer = this.h0; i = this.g0; bufferInfo = this.x; z = false; } catch (IllegalStateException unused2) { z = false; } try { a2 = a(j, j2, hdVar, byteBuffer, i, bufferInfo.flags, 1, bufferInfo.presentationTimeUs, this.i0, this.j0, this.C); } catch (IllegalStateException unused3) { R(); if (this.x0) { U(); } return z; } } else { z = false; hd hdVar2 = this.K; ByteBuffer byteBuffer3 = this.h0; int i2 = this.g0; MediaCodec.BufferInfo bufferInfo5 = this.x; a2 = a(j, j2, hdVar2, byteBuffer3, i2, bufferInfo5.flags, 1, bufferInfo5.presentationTimeUs, this.i0, this.j0, this.C); } if (a2) { d(this.x.presentationTimeUs); boolean z2 = (this.x.flags & 4) != 0 ? true : z; Z(); if (!z2) { return true; } R(); } return z; } private void S() { this.t0 = true; MediaFormat e = this.K.e(); if (this.S != 0 && e.getInteger("width") == 32 && e.getInteger("height") == 32) { this.b0 = true; return; } if (this.Z) { e.setInteger("channel-count", 1); } this.M = e; this.N = true; } private void R() { int i = this.q0; if (i == 1) { F(); return; } if (i == 2) { F(); b0(); } else if (i != 3) { this.x0 = true; V(); } else { T(); } } private void T() { U(); P(); } private void b0() { try { this.F.setMediaDrmSession(a(this.E).b); b(this.E); this.p0 = 0; this.q0 = 0; } catch (MediaCryptoException e) { throw a(e, this.B, 6006); } } private boolean e(long j) { return this.H == C.TIME_UNSET || SystemClock.elapsedRealtime() - j < this.H; } private boolean e(f9 f9Var) { if (xp.a >= 23 && this.K != null && this.q0 != 3 && b() != 0) { float a2 = a(this.J, f9Var, t()); float f = this.O; if (f == a2) { return true; } if (a2 == -1.0f) { C(); return false; } if (f == -1.0f && a2 <= this.q) { return true; } Bundle bundle = new Bundle(); bundle.putFloat("operating-rate", a2); this.K.a(bundle); this.O = a2; } return true; } private static boolean e(String str) { int i = xp.a; return i < 18 || (i == 18 && ("OMX.SEC.avc.dec".equals(str) || "OMX.SEC.avc.dec.secure".equals(str))) || (i == 19 && xp.d.startsWith("SM-G800") && ("OMX.Exynos.avc.dec".equals(str) || "OMX.Exynos.avc.dec.secure".equals(str))); } private boolean b(long j, long j2) { boolean z; b1.b(!this.x0); if (this.u.m()) { g2 g2Var = this.u; if (!a(j, j2, null, g2Var.c, this.g0, 0, g2Var.l(), this.u.j(), this.u.d(), this.u.e(), this.C)) { return false; } d(this.u.k()); this.u.b(); z = false; } else { z = false; } if (this.w0) { this.x0 = true; return z; } if (this.l0) { b1.b(this.u.a(this.t)); this.l0 = z; } if (this.m0) { if (this.u.m()) { return true; } A(); this.m0 = z; P(); if (!this.k0) { return z; } } z(); if (this.u.m()) { this.u.g(); } if (this.u.m() || this.w0 || this.m0) { return true; } return z; } private void z() { b1.b(!this.w0); g9 r = r(); this.t.b(); do { this.t.b(); int a2 = a(r, this.t, 0); if (a2 == -5) { a(r); return; } if (a2 != -4) { if (a2 != -3) { throw new IllegalStateException(); } return; } else { if (this.t.e()) { this.w0 = true; return; } if (this.y0) { f9 f9Var = (f9) b1.a(this.B); this.C = f9Var; a(f9Var, (MediaFormat) null); this.y0 = false; } this.t.g(); } } while (this.u.a(this.t)); this.l0 = true; } private static boolean a(kd kdVar) { String str = kdVar.a; int i = xp.a; return (i <= 25 && "OMX.rk.video_decoder.avc".equals(str)) || (i <= 17 && "OMX.allwinner.video.decoder.avc".equals(str)) || ((i <= 29 && ("OMX.broadcom.video_decoder.tunnel".equals(str) || "OMX.broadcom.video_decoder.tunnel.secure".equals(str))) || ("Amazon".equals(xp.c) && "AFTS".equals(xp.d) && kdVar.g)); } @Override // com.applovin.impl.qi public boolean d() { return this.B != null && (u() || O() || (this.e0 != C.TIME_UNSET && SystemClock.elapsedRealtime() < this.e0)); } private void b(f9 f9Var) { A(); String str = f9Var.m; if (!MimeTypes.AUDIO_AAC.equals(str) && !MimeTypes.AUDIO_MPEG.equals(str) && !MimeTypes.AUDIO_OPUS.equals(str)) { this.u.i(1); } else { this.u.i(32); } this.k0 = true; } public void d(long j) { while (true) { int i = this.H0; if (i == 0 || j < this.A[0]) { return; } long[] jArr = this.y; this.F0 = jArr[0]; this.G0 = this.z[0]; int i2 = i - 1; this.H0 = i2; System.arraycopy(jArr, 1, jArr, 0, i2); long[] jArr2 = this.z; System.arraycopy(jArr2, 1, jArr2, 0, this.H0); long[] jArr3 = this.A; System.arraycopy(jArr3, 1, jArr3, 0, this.H0); Q(); } } private boolean a(kd kdVar, f9 f9Var, z6 z6Var, z6 z6Var2) { l9 a2; if (z6Var == z6Var2) { return false; } if (z6Var2 == null || z6Var == null || xp.a < 23) { return true; } UUID uuid = t2.e; if (uuid.equals(z6Var.e()) || uuid.equals(z6Var2.e()) || (a2 = a(z6Var2)) == null) { return true; } return !kdVar.g && (a2.c ? false : z6Var2.a(f9Var.m)); } private boolean c(long j) { int size = this.w.size(); for (int i = 0; i < size; i++) { if (((Long) this.w.get(i)).longValue() == j) { this.w.remove(i); return true; } } return false; } private static boolean b(IllegalStateException illegalStateException) { return illegalStateException instanceof MediaCodec.CodecException; } public static boolean d(f9 f9Var) { int i = f9Var.F; return i == 0 || i == 2; } private static boolean d(String str) { return xp.a == 21 && "OMX.google.aac.decoder".equals(str); } private l9 a(z6 z6Var) { z4 f = z6Var.f(); if (f != null && !(f instanceof l9)) { throw a(new IllegalArgumentException("Expecting FrameworkCryptoConfig but found: " + f), this.B, AdError.MEDIAVIEW_MISSING_ERROR_CODE); } return (l9) f; } private void b(z6 z6Var) { z6.a(this.D, z6Var); this.D = z6Var; } private static boolean b(String str) { if (xp.a < 21 && "OMX.SEC.mp3.dec".equals(str) && "samsung".equals(xp.c)) { String str2 = xp.b; if (str2.startsWith("baffin") || str2.startsWith("grand") || str2.startsWith("fortuna") || str2.startsWith("gprimelte") || str2.startsWith("j2y18lte") || str2.startsWith("ms01")) { return true; } } return false; } private static boolean b(String str, f9 f9Var) { return xp.a <= 18 && f9Var.z == 1 && "OMX.MTK.AUDIO.DECODER.MP3".equals(str); } private void a(kd kdVar, MediaCrypto mediaCrypto) { hd a2; String str = kdVar.a; int i = xp.a; float a3 = i < 23 ? -1.0f : a(this.J, this.B, t()); float f = a3 > this.q ? a3 : -1.0f; long elapsedRealtime = SystemClock.elapsedRealtime(); ko.a("createCodec:" + str); hd.a a4 = a(kdVar, this.B, mediaCrypto, f); if (this.A0 && i >= 23) { a2 = new g1.b(e(), this.B0, this.C0).a(a4); } else { a2 = this.n.a(a4); } long elapsedRealtime2 = SystemClock.elapsedRealtime(); this.K = a2; this.R = kdVar; this.O = f; this.L = this.B; this.S = a(str); this.T = a(str, this.L); this.U = e(str); this.V = f(str); this.W = c(str); this.X = d(str); this.Y = b(str); this.Z = b(str, this.L); this.c0 = a(kdVar) || K(); if (a2.c()) { this.n0 = true; this.o0 = 1; this.a0 = this.S != 0; } if ("c2.android.mp3.decoder".equals(kdVar.a)) { this.d0 = new s2(); } if (b() == 2) { this.e0 = SystemClock.elapsedRealtime() + 1000; } this.E0.a++; a(str, elapsedRealtime2, elapsedRealtime2 - elapsedRealtime); } private static boolean c(IllegalStateException illegalStateException) { if (illegalStateException instanceof MediaCodec.CodecException) { return ((MediaCodec.CodecException) illegalStateException).isRecoverable(); } return false; } private void a(MediaCrypto mediaCrypto, boolean z) { if (this.P == null) { try { List d = d(z); ArrayDeque arrayDeque = new ArrayDeque(); this.P = arrayDeque; if (this.p) { arrayDeque.addAll(d); } else if (!d.isEmpty()) { this.P.add((kd) d.get(0)); } this.Q = null; } catch (nd.c e) { throw new a(this.B, e, z, -49998); } } if (this.P.isEmpty()) { throw new a(this.B, (Throwable) null, z, -49999); } while (this.K == null) { kd kdVar = (kd) this.P.peekFirst(); if (!b(kdVar)) { return; } try { a(kdVar, mediaCrypto); } catch (Exception e2) { pc.c("MediaCodecRenderer", "Failed to initialize decoder: " + kdVar, e2); this.P.removeFirst(); a aVar = new a(this.B, e2, z, kdVar); a(aVar); if (this.Q == null) { this.Q = aVar; } else { this.Q = this.Q.a(aVar); } if (this.P.isEmpty()) { throw this.Q; } } } this.P = null; } private void c(z6 z6Var) { z6.a(this.E, z6Var); this.E = z6Var; } private static boolean c(String str) { int i = xp.a; if (i > 23 || !"OMX.google.vorbis.decoder".equals(str)) { if (i <= 19) { String str2 = xp.b; if (("hb2000".equals(str2) || "stvm8".equals(str2)) && ("OMX.amlogic.avc.decoder.awesome".equals(str) || "OMX.amlogic.avc.decoder.awesome.secure".equals(str))) { } } return false; } return true; } @Override // com.applovin.impl.e2 public void a(boolean z, boolean z2) { this.E0 = new n5(); } /* JADX WARN: Code restructure failed: missing block: B:34:0x007e, code lost: if (D() == false) goto L69; */ /* JADX WARN: Code restructure failed: missing block: B:35:0x00ce, code lost: r7 = 2; */ /* JADX WARN: Code restructure failed: missing block: B:62:0x00b0, code lost: if (D() == false) goto L69; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public com.applovin.impl.q5 a(com.applovin.impl.g9 r12) { /* Method dump skipped, instructions count: 247 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.applovin.impl.ld.a(com.applovin.impl.g9):com.applovin.impl.q5"); } @Override // com.applovin.impl.e2 public void a(long j, boolean z) { this.w0 = false; this.x0 = false; this.z0 = false; if (this.k0) { this.u.b(); this.t.b(); this.l0 = false; } else { G(); } if (this.v.e() > 0) { this.y0 = true; } this.v.a(); int i = this.H0; if (i != 0) { int i2 = i - 1; this.G0 = this.z[i2]; this.F0 = this.y[i2]; this.H0 = 0; } } @Override // com.applovin.impl.e2 public void a(f9[] f9VarArr, long j, long j2) { if (this.G0 == C.TIME_UNSET) { b1.b(this.F0 == C.TIME_UNSET); this.F0 = j; this.G0 = j2; return; } int i = this.H0; if (i == this.z.length) { pc.d("MediaCodecRenderer", "Too many stream changes, so dropping offset: " + this.z[this.H0 - 1]); } else { this.H0 = i + 1; } long[] jArr = this.y; int i2 = this.H0 - 1; jArr[i2] = j; this.z[i2] = j2; this.A[i2] = this.u0; } @Override // com.applovin.impl.qi public void a(long j, long j2) { boolean z = false; if (this.z0) { this.z0 = false; R(); } a8 a8Var = this.D0; if (a8Var == null) { try { if (this.x0) { V(); return; } if (this.B != null || e(2)) { P(); if (this.k0) { ko.a("bypassRender"); while (b(j, j2)) { } ko.a(); } else if (this.K != null) { long elapsedRealtime = SystemClock.elapsedRealtime(); ko.a("drainAndFeed"); while (c(j, j2) && e(elapsedRealtime)) { } while (E() && e(elapsedRealtime)) { } ko.a(); } else { this.E0.d += b(j); e(1); } this.E0.a(); return; } return; } catch (IllegalStateException e) { if (a(e)) { a((Exception) e); if (xp.a >= 21 && c(e)) { z = true; } if (z) { U(); } throw a(a(e, J()), this.B, z, 4003); } throw e; } } this.D0 = null; throw a8Var; } @Override // com.applovin.impl.qi public void a(float f, float f2) { this.I = f; this.J = f2; e(this.L); } @Override // com.applovin.impl.ri public final int a(f9 f9Var) { try { return a(this.o, f9Var); } catch (nd.c e) { throw a(e, f9Var, IronSourceConstants.NT_INSTANCE_LOAD); } } public jd a(Throwable th, kd kdVar) { return new jd(th, kdVar); } private static boolean a(IllegalStateException illegalStateException) { if (xp.a >= 21 && b(illegalStateException)) { return true; } StackTraceElement[] stackTrace = illegalStateException.getStackTrace(); return stackTrace.length > 0 && stackTrace[0].getClassName().equals("android.media.MediaCodec"); } private int a(String str) { int i = xp.a; if (i <= 25 && "OMX.Exynos.avc.dec.secure".equals(str)) { String str2 = xp.d; if (str2.startsWith("SM-T585") || str2.startsWith("SM-A510") || str2.startsWith("SM-A520") || str2.startsWith("SM-J700")) { return 2; } } if (i >= 24) { return 0; } if (!"OMX.Nvidia.h264.decode".equals(str) && !"OMX.Nvidia.h264.decode.secure".equals(str)) { return 0; } String str3 = xp.b; return ("flounder".equals(str3) || "flounder_lte".equals(str3) || "grouper".equals(str3) || "tilapia".equals(str3)) ? 1 : 0; } private static boolean a(String str, f9 f9Var) { return xp.a < 21 && f9Var.o.isEmpty() && "OMX.MTK.VIDEO.DECODER.AVC".equals(str); } }