package defpackage;

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

/* renamed from: ᵡʿˎ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C3180 extends AbstractC3190 {

    /* renamed from: ˌᵜᵹᵩ, reason: contains not printable characters */
    public int f12052;

    /* renamed from: ᵝᵵᵺ, reason: contains not printable characters */
    public int f12053;

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public int f12054;

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public byte[] f12055;

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public long f12056;

    /* renamed from: ᵶᵷᵕ, reason: contains not printable characters */
    public int f12057;

    /* renamed from: ᵸˑ, reason: contains not printable characters */
    public boolean f12058;

    @Override // defpackage.AbstractC3190
    /* renamed from: ˌᵜᵹᵩ */
    public final void mo7360() {
        this.f12055 = AbstractC3558.f13330;
    }

    @Override // defpackage.InterfaceC0240
    /* renamed from: ˏˋٴ */
    public final void mo1540(ByteBuffer byteBuffer) {
        int iPosition = byteBuffer.position();
        int iLimit = byteBuffer.limit();
        int i = iLimit - iPosition;
        if (i == 0) {
            return;
        }
        int iMin = Math.min(i, this.f12052);
        this.f12056 += iMin / this.f12082.f8842;
        this.f12052 -= iMin;
        byteBuffer.position(iPosition + iMin);
        if (this.f12052 > 0) {
            return;
        }
        int i2 = i - iMin;
        int length = (this.f12054 + i2) - this.f12055.length;
        ByteBuffer byteBufferM7540 = m7540(length);
        int iM8150 = AbstractC3558.m8150(length, 0, this.f12054);
        byteBufferM7540.put(this.f12055, 0, iM8150);
        int iM81502 = AbstractC3558.m8150(length - iM8150, 0, i2);
        byteBuffer.limit(byteBuffer.position() + iM81502);
        byteBufferM7540.put(byteBuffer);
        byteBuffer.limit(iLimit);
        int i3 = i2 - iM81502;
        int i4 = this.f12054 - iM8150;
        this.f12054 = i4;
        byte[] bArr = this.f12055;
        System.arraycopy(bArr, iM8150, bArr, 0, i4);
        byteBuffer.get(this.f12055, this.f12054, i3);
        this.f12054 += i3;
        byteBufferM7540.flip();
    }

    @Override // defpackage.AbstractC3190, defpackage.InterfaceC0240
    /* renamed from: ᵝᵵᵺ */
    public final long mo1542(long j) {
        return Math.max(0L, j - AbstractC3558.m8110(this.f12057 + this.f12053, this.f12082.f8840));
    }

    @Override // defpackage.AbstractC3190
    /* renamed from: ᵥᵯˎ */
    public final C2263 mo2173(C2263 c2263) throws AudioProcessor$UnhandledAudioFormatException {
        if (!AbstractC3558.m8107(c2263.f8839)) {
            throw new AudioProcessor$UnhandledAudioFormatException(c2263);
        }
        this.f12058 = true;
        return (this.f12053 == 0 && this.f12057 == 0) ? C2263.f8838 : c2263;
    }

    @Override // defpackage.AbstractC3190, defpackage.InterfaceC0240
    /* renamed from: ᵴᵳ */
    public final boolean mo1543() {
        return super.mo1543() && this.f12054 == 0;
    }

    @Override // defpackage.AbstractC3190
    /* renamed from: ᵶᵷᵕ */
    public final void mo7363() {
        if (this.f12058) {
            this.f12058 = false;
            int i = this.f12057;
            int i2 = this.f12082.f8842;
            this.f12055 = new byte[i * i2];
            this.f12052 = this.f12053 * i2;
        }
        this.f12054 = 0;
    }

    @Override // defpackage.AbstractC3190
    /* renamed from: ᵸˑ */
    public final void mo7364() {
        if (this.f12058) {
            if (this.f12054 > 0) {
                this.f12056 += r0 / this.f12082.f8842;
            }
            this.f12054 = 0;
        }
    }

    @Override // defpackage.AbstractC3190, defpackage.InterfaceC0240
    /* renamed from: ᵻᵢﹳᵰ */
    public final ByteBuffer mo1545() {
        int i;
        if (super.mo1543() && (i = this.f12054) > 0) {
            m7540(i).put(this.f12055, 0, this.f12054).flip();
            this.f12054 = 0;
        }
        return super.mo1545();
    }
}
