package defpackage;

import androidx.media3.common.audio.AudioProcessor$UnhandledAudioFormatException;
import java.nio.ByteBuffer;

/* JADX INFO: renamed from: ᵸᵙʦᵲ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes3.dex */
public final class C4990 extends AbstractC1776 {

    /* JADX INFO: renamed from: ˋˈ, reason: contains not printable characters */
    public int f18914;

    /* JADX INFO: renamed from: ᵝᵶ, reason: contains not printable characters */
    public byte[] f18915;

    /* JADX INFO: renamed from: ᵪᵹᵥᵻ, reason: contains not printable characters */
    public long f18916;

    /* JADX INFO: renamed from: ᵮᵣᵗˈ, reason: contains not printable characters */
    public int f18917;

    /* JADX INFO: renamed from: ᵱᵽʡᵚ, reason: contains not printable characters */
    public int f18918;

    /* JADX INFO: renamed from: ᵶᵥᵝ, reason: contains not printable characters */
    public boolean f18919;

    /* JADX INFO: renamed from: ᵻʽᵯ, reason: contains not printable characters */
    public int f18920;

    @Override // defpackage.AbstractC1776, defpackage.InterfaceC2497
    /* JADX INFO: renamed from: ʽˈˋ */
    public final boolean mo4908() {
        return super.mo4908() && this.f18914 == 0;
    }

    @Override // defpackage.AbstractC1776
    /* JADX INFO: renamed from: ᵮᵣᵗˈ */
    public final void mo3850() {
        this.f18915 = AbstractC0956.f4216;
    }

    @Override // defpackage.AbstractC1776
    /* JADX INFO: renamed from: ᵱᵽʡᵚ */
    public final void mo3851() {
        if (this.f18919) {
            this.f18919 = false;
            int i = this.f18918;
            int i2 = this.f7116.f11223;
            this.f18915 = new byte[i * i2];
            this.f18917 = this.f18920 * i2;
        }
        this.f18914 = 0;
    }

    @Override // defpackage.AbstractC1776
    /* JADX INFO: renamed from: ᵲᵶᵳˈ */
    public final C2917 mo3788(C2917 c2917) throws AudioProcessor$UnhandledAudioFormatException {
        if (!AbstractC0956.m3253(c2917.f11221)) {
            throw new AudioProcessor$UnhandledAudioFormatException(c2917);
        }
        this.f18919 = true;
        return (this.f18920 == 0 && this.f18918 == 0) ? C2917.f11219 : c2917;
    }

    @Override // defpackage.AbstractC1776
    /* JADX INFO: renamed from: ᵶᵥᵝ */
    public final void mo3852() {
        if (this.f18919) {
            int i = this.f18914;
            if (i > 0) {
                this.f18916 += (long) (i / this.f7116.f11223);
            }
            this.f18914 = 0;
        }
    }

    @Override // defpackage.AbstractC1776, defpackage.InterfaceC2497
    /* JADX INFO: renamed from: ᵷᵺʾᵖ */
    public final ByteBuffer mo4913() {
        int i;
        if (super.mo4908() && (i = this.f18914) > 0) {
            m4910(i).put(this.f18915, 0, this.f18914).flip();
            this.f18914 = 0;
        }
        return super.mo4913();
    }

    @Override // defpackage.AbstractC1776, defpackage.InterfaceC2497
    /* JADX INFO: renamed from: ᵻʽᵯ */
    public final long mo4914(long j) {
        return Math.max(0L, j - AbstractC0956.m3230(this.f18918 + this.f18920, this.f7116.f11222));
    }

    @Override // defpackage.InterfaceC2497
    /* JADX INFO: renamed from: ᵻˈᵦʼ */
    public final void mo3789(ByteBuffer byteBuffer) {
        int iPosition = byteBuffer.position();
        int iLimit = byteBuffer.limit();
        int i = iLimit - iPosition;
        if (i == 0) {
            return;
        }
        int iMin = Math.min(i, this.f18917);
        this.f18916 += (long) (iMin / this.f7116.f11223);
        this.f18917 -= iMin;
        byteBuffer.position(iPosition + iMin);
        if (this.f18917 > 0) {
            return;
        }
        int i2 = i - iMin;
        int length = (this.f18914 + i2) - this.f18915.length;
        ByteBuffer byteBufferM4910 = m4910(length);
        int iM3261 = AbstractC0956.m3261(length, 0, this.f18914);
        byteBufferM4910.put(this.f18915, 0, iM3261);
        int iM32612 = AbstractC0956.m3261(length - iM3261, 0, i2);
        byteBuffer.limit(byteBuffer.position() + iM32612);
        byteBufferM4910.put(byteBuffer);
        byteBuffer.limit(iLimit);
        int i3 = i2 - iM32612;
        int i4 = this.f18914 - iM3261;
        this.f18914 = i4;
        byte[] bArr = this.f18915;
        System.arraycopy(bArr, iM3261, bArr, 0, i4);
        byteBuffer.get(this.f18915, this.f18914, i3);
        this.f18914 += i3;
        byteBufferM4910.flip();
    }
}
