package I0;

import java.nio.ByteBuffer;
import x0.AbstractC1709a;

/* JADX INFO: loaded from: classes.dex */
public final class i extends A0.h {

    /* JADX INFO: renamed from: A, reason: collision with root package name */
    public int f3226A;

    /* JADX INFO: renamed from: B, reason: collision with root package name */
    public int f3227B;

    /* JADX INFO: renamed from: z, reason: collision with root package name */
    public long f3228z;

    @Override // A0.h
    public final void e() {
        super.e();
        this.f3226A = 0;
    }

    public final boolean l(A0.h hVar) {
        ByteBuffer byteBuffer;
        AbstractC1709a.d(!hVar.d(1073741824));
        AbstractC1709a.d(!hVar.d(268435456));
        AbstractC1709a.d(!hVar.d(4));
        if (m()) {
            if (this.f3226A >= this.f3227B) {
                return false;
            }
            ByteBuffer byteBuffer2 = hVar.f18u;
            if (byteBuffer2 != null && (byteBuffer = this.f18u) != null) {
                if (byteBuffer2.remaining() + byteBuffer.position() > 3072000) {
                    return false;
                }
            }
        }
        int i = this.f3226A;
        this.f3226A = i + 1;
        if (i == 0) {
            this.f20w = hVar.f20w;
            if (hVar.d(1)) {
                this.f6r = 1;
            }
        }
        ByteBuffer byteBuffer3 = hVar.f18u;
        if (byteBuffer3 != null) {
            h(byteBuffer3.remaining());
            this.f18u.put(byteBuffer3);
        }
        this.f3228z = hVar.f20w;
        return true;
    }

    public final boolean m() {
        return this.f3226A > 0;
    }
}
