package h;

import javax.annotation.Nullable;

/* JADX INFO: compiled from: SegmentPool.java */
/* JADX INFO: loaded from: classes.dex */
final class p {

    @Nullable
    static o a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    static long f4211b;

    private p() {
    }

    static void a(o oVar) {
        if (oVar.f4209f != null || oVar.f4210g != null) {
            throw new IllegalArgumentException();
        }
        if (oVar.f4207d) {
            return;
        }
        synchronized (p.class) {
            if (f4211b + 8192 > 65536) {
                return;
            }
            f4211b += 8192;
            oVar.f4209f = a;
            oVar.f4206c = 0;
            oVar.f4205b = 0;
            a = oVar;
        }
    }

    static o b() {
        synchronized (p.class) {
            if (a == null) {
                return new o();
            }
            o oVar = a;
            a = oVar.f4209f;
            oVar.f4209f = null;
            f4211b -= 8192;
            return oVar;
        }
    }
}
