package com.ss.android.ugc.aweme.simkit;

import X.AnonymousClass7dQ;
import X.AnonymousClass7g9;
import X.AnonymousClass8BN;
import X.AnonymousClass8CJ;
import X.AnonymousClass8ET;
import X.AnonymousClass8FJ;
import X.AnonymousClass8H6;
import X.AnonymousClass8HD;
import X.AnonymousClass8HE;
import X.AnonymousClass8HN;
import X.AnonymousClass8HU;
import X.AnonymousClass8HX;
import X.AnonymousClass8IL;
import X.AnonymousClass8IP;
import X.AnonymousClass8IV;
import X.AnonymousClass8IX;
import X.AnonymousClass8YM;
import X.C03417cw;
import X.C11447x1;
import X.C16728Df;
import X.C16738Dg;
import X.C16758Di;
import X.C17348Fp;
import X.C17838Hm;
import X.C18058Ii;
import X.C18078Ik;
import X.C18088Il;
import com.bytedance.covode.number.Covode;
import com.bytedance.frameworks.apm.trace.MethodCollector;
import com.ss.android.ugc.aweme.simkit.api.IDimensionBitrateCurveConfig;
import com.ss.android.ugc.aweme.speedpredictor.api.ISpeedCalculator;
import com.ss.android.ugc.aweme.speedpredictor.api.ISpeedCalculatorConfig;
import com.ss.android.ugc.aweme.video.simplayer.ISimPlayerService$$CC;
import com.ss.android.ugc.playerkit.injector.InjectedConfigManager;
import java.util.concurrent.atomic.AtomicBoolean;

public class SimKitService implements AnonymousClass8IL {
    public ISimKitConfig LIZ;
    public AnonymousClass8CJ LIZIZ = new C16728Df();
    public AnonymousClass8ET LIZJ = new AnonymousClass8ET() {
        static {
            Covode.recordClassIndex(114363);
        }

        public final AnonymousClass8FJ LIZ(C16758Di r3, boolean z) {
            return AnonymousClass8HU.LIZ.LIZ(r3, z, 1);
        }

        public final AnonymousClass8YM LIZ(String str, C16738Dg r3) {
            return AnonymousClass8HU.LIZ.LIZ(str, r3);
        }
    };
    public AnonymousClass8IX LIZLLL;
    public ISpeedCalculator LJ;
    public final AtomicBoolean LJFF = new AtomicBoolean(false);

    static {
        Covode.recordClassIndex(114362);
    }

    public final int LIZLLL() {
        return C18088Il.LIZ;
    }

    public final AnonymousClass8ET LJI() {
        return this.LIZJ;
    }

    public final AnonymousClass8CJ LJIIIIZZ() {
        return this.LIZIZ;
    }

    public final AnonymousClass8IV LJFF() {
        return new AnonymousClass8HN();
    }

    public final int LIZJ() {
        return LJII().LIZJ();
    }

    public final ISimKitConfig LJ() {
        ISimKitConfig iSimKitConfig = this.LIZ;
        if (iSimKitConfig == null) {
            return (ISimKitConfig) InjectedConfigManager.getConfig(ISimKitConfig.class);
        }
        return iSimKitConfig;
    }

    public final C17838Hm LIZ() {
        if (this.LIZLLL == null) {
            IDimensionBitrateCurveConfig dimensionBitrateCurveConfig = C03417cw.LIZ().LJ().getDimensionBitrateCurveConfig();
            if (dimensionBitrateCurveConfig == null || !dimensionBitrateCurveConfig.LIZ()) {
                this.LIZLLL = new AnonymousClass8HD();
            } else {
                this.LIZLLL = new AnonymousClass8HE();
            }
        }
        return this.LIZLLL.LIZ();
    }

    public final synchronized ISpeedCalculator LJII() {
        ISpeedCalculator iSpeedCalculator;
        ISpeedCalculatorConfig speedCalculatorConfig;
        MethodCollector.i(16392);
        if (this.LJ == null && (speedCalculatorConfig = C03417cw.LIZ().LJ().getSpeedCalculatorConfig()) != null) {
            ISpeedCalculator LIZ2 = AnonymousClass8HX.LIZ(speedCalculatorConfig.getCalculatorType()).LIZ();
            this.LJ = LIZ2;
            LIZ2.LIZ(speedCalculatorConfig);
        }
        iSpeedCalculator = this.LJ;
        MethodCollector.o(16392);
        return iSpeedCalculator;
    }

    public final void LIZIZ() {
        if (this.LIZ == null) {
            this.LIZ = (ISimKitConfig) InjectedConfigManager.getConfig(ISimKitConfig.class);
        }
        ISimPlayerService$$CC.get$$STATIC$$().LIZ((C11447x1) new AnonymousClass8H6(this));
        if (C17348Fp.LJJIL.LJJJJZ() == 0) {
            AnonymousClass8BN.LIZ().LIZ();
        }
        AnonymousClass8IP.LIZ = C18058Ii.LIZ;
        if (this.LIZ.getSimPlayerExperiment().PlayeAbEnableCustomizeThreadPoolExp() == 1) {
            ISimPlayerService$$CC.get$$STATIC$$().LIZ(AnonymousClass7dQ.LIZIZ);
        }
        AnonymousClass7g9.LIZ = this.LIZ.getAppConfig().isDebug();
        C18078Ik.LIZ = this.LIZ.getAppConfig().isDebug();
    }
}
