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

import androidx.media3.exoplayer.rtsp.SessionDescription;

/* JADX INFO: loaded from: classes2.dex */
public final class va1 {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final i8.c f17581a;

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

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final Object f17583c = new Object();

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public volatile int f17585e = 1;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public volatile long f17584d = 0;

    public va1(i8.c cVar, cr0 cr0Var) {
        this.f17581a = cVar;
        this.f17582b = cr0Var;
    }

    public final void a(boolean z10) {
        if (((Boolean) n7.y.f31093e.f31096c.b(ao.f9008oe)).booleanValue()) {
            br0 br0VarA = this.f17582b.a();
            br0VarA.zzc("action", "mbs_state");
            br0VarA.zzc("mbs_state", true != z10 ? SessionDescription.SUPPORTED_SDP_VERSION : "1");
            br0VarA.b();
        }
        if (z10) {
            c(1, 2);
        } else {
            c(2, 1);
        }
    }

    public final void b() {
        ((i8.d) this.f17581a).getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        synchronized (this.f17583c) {
            try {
                if (this.f17585e == 3) {
                    if (this.f17584d + ((Long) n7.y.f31093e.f31096c.b(ao.K6)).longValue() <= jCurrentTimeMillis) {
                        this.f17585e = 1;
                    }
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }

    public final void c(int i10, int i11) {
        b();
        Object obj = this.f17583c;
        ((i8.d) this.f17581a).getClass();
        long jCurrentTimeMillis = System.currentTimeMillis();
        synchronized (obj) {
            try {
                if (this.f17585e != i10) {
                    return;
                }
                this.f17585e = i11;
                if (this.f17585e == 3) {
                    this.f17584d = jCurrentTimeMillis;
                }
            } catch (Throwable th) {
                throw th;
            }
        }
    }
}
