package com.applovin.impl; import com.applovin.impl.a; import com.applovin.impl.f9; import com.applovin.impl.xl; import com.mbridge.msdk.playercommon.exoplayer2.util.MimeTypes; import java.util.Collections; /* loaded from: classes.dex */ final class s1 extends xl { private static final int[] e = {5512, 11025, 22050, 44100}; private boolean b; private boolean c; private int d; public s1(qo qoVar) { super(qoVar); } @Override // com.applovin.impl.xl public boolean a(bh bhVar) { if (!this.b) { int w = bhVar.w(); int i = (w >> 4) & 15; this.d = i; if (i == 2) { this.a.a(new f9.b().f(MimeTypes.AUDIO_MPEG).c(1).n(e[(w >> 2) & 3]).a()); this.c = true; } else if (i == 7 || i == 8) { this.a.a(new f9.b().f(i == 7 ? MimeTypes.AUDIO_ALAW : MimeTypes.AUDIO_MLAW).c(1).n(8000).a()); this.c = true; } else if (i != 10) { throw new xl.a("Audio format not supported: " + this.d); } this.b = true; } else { bhVar.g(1); } return true; } @Override // com.applovin.impl.xl public boolean b(bh bhVar, long j) { if (this.d == 2) { int a = bhVar.a(); this.a.a(bhVar, a); this.a.a(j, 1, a, 0, null); return true; } int w = bhVar.w(); if (w != 0 || this.c) { if (this.d == 10 && w != 1) { return false; } int a2 = bhVar.a(); this.a.a(bhVar, a2); this.a.a(j, 1, a2, 0, null); return true; } int a3 = bhVar.a(); byte[] bArr = new byte[a3]; bhVar.a(bArr, 0, a3); a.b a4 = a.a(bArr); this.a.a(new f9.b().f(MimeTypes.AUDIO_AAC).a(a4.c).c(a4.b).n(a4.a).a(Collections.singletonList(bArr)).a()); this.c = true; return false; } }