package c.i.a.c.v1; import androidx.annotation.Nullable; import com.google.android.exoplayer2.audio.AudioProcessor; import java.nio.ByteBuffer; import java.util.Objects; /* compiled from: ChannelMappingAudioProcessor */ public final class v extends u { @Nullable public int[] i; @Nullable public int[] j; @Override // com.google.android.exoplayer2.audio.AudioProcessor public void c(ByteBuffer byteBuffer) { int[] iArr = this.j; Objects.requireNonNull(iArr); int position = byteBuffer.position(); int limit = byteBuffer.limit(); ByteBuffer j = j(((limit - position) / this.b.e) * this.f998c.e); while (position < limit) { for (int i : iArr) { j.putShort(byteBuffer.getShort((i * 2) + position)); } position += this.b.e; } byteBuffer.position(limit); j.flip(); } @Override // c.i.a.c.v1.u public AudioProcessor.a f(AudioProcessor.a aVar) throws AudioProcessor.UnhandledAudioFormatException { int[] iArr = this.i; if (iArr == null) { return AudioProcessor.a.a; } if (aVar.d == 2) { boolean z2 = aVar.f2202c != iArr.length; int i = 0; while (i < iArr.length) { int i2 = iArr[i]; if (i2 < aVar.f2202c) { z2 |= i2 != i; i++; } else { throw new AudioProcessor.UnhandledAudioFormatException(aVar); } } return z2 ? new AudioProcessor.a(aVar.b, iArr.length, 2) : AudioProcessor.a.a; } throw new AudioProcessor.UnhandledAudioFormatException(aVar); } @Override // c.i.a.c.v1.u public void g() { this.j = this.i; } @Override // c.i.a.c.v1.u public void i() { this.j = null; this.i = null; } }