package defpackage;

import android.os.SystemClock;
import java.io.Serializable;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;

/* renamed from: ˊʼˊ, reason: contains not printable characters */
/* loaded from: classes3.dex */
public class C1271 {

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public Serializable f5283;

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

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

    public C1271() {
        this.f5284 = -9223372036854775807L;
        this.f5285 = -9223372036854775807L;
    }

    public C1271(long j) {
        this.f5283 = new LinkedHashMap(100, 0.75f, true);
        this.f5284 = j;
    }

    /* renamed from: ˇʼʤˎ, reason: contains not printable characters */
    public void m3827(Exception exc) {
        long jElapsedRealtime = SystemClock.elapsedRealtime();
        if (((Exception) this.f5283) == null) {
            this.f5283 = exc;
        }
        if (this.f5284 == -9223372036854775807L && C0646.f3172.get() <= 0) {
            this.f5284 = 200 + jElapsedRealtime;
        }
        long j = this.f5284;
        if (j == -9223372036854775807L || jElapsedRealtime < j) {
            this.f5285 = jElapsedRealtime + 50;
            return;
        }
        Exception exc2 = (Exception) this.f5283;
        if (exc2 != exc) {
            exc2.addSuppressed(exc);
        }
        Exception exc3 = (Exception) this.f5283;
        this.f5283 = null;
        this.f5284 = -9223372036854775807L;
        this.f5285 = -9223372036854775807L;
        throw exc3;
    }

    /* renamed from: ˏˋٴ, reason: contains not printable characters */
    public synchronized void m3828(long j) {
        while (this.f5285 > j) {
            Iterator it = ((LinkedHashMap) this.f5283).entrySet().iterator();
            Map.Entry entry = (Map.Entry) it.next();
            C0604 c0604 = (C0604) entry.getValue();
            this.f5285 -= c0604.f3065;
            Object key = entry.getKey();
            it.remove();
            mo3829(key, c0604.f3064);
        }
    }

    /* renamed from: ˏᵙ, reason: contains not printable characters */
    public void mo3829(Object obj, Object obj2) {
    }

    /* renamed from: ᵥᵯˎ, reason: contains not printable characters */
    public synchronized Object m3830(Object obj) {
        C0604 c0604;
        c0604 = (C0604) ((LinkedHashMap) this.f5283).get(obj);
        return c0604 != null ? c0604.f3064 : null;
    }

    /* renamed from: ᵴᵳ, reason: contains not printable characters */
    public int mo3831(Object obj) {
        return 1;
    }

    /* renamed from: ᵻᵢﹳᵰ, reason: contains not printable characters */
    public synchronized Object m3832(Object obj, Object obj2) {
        int iMo3831 = mo3831(obj2);
        long j = iMo3831;
        if (j >= this.f5284) {
            mo3829(obj, obj2);
            return null;
        }
        if (obj2 != null) {
            this.f5285 += j;
        }
        C0604 c0604 = (C0604) ((LinkedHashMap) this.f5283).put(obj, obj2 == null ? null : new C0604(iMo3831, obj2));
        if (c0604 != null) {
            this.f5285 -= c0604.f3065;
            if (!c0604.f3064.equals(obj2)) {
                mo3829(obj, c0604.f3064);
            }
        }
        m3828(this.f5284);
        return c0604 != null ? c0604.f3064 : null;
    }
}
