package com.google.android.gms.internal.ads; import com.mbridge.msdk.playercommon.exoplayer2.C; import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes; import java.io.IOException; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Arrays; import java.util.List; /* loaded from: classes3.dex */ public final class zzaea implements zzacn { private static final int[] zza = {13, 14, 16, 18, 20, 21, 27, 32, 6, 7, 6, 6, 1, 1, 1, 1}; private static final int[] zzb = {18, 24, 33, 37, 41, 47, 51, 59, 61, 6, 1, 1, 1, 1, 1, 1}; private static final byte[] zzc; private static final byte[] zzd; private final byte[] zze; private final zzadt zzf; private boolean zzg; private long zzh; private int zzi; private int zzj; private int zzk; private int zzl; private long zzm; private zzacq zzn; private zzadt zzo; private zzadt zzp; private zzadm zzq; private long zzr; private boolean zzs; static { int i = zzei.zza; Charset charset = StandardCharsets.UTF_8; zzc = "#!AMR\n".getBytes(charset); zzd = "#!AMR-WB\n".getBytes(charset); } public zzaea() { throw null; } public zzaea(int i) { this.zze = new byte[1]; this.zzk = -1; zzaci zzaciVar = new zzaci(); this.zzf = zzaciVar; this.zzp = zzaciVar; } /* JADX WARN: Removed duplicated region for block: B:23:0x0036 A[Catch: EOFException -> 0x008d, TryCatch #0 {EOFException -> 0x008d, blocks: (B:13:0x0007, B:15:0x0018, B:23:0x0036, B:24:0x003f, B:30:0x003b, B:40:0x0059, B:41:0x0076, B:42:0x0077, B:43:0x008c), top: B:12:0x0007 }] */ /* JADX WARN: Removed duplicated region for block: B:27:0x0047 */ /* JADX WARN: Removed duplicated region for block: B:29:0x004c */ /* JADX WARN: Removed duplicated region for block: B:30:0x003b A[Catch: EOFException -> 0x008d, TryCatch #0 {EOFException -> 0x008d, blocks: (B:13:0x0007, B:15:0x0018, B:23:0x0036, B:24:0x003f, B:30:0x003b, B:40:0x0059, B:41:0x0076, B:42:0x0077, B:43:0x008c), top: B:12:0x0007 }] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private final int zza(com.google.android.gms.internal.ads.zzaco r12) throws java.io.IOException { /* r11 = this; int r0 = r11.zzj r1 = -1 r2 = 1 r3 = 0 if (r0 != 0) goto L8e r12.zzj() // Catch: java.io.EOFException -> L8d byte[] r0 = r11.zze // Catch: java.io.EOFException -> L8d r12.zzh(r0, r3, r2) // Catch: java.io.EOFException -> L8d byte[] r0 = r11.zze // Catch: java.io.EOFException -> L8d r0 = r0[r3] // Catch: java.io.EOFException -> L8d r4 = r0 & 131(0x83, float:1.84E-43) r5 = 0 if (r4 > 0) goto L77 int r0 = r0 >> 3 boolean r4 = r11.zzg // Catch: java.io.EOFException -> L8d r0 = r0 & 15 if (r4 == 0) goto L29 r6 = 10 if (r0 < r6) goto L34 r6 = 13 if (r0 <= r6) goto L29 goto L34 L29: if (r4 != 0) goto L52 r6 = 12 if (r0 < r6) goto L34 r6 = 14 if (r0 > r6) goto L34 goto L52 L34: if (r4 == 0) goto L3b int[] r4 = com.google.android.gms.internal.ads.zzaea.zzb // Catch: java.io.EOFException -> L8d r0 = r4[r0] // Catch: java.io.EOFException -> L8d goto L3f L3b: int[] r4 = com.google.android.gms.internal.ads.zzaea.zza // Catch: java.io.EOFException -> L8d r0 = r4[r0] // Catch: java.io.EOFException -> L8d L3f: r11.zzi = r0 // Catch: java.io.EOFException -> L8d r11.zzj = r0 int r4 = r11.zzk if (r4 != r1) goto L4a r11.zzk = r0 r4 = r0 L4a: if (r4 != r0) goto L8e int r4 = r11.zzl int r4 = r4 + r2 r11.zzl = r4 goto L8e L52: java.lang.String r12 = "WB" java.lang.String r3 = "NB" if (r2 == r4) goto L59 r12 = r3 L59: java.lang.StringBuilder r2 = new java.lang.StringBuilder // Catch: java.io.EOFException -> L8d r2.() // Catch: java.io.EOFException -> L8d java.lang.String r3 = "Illegal AMR " r2.append(r3) // Catch: java.io.EOFException -> L8d r2.append(r12) // Catch: java.io.EOFException -> L8d java.lang.String r12 = " frame type " r2.append(r12) // Catch: java.io.EOFException -> L8d r2.append(r0) // Catch: java.io.EOFException -> L8d java.lang.String r12 = r2.toString() // Catch: java.io.EOFException -> L8d com.google.android.gms.internal.ads.zzbc r12 = com.google.android.gms.internal.ads.zzbc.zza(r12, r5) // Catch: java.io.EOFException -> L8d throw r12 // Catch: java.io.EOFException -> L8d L77: java.lang.StringBuilder r12 = new java.lang.StringBuilder // Catch: java.io.EOFException -> L8d r12.() // Catch: java.io.EOFException -> L8d java.lang.String r2 = "Invalid padding bits for frame header " r12.append(r2) // Catch: java.io.EOFException -> L8d r12.append(r0) // Catch: java.io.EOFException -> L8d java.lang.String r12 = r12.toString() // Catch: java.io.EOFException -> L8d com.google.android.gms.internal.ads.zzbc r12 = com.google.android.gms.internal.ads.zzbc.zza(r12, r5) // Catch: java.io.EOFException -> L8d throw r12 // Catch: java.io.EOFException -> L8d L8d: return r1 L8e: com.google.android.gms.internal.ads.zzadt r4 = r11.zzp int r12 = r4.zzf(r12, r0, r2) if (r12 != r1) goto L97 return r1 L97: int r0 = r11.zzj int r0 = r0 - r12 r11.zzj = r0 if (r0 <= 0) goto L9f return r3 L9f: com.google.android.gms.internal.ads.zzadt r4 = r11.zzp long r5 = r11.zzh r7 = 1 int r8 = r11.zzi r9 = 0 r10 = 0 r4.zzt(r5, r7, r8, r9, r10) long r0 = r11.zzh r4 = 20000(0x4e20, double:9.8813E-320) long r0 = r0 + r4 r11.zzh = r0 return r3 */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.gms.internal.ads.zzaea.zza(com.google.android.gms.internal.ads.zzaco):int"); } private static boolean zzg(zzaco zzacoVar, byte[] bArr) throws IOException { zzacoVar.zzj(); int length = bArr.length; byte[] bArr2 = new byte[length]; zzacoVar.zzh(bArr2, 0, length); return Arrays.equals(bArr2, bArr); } private final boolean zzh(zzaco zzacoVar) throws IOException { byte[] bArr = zzc; if (zzg(zzacoVar, bArr)) { this.zzg = false; zzacoVar.zzk(bArr.length); return true; } byte[] bArr2 = zzd; if (!zzg(zzacoVar, bArr2)) { return false; } this.zzg = true; zzacoVar.zzk(bArr2.length); return true; } @Override // com.google.android.gms.internal.ads.zzacn public final int zzb(zzaco zzacoVar, zzadj zzadjVar) throws IOException { zzcw.zzb(this.zzo); int i = zzei.zza; if (zzacoVar.zzf() == 0 && !zzh(zzacoVar)) { throw zzbc.zza("Could not find AMR header.", null); } if (!this.zzs) { this.zzs = true; boolean z = this.zzg; String str = true != z ? MimeTypes.AUDIO_AMR_NB : MimeTypes.AUDIO_AMR_WB; int i2 = true != z ? 8000 : 16000; int i3 = z ? zzb[8] : zza[7]; zzadt zzadtVar = this.zzp; zzz zzzVar = new zzz(); zzzVar.zzaa(str); zzzVar.zzR(i3); zzzVar.zzz(1); zzzVar.zzab(i2); zzadtVar.zzm(zzzVar.zzag()); } int zza2 = zza(zzacoVar); if (this.zzq == null) { zzadl zzadlVar = new zzadl(C.TIME_UNSET, 0L); this.zzq = zzadlVar; this.zzn.zzO(zzadlVar); } return zza2 == -1 ? -1 : 0; } @Override // com.google.android.gms.internal.ads.zzacn public final /* synthetic */ zzacn zzc() { return this; } @Override // com.google.android.gms.internal.ads.zzacn public final /* synthetic */ List zzd() { return zzfxn.zzn(); } @Override // com.google.android.gms.internal.ads.zzacn public final void zze(zzacq zzacqVar) { this.zzn = zzacqVar; zzadt zzw = zzacqVar.zzw(0, 1); this.zzo = zzw; this.zzp = zzw; zzacqVar.zzD(); } @Override // com.google.android.gms.internal.ads.zzacn public final void zzf(long j, long j2) { this.zzh = 0L; this.zzi = 0; this.zzj = 0; this.zzr = j2; this.zzm = 0L; } @Override // com.google.android.gms.internal.ads.zzacn public final boolean zzi(zzaco zzacoVar) throws IOException { return zzh(zzacoVar); } }