package m4;

import k4.AbstractC2400m;

/* JADX INFO: loaded from: classes3.dex */
public final class K1 extends AbstractC2400m {

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final P1 f20659b;

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final /* synthetic */ H0 f20661d;

    public K1(H0 h0, P1 p12) {
        this.f20661d = h0;
        this.f20659b = p12;
    }

    @Override // k4.AbstractC2400m
    public final void l(long j4) {
        if (this.f20661d.f20625o.f20686f != null) {
            return;
        }
        synchronized (this.f20661d.f20620i) {
            try {
                if (this.f20661d.f20625o.f20686f == null) {
                    P1 p12 = this.f20659b;
                    if (!p12.f20723b) {
                        long j6 = this.f20660c + j4;
                        this.f20660c = j6;
                        H0 h0 = this.f20661d;
                        long j7 = h0.f20630t;
                        if (j6 <= j7) {
                            return;
                        }
                        if (j6 > h0.f20622k) {
                            p12.f20724c = true;
                        } else {
                            long jAddAndGet = h0.f20621j.f20986a.addAndGet(j6 - j7);
                            H0 h02 = this.f20661d;
                            h02.f20630t = this.f20660c;
                            if (jAddAndGet > h02.l) {
                                this.f20659b.f20724c = true;
                            }
                        }
                        P1 p13 = this.f20659b;
                        C1 c1P = p13.f20724c ? this.f20661d.p(p13) : null;
                        if (c1P != null) {
                            c1P.run();
                        }
                    }
                }
            } finally {
            }
        }
    }
}
