package com.google.android.gms.internal.ads;

import java.nio.ByteBuffer;

/* JADX INFO: loaded from: classes2.dex */
public final class kn2 extends fe2 {

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

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

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

    @Override // com.google.android.gms.internal.ads.fe2
    public final void h() {
        super.h();
        this.f13328h = 0;
    }

    public final long m() {
        return this.f13327g;
    }

    public final int n() {
        return this.f13328h;
    }

    public final boolean o() {
        return this.f13328h > 0;
    }

    public final boolean p(fe2 fe2Var) {
        ByteBuffer byteBuffer;
        ih1.x(!fe2Var.g(1073741824));
        ih1.x(!fe2Var.g(268435456));
        ih1.x(!fe2Var.g(4));
        if (o()) {
            if (this.f13328h >= this.f13329i) {
                return false;
            }
            ByteBuffer byteBuffer2 = fe2Var.zzc;
            if (byteBuffer2 != null && (byteBuffer = this.zzc) != null) {
                if (byteBuffer2.remaining() + byteBuffer.position() > 3072000) {
                    return false;
                }
            }
        }
        int i10 = this.f13328h;
        this.f13328h = i10 + 1;
        if (i10 == 0) {
            this.f11190e = fe2Var.f11190e;
            if (fe2Var.g(1)) {
                this.f32097b = 1;
            }
        }
        ByteBuffer byteBuffer3 = fe2Var.zzc;
        if (byteBuffer3 != null) {
            i(byteBuffer3.remaining());
            this.zzc.put(byteBuffer3);
        }
        this.f13327g = fe2Var.f11190e;
        return true;
    }
}
