package com.applovin.impl; import com.applovin.impl.dp; import com.applovin.impl.f9; import com.mbridge.msdk.playercommon.exoplayer2.C; import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes; /* loaded from: classes.dex */ public final class ab implements q7 { private qo b; private boolean c; private int e; private int f; private final bh a = new bh(10); private long d = C.TIME_UNSET; @Override // com.applovin.impl.q7 public void a() { this.c = false; this.d = C.TIME_UNSET; } @Override // com.applovin.impl.q7 public void a(long j, int i) { if ((i & 4) == 0) { return; } this.c = true; if (j != C.TIME_UNSET) { this.d = j; } this.e = 0; this.f = 0; } @Override // com.applovin.impl.q7 public void a(bh bhVar) { b1.b(this.b); if (this.c) { int a = bhVar.a(); int i = this.f; if (i < 10) { int min = Math.min(a, 10 - i); System.arraycopy(bhVar.c(), bhVar.d(), this.a.c(), this.f, min); if (this.f + min == 10) { this.a.f(0); if (73 == this.a.w() && 68 == this.a.w() && 51 == this.a.w()) { this.a.g(3); this.e = this.a.v() + 10; } else { pc.d("Id3Reader", "Discarding invalid ID3 tag"); this.c = false; return; } } } int min2 = Math.min(a, this.e - this.f); this.b.a(bhVar, min2); this.f += min2; } } @Override // com.applovin.impl.q7 public void b() { int i; b1.b(this.b); if (this.c && (i = this.e) != 0 && this.f == i) { long j = this.d; if (j != C.TIME_UNSET) { this.b.a(j, 1, i, 0, null); } this.c = false; } } @Override // com.applovin.impl.q7 public void a(m8 m8Var, dp.d dVar) { dVar.a(); qo a = m8Var.a(dVar.c(), 5); this.b = a; a.a(new f9.b().c(dVar.b()).f(MimeTypes.APPLICATION_ID3).a()); } }