package defpackage;

import androidx.media3.decoder.DecoderInputBuffer$InsufficientCapacityException;
import java.nio.ByteBuffer;

/* renamed from: ᵗˏ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public class C2441 extends AbstractC4689 {

    /* renamed from: ˀᵗᵝᵭ, reason: contains not printable characters */
    public long f9512;

    /* renamed from: ˎˑː, reason: contains not printable characters */
    public final int f9513;

    /* renamed from: ˑᵥˁ, reason: contains not printable characters */
    public final int f9514;

    /* renamed from: ᵡˎ, reason: contains not printable characters */
    public ByteBuffer f9515;

    /* renamed from: ᵡⁱᵥ, reason: contains not printable characters */
    public boolean f9516;

    /* renamed from: ᵤᵙᵷ, reason: contains not printable characters */
    public ByteBuffer f9517;

    /* renamed from: ᵾᵬ, reason: contains not printable characters */
    public final C3937 f9518;

    /* renamed from: ᵿʗᵝʽ, reason: contains not printable characters */
    public C3446 f9519;

    static {
        AbstractC2483.m6325("media3.decoder");
    }

    public C2441(int i, int i2) {
        super(0);
        this.f9518 = new C3937();
        this.f9514 = i;
        this.f9513 = i2;
    }

    /* renamed from: ˌʾˀ, reason: contains not printable characters */
    public final void m6219() {
        ByteBuffer byteBuffer = this.f9517;
        if (byteBuffer != null) {
            byteBuffer.flip();
        }
        ByteBuffer byteBuffer2 = this.f9515;
        if (byteBuffer2 != null) {
            byteBuffer2.flip();
        }
    }

    /* renamed from: ᵪʩ, reason: contains not printable characters */
    public final ByteBuffer m6220(int i) {
        int i2 = this.f9514;
        if (i2 == 1) {
            return ByteBuffer.allocate(i);
        }
        if (i2 == 2) {
            return ByteBuffer.allocateDirect(i);
        }
        ByteBuffer byteBuffer = this.f9517;
        throw new DecoderInputBuffer$InsufficientCapacityException("Buffer too small (" + (byteBuffer == null ? 0 : byteBuffer.capacity()) + " < " + i + ")");
    }

    /* renamed from: ᵯٴᵦ, reason: contains not printable characters */
    public void mo6221() {
        this.f17323 = 0;
        ByteBuffer byteBuffer = this.f9517;
        if (byteBuffer != null) {
            byteBuffer.clear();
        }
        ByteBuffer byteBuffer2 = this.f9515;
        if (byteBuffer2 != null) {
            byteBuffer2.clear();
        }
        this.f9516 = false;
    }

    /* renamed from: ᵳٴᵶ, reason: contains not printable characters */
    public final void m6222(int i) {
        int i2 = i + this.f9513;
        ByteBuffer byteBuffer = this.f9517;
        if (byteBuffer == null) {
            this.f9517 = m6220(i2);
            return;
        }
        int iCapacity = byteBuffer.capacity();
        int iPosition = byteBuffer.position();
        int i3 = i2 + iPosition;
        if (iCapacity >= i3) {
            this.f9517 = byteBuffer;
            return;
        }
        ByteBuffer byteBufferM6220 = m6220(i3);
        byteBufferM6220.order(byteBuffer.order());
        if (iPosition > 0) {
            byteBuffer.flip();
            byteBufferM6220.put(byteBuffer);
        }
        this.f9517 = byteBufferM6220;
    }
}
