package defpackage;

import java.math.RoundingMode;

/* renamed from: ˉᵻᵗ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public final class C1240 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public long f5199;

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public long f5200;

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public long f5201;

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final ThreadLocal f5202 = new ThreadLocal();

    public C1240(long j) {
        m3772(j);
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public final synchronized long m3771() {
        return this.f5201;
    }

    /* renamed from: ˎˏʜʾ, reason: contains not printable characters */
    public final synchronized void m3772(long j) {
        this.f5200 = j;
        this.f5201 = j == Long.MAX_VALUE ? 0L : -9223372036854775807L;
        this.f5199 = -9223372036854775807L;
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public final synchronized boolean m3773() {
        return this.f5201 != -9223372036854775807L;
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public final synchronized long m3774(long j) {
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        long j2 = this.f5199;
        if (j2 != -9223372036854775807L) {
            String str = AbstractC3558.f13329;
            long jM8115 = AbstractC3558.m8115(j2, 90000L, 1000000L, RoundingMode.DOWN);
            long j3 = jM8115 / 8589934592L;
            Long.signum(j3);
            long j4 = (j3 * 8589934592L) + j;
            j = j4 >= jM8115 ? j4 : ((j3 + 1) * 8589934592L) + j;
        }
        long j5 = j;
        String str2 = AbstractC3558.f13329;
        return m3775(AbstractC3558.m8115(j5, 1000000L, 90000L, RoundingMode.DOWN));
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public final synchronized long m3775(long j) {
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        try {
            if (!m3773()) {
                long jLongValue = this.f5200;
                if (jLongValue == 9223372036854775806L) {
                    Long l = (Long) this.f5202.get();
                    l.getClass();
                    jLongValue = l.longValue();
                }
                this.f5201 = jLongValue - j;
                notifyAll();
            }
            this.f5199 = j;
            return j + this.f5201;
        } catch (Throwable th) {
            throw th;
        }
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public final synchronized long m3776(long j) {
        if (j == -9223372036854775807L) {
            return -9223372036854775807L;
        }
        try {
            long j2 = this.f5199;
            if (j2 != -9223372036854775807L) {
                String str = AbstractC3558.f13329;
                long jM8115 = AbstractC3558.m8115(j2, 90000L, 1000000L, RoundingMode.DOWN);
                long j3 = (4294967296L + jM8115) / 8589934592L;
                long j4 = ((j3 - 1) * 8589934592L) + j;
                long j5 = (j3 * 8589934592L) + j;
                j = Math.abs(j4 - jM8115) < Math.abs(j5 - jM8115) ? j4 : j5;
            }
            long j6 = j;
            String str2 = AbstractC3558.f13329;
            return m3775(AbstractC3558.m8115(j6, 1000000L, 90000L, RoundingMode.DOWN));
        } catch (Throwable th) {
            throw th;
        }
    }

    /* renamed from: ᵹᵝᵶ, reason: contains not printable characters */
    public final synchronized void m3777(boolean z, long j) {
        try {
            ᵛᵾˏ.ᵿʗᵝʽ(this.f5200 == 9223372036854775806L);
            if (m3773()) {
                return;
            }
            if (z) {
                this.f5202.set(Long.valueOf(j));
            } else {
                while (!m3773()) {
                    wait();
                }
            }
        } catch (Throwable th) {
            throw th;
        }
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public final synchronized long m3778() {
        long j;
        j = this.f5200;
        if (j == Long.MAX_VALUE || j == 9223372036854775806L) {
            j = -9223372036854775807L;
        }
        return j;
    }
}
