package n;

import android.os.SystemClock;
import android.util.Log;

/* JADX INFO: loaded from: classes.dex */
final class E implements o {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private boolean f5445a;

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

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

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private double f5448d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private boolean f5449e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private long f5450f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private long f5451g;

    E() {
    }

    private long b(long j2) {
        return (SystemClock.elapsedRealtime() * 1000) - j2;
    }

    @Override // n.o
    public long a() {
        if (!this.f5445a) {
            return this.f5446b;
        }
        if (!this.f5449e) {
            return b(this.f5447c);
        }
        long jB = ((long) (b(this.f5451g) * this.f5448d)) + this.f5450f;
        c(jB);
        return jB;
    }

    public void c(long j2) {
        this.f5446b = j2;
        this.f5447c = b(j2);
    }

    public void d(double d2) {
        this.f5448d = d2;
    }

    public void e() {
        if (this.f5445a) {
            return;
        }
        this.f5445a = true;
        this.f5447c = b(this.f5446b);
    }

    public void f() {
        if (this.f5449e) {
            return;
        }
        this.f5449e = true;
        this.f5450f = this.f5446b;
        this.f5451g = b(0L);
        Log.d("StandaloneMediaClock", "startingSpeedingPositionUs = " + this.f5450f + ", startingSpeedingDeltaUs = " + this.f5451g);
    }

    public void g() {
        if (this.f5445a) {
            this.f5446b = b(this.f5447c);
            this.f5445a = false;
        }
    }

    public void h() {
        if (this.f5449e) {
            this.f5449e = false;
            if (this.f5448d != 1.0d) {
                Log.d("StandaloneMediaClock", "positionUs = " + this.f5446b);
                c((long) ((((double) b(this.f5451g)) * this.f5448d) + ((double) this.f5450f)));
                Log.d("StandaloneMediaClock", "positionUs = " + this.f5446b);
            }
        }
    }
}
