红果免费短剧 v6.2.3.32版本的 MD5 值为:a6b05492607eab2c8a25f26d2f238ae0

以下内容为反编译后的 TTVideoEngineImpl.java 源代码,内容仅作参考


package com.ss.ttvideoengine;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Rect;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.Message;
import android.os.Parcel;
import android.os.SystemClock;
import android.text.TextUtils;
import android.util.Pair;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.webkit.URLUtil;
import androidx.core.view.MotionEventCompat;
import androidx.core.view.accessibility.b;
import com.a;
import com.bytedance.crash.Npth;
import com.bytedance.ugc.glue.monitor.UGCMonitor;
import com.bytedance.vcloud.abrmodule.ABRResult;
import com.bytedance.vcloud.abrmodule.DefaultABRModule;
import com.bytedance.vcloud.abrmodule.IPlayStateSupplier;
import com.bytedance.vcloud.abrmodule.c;
import com.bytedance.vcloud.abrmodule.f;
import com.bytedance.vcloud.abrmodule.i;
import com.bytedance.vcloud.abrmodule.j;
import com.bytedance.vcloud.abrmodule.k;
import com.bytedance.vcloud.abrmodule.m;
import com.bytedance.vcloud.abrmodule.n;
import com.bytedance.vcloud.abrmodule.q;
import com.bytedance.vcloud.strategy.ISelectBitrateListener;
import com.dragon.read.base.ssconfig.d;
import com.dragon.read.base.ssconfig.local.QualityOptExperiment;
import com.dragon.read.base.ssconfig.template.jm;
import com.dragon.read.base.ssconfig.template.ly;
import com.dragon.read.base.ssconfig.template.qn;
import com.dragon.read.base.ssconfig.template.qx;
import com.dragon.read.base.util.LogWrapper;
import com.dragon.read.base.util.ThreadUtils;
import com.dragon.read.c.ae;
import com.dragon.read.c.z;
import com.dragon.read.component.audio.api.NsAudioModuleApi;
import com.dragon.read.component.audio.data.setting.ab;
import com.dragon.read.util.ToastUtils;
import com.ss.android.videoshop.a.l;
import com.ss.android.videoshop.command.IVideoLayerCommand;
import com.ss.mediakit.fetcher.AVMDLURLFetcherBridge;
import com.ss.texturerender.VideoSurface;
import com.ss.texturerender.effect.g;
import com.ss.texturerender.r;
import com.ss.texturerender.u;
import com.ss.texturerender.v;
import com.ss.ttm.player.ABRStrategy;
import com.ss.ttm.player.AudioProcessor;
import com.ss.ttm.player.FrameMetadataListener;
import com.ss.ttm.player.IMediaDataSource;
import com.ss.ttm.player.LoadControl;
import com.ss.ttm.player.MaskInfo;
import com.ss.ttm.player.MediaFormat;
import com.ss.ttm.player.MediaPlayer;
import com.ss.ttm.player.NativeAudioProcessor;
import com.ss.ttm.player.PlaybackParams;
import com.ss.ttm.player.SubInfo;
import com.ss.ttm.player.TTPlayerConfiger;
import com.ss.ttm.player.TraitObject;
import com.ss.ttvideoengine.TTVideoEngineMonitor;
import com.ss.ttvideoengine.VideoInfoCollector;
import com.ss.ttvideoengine.VideoModelCache;
import com.ss.ttvideoengine.abr.ABRPool;
import com.ss.ttvideoengine.abr.SegmentInfo;
import com.ss.ttvideoengine.configcenter.ConfigItemFactory;
import com.ss.ttvideoengine.configcenter.EngineConfig;
import com.ss.ttvideoengine.configcenter.IEngineConfig;
import com.ss.ttvideoengine.configcenter.OptionHolder;
import com.ss.ttvideoengine.configcenter.PlayerConfigExecutor;
import com.ss.ttvideoengine.database.VideoModelDBManager;
import com.ss.ttvideoengine.fetcher.FetcherMaker;
import com.ss.ttvideoengine.fetcher.SubInfoFetcher;
import com.ss.ttvideoengine.fetcher.VideoInfoFetcher;
import com.ss.ttvideoengine.fetcher.mdlfethcer.FetcherMakerNew;
import com.ss.ttvideoengine.fetcher.mdlfethcer.MDLFetcherListener;
import com.ss.ttvideoengine.info.HARInfo;
import com.ss.ttvideoengine.log.EngineInstanceHolder;
import com.ss.ttvideoengine.log.EventLoggerSource;
import com.ss.ttvideoengine.log.ExternVideoLoggerListener;
import com.ss.ttvideoengine.log.HeadsetStateMonitor;
import com.ss.ttvideoengine.log.IVideoEventLogger;
import com.ss.ttvideoengine.log.PortraitNetworkScore;
import com.ss.ttvideoengine.log.VideoEventBase;
import com.ss.ttvideoengine.log.VideoEventLoggerV2;
import com.ss.ttvideoengine.log.VideoEventManager;
import com.ss.ttvideoengine.log.VideoEventOneNoRender;
import com.ss.ttvideoengine.metrics.IMediaMetrics;
import com.ss.ttvideoengine.model.DubbedInfo;
import com.ss.ttvideoengine.model.IVideoInfo;
import com.ss.ttvideoengine.model.IVideoModel;
import com.ss.ttvideoengine.model.IntertrustDrmHelper;
import com.ss.ttvideoengine.model.VideoInfo;
import com.ss.ttvideoengine.model.VideoModel;
import com.ss.ttvideoengine.model.VideoRef;
import com.ss.ttvideoengine.net.DNSCompletionListener;
import com.ss.ttvideoengine.net.DNSParser;
import com.ss.ttvideoengine.net.NetUtils;
import com.ss.ttvideoengine.net.TTVNetClient;
import com.ss.ttvideoengine.playermetrcis.PlayerMetrics;
import com.ss.ttvideoengine.preloader.TTAVPreloaderItem;
import com.ss.ttvideoengine.selector.gracie.GracieSelector;
import com.ss.ttvideoengine.selector.shift.SpeedShiftConfig;
import com.ss.ttvideoengine.selector.strategy.GearStrategy;
import com.ss.ttvideoengine.selector.strategy.GearStrategyConfig;
import com.ss.ttvideoengine.selector.strategy.IGearStrategyListener;
import com.ss.ttvideoengine.setting.SettingsHelper;
import com.ss.ttvideoengine.source.strategy.CodecStrategyAdapter;
import com.ss.ttvideoengine.source.strategy.SmartUrlFetcher;
import com.ss.ttvideoengine.strategrycenter.StrategyCenter;
import com.ss.ttvideoengine.strategrycenter.StrategyHelper;
import com.ss.ttvideoengine.strategy.StrategyManager;
import com.ss.ttvideoengine.strategy.source.StrategySource;
import com.ss.ttvideoengine.superresolution.SRStrategy;
import com.ss.ttvideoengine.superresolution.SRStrategyConfig;
import com.ss.ttvideoengine.utils.DisplayMode;
import com.ss.ttvideoengine.utils.EngineException;
import com.ss.ttvideoengine.utils.EngineThreadPool;
import com.ss.ttvideoengine.utils.Error;
import com.ss.ttvideoengine.utils.FormatProvider;
import com.ss.ttvideoengine.utils.MDLExtraInfoHelper;
import com.ss.ttvideoengine.utils.PlayDurationManager;
import com.ss.ttvideoengine.utils.TTHelper;
import com.ss.ttvideoengine.utils.TTVideoEngineLog;
import com.ss.ttvideoengine.utils.TTVideoEngineUtils;
import com.ss.ttvideoengine.utils.TimeService;
import com.tencent.mm.opensdk.constants.ConstantsAPI;
import com.xs.fm.player.base.play.address.PlayAddress;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileReader;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import me.ele.lancet.base.annotations.Insert;
import me.ele.lancet.base.annotations.TargetClass;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class TTVideoEngineImpl extends TTVideoEngineInternal implements TTVideoEngineInterface {
    private static String mAppPath = null;
    private static boolean mIsFirstOpenEngine = true;
    private static Context mSettingConfig;
    private static FetcherMaker sFetcherMaker;
    private String currentHost;
    private Resolution currentResolution;
    public VideoInfo currentVideoInfo;
    private Map<Integer, String> dashAudioUrlMap;
    private Map<Resolution, String> dashVideoUrlMap;
    private Resolution expectedResolution;
    private Resolution lastResolution;
    public int mABRCurrentDownloadedAudioBitrate;
    public i mABRModule;
    private MaskInfo mAIBarrageInfoInterface;
    AIBarrageSimpleCallback mAIBarrageInfoListener;
    private String mAIBarrageUrl;
    public String mAPIString;
    private boolean mAsyncInitSR;
    private MediaPlayer mAsyncPlayer;
    private int mAutoRangeOffset;
    private String mBarrageMaskUrl;
    CacheFilePathListener mCacheFilePathListener;
    public CodecStrategyAdapter mCodecStrategyAdapter;
    private DNSParser mDNSParser;
    private int mDangerBufferThreshold;
    private DataSource mDataSource;
    private DisplayMode mDisplayMode;
    private VideoInfo mDynamicAudioInfo;
    private boolean mDynamicControlSR;
    private VideoInfo mDynamicVideoInfo;
    private int mEnableTextureRenderNoRenderCheck;
    private String mEngineHash;
    private TTVideoEngineMonitor mEngineStateMonitor;
    public final TTVideoEngine mEngineWrapper;
    private String mExternLogKey;
    ExternVideoLoggerListener mExternVideoLoggerListener;
    private String mFallbackAPI;
    private boolean mFetchWithAbilityOption;
    private VideoInfoFetcher mFetcher;
    public Handler mHandler;
    public Map<String, String> mHeaders;
    public HeadsetStateMonitor mHeadsetMonitor;
    private String mKeyseed;
    ListenerCompact mListenerCompact;
    private LoadControl mLoadControlInterface;
    public IVideoEventLogger mLogger;
    public TTVideoEngineLooperThread2 mLooperThread;
    private MDLFetcherListener mMDLFetcherListener;
    private String mMaskFileHash;
    private long mMaskFileSize;
    private MaskInfo mMaskInfoInterface;
    MaskInfoListener mMaskInfoListener;
    private TTVNetClient mNetClient;
    private OptionHolder mOptionHolder;
    private int mOverlayMode;
    private boolean mPlayBackUsedSR;
    private long mPlayStartTimestamp;
    PlayerEventSimpleListener mPlayerEventListener;
    private boolean mSRIgnoreRes;
    private int mSecureBufferThreshold;
    private SpeedShiftConfig mSpeedShiftConfig;
    private SubInfoFetcher mSubFetcher;
    SubInfoSimpleCallBack mSubInfoCallBack;
    private SubInfo mSubInfoInterface;
    SubInfoListener mSubInfoListener;
    private TTTestSpeedListener mTTSpeedListener;
    private Handler mTestNetSpeedHandler;
    private TestNetSpeedListener mTestNetSpeedListener;
    private Runnable mTestNetSpeedRunable;
    public int mTextureRenderError;
    private v mTextureRenderer;
    private String mTextureSRBinPath;
    private String mTextureSRDspModuleName;
    private String mTextureSROclModuleName;
    public VideoSurface mTextureSurface;
    private String[] mURLs;
    private int mUnsupportedSampleRatesInBinary;
    private boolean mUseFallbackAPI;
    private boolean mUseSRTexture;
    VideoEngineInfoListener mVideoEngineInfoListener;
    public String mVideoID;
    VideoInfoListener mVideoInfoListener;
    public IVideoModel mVideoModel;
    private VideoModelCache mVideoModelCache;
    private int mVideoModelVersion;
    private Map<String, IpInfo> urlIPMap;
    private Map<Resolution, Integer> urlIndexMap;
    private static Lock mCreatCacheFileLock = new ReentrantLock();
    private static u.b mTextureLogListenerExt = null;
    private static boolean mHasRegisterMdlProto = false;
    private static boolean mHasRegisterMdlProtoForExo = false;
    private static final Map<Surface, Boolean> mSurfaceHashMap = new ConcurrentHashMap(15);
    public static String mChipBoardName = null;
    private Set<Integer> mSettedKeys = new HashSet();
    private int mTestNetSpeedDiff = 500;
    private int mTestNetSpeed = -1;
    private int mPlayerCache = 0;
    private boolean mHttpsEnabled = false;
    private String mCodecType = "h264";
    public boolean mDashEnabled = false;
    private boolean mBashEnabled = false;
    private boolean mHLSSeamlessSwitch = false;
    private int mHlsEnabled = 0;
    private int mEncryptEnabled = 0;
    private boolean mDirectUrlBashEnabled = false;
    public boolean mIsDashSource = false;
    private boolean mHasSetHardWare = false;
    private boolean mUseServerDecodingMode = false;
    private boolean mHasSetAESrcLoudness = false;
    private boolean mHasSetAESrcPeak = false;
    private boolean mAEForbidCompressor = false;
    private int mSeekEndEnabled = 0;
    private int mAVSyncInterruptEnable = 0;
    private int mEnhancementType = 0;
    private int mScaleType = 0;
    private int mLayoutType = 0;
    private int mRenderType = 3;
    private int mRotation = 0;
    private boolean mIsMirrorHorizontal = false;
    private boolean mIsMirrorVertical = false;
    private int mForbidByteVC1SoftwareDecode = 1;
    private int mHardwareDropNonRef = 0;
    private int mP2PCDNType = 0;
    private int mForbidP2P = 0;
    private int mTestAction = 0;
    private int mDecoderType = 0;
    private int mOpenVoiceEarly = 0;
    private int mBufferDataMiliSeconds = 0;
    private int mNetworkTryCount = -1;
    public int mPlayAPIVersion = 0;
    public String mAuthorization = "";
    private String mSubAuthToken = "";
    private int mDisableAccurateStart = 0;
    private int mEnableSharp = 0;
    private int mEGLNeedWorkAround = 1;
    private int mOriginalRetry = 1;
    private int mStopCloseIO = 0;
    private int mAudioTrackContentType = -1;
    public int mMovPreferNearestSample = 0;
    private int mSkipFfmpegFindStreamInfo = 0;
    private int mMaxFps = 0;
    private int mEnableDynamicFrameDropping = 0;
    private int mFrameDroppingMultiple = 10;
    private int mFrameDroppingCheckPeriod = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
    private int mFrameDroppingCheckCount = 3;
    private int mHWMaxFps = 0;
    private int mHWEnableDynamicFrameDropping = 0;
    private int mHWFrameDroppingMultiple = 10;
    private int mHWFrameDroppingCheckPeriod = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
    private int mHWFrameDroppingCheckCount = 3;
    private int mEnableHWDropFrameWhenVOIsInDropState = 0;
    private int mEnableHWDropFrameWhenAVOutSyncing = 0;
    private int mCodecFramesDrop = -1;
    private int mFrameDropNum = 2;
    private int mKsyFrameWait = 1;
    private int mLoopReferVideo = 0;
    private int mSkipAudioGraph = 0;
    private int mMediaCodecRender = 1;
    private int mUseMediacodecAudio = 0;
    private int mNotifyBufferingDirectly = 0;
    private int mMediaCodecSkipNonRef = 0;
    private int mUseQcomLowLatency = 0;
    private int mUseQcomVpp = 0;
    private int mQcomVppLevel = -1;
    private int mEnableVolumeBalance = 0;
    private float mAEPreGain = 0.25f;
    private float mAEThreshold = -18.0f;
    private float mAERatio = 8.0f;
    private float mAEPredelay = 0.007f;
    private float mSrcLoudness = 0.0f;
    private float mSrcPeak = 0.0f;
    private float mTarLoudness = 0.0f;
    private float mReleaseTime = 200.0f;
    private float mLookAheadTime = 3.0f;
    private int mAEType = 0;
    private float mLuRange = 0.0f;
    private float mLuStart = 0.0f;
    private float mLuEnd = 0.0f;
    private float mMaxMomLu = 0.0f;
    private float mMaxShortermLu = 0.0f;
    private int mVolumInfoVer = 0;
    private int mDeviceAEPlayAbility = 0;
    private boolean mHasSetAEVolumeInfo = false;
    private String mAEConfigJson = "";
    private String mVolumeInfoJson = "";
    private String mAEGraphConfig = "";
    private boolean mClearShutDown = false;
    private int mAudioStreamType = -2;
    private int mAudioTrackSessionId = -1;
    private int mAudioChannelType = 0;
    private int mSeekMode = 0;
    private int mDisablePlayerTimeOut = 0;
    private int mEnableSeekInterrupt = 0;
    private int mMaxBufferDataMilliSeconds = 5000;
    private int mMediaCodecSyncMode = 0;
    private int mOutputLog = 0;
    private int mExposeSignal = 0;
    private int mBufferTimeout = 30;
    public int mNetworkTimeout = 5;
    public boolean mWaitForFetchInfoResult = true;
    private int mSpeedXDrop = 0;
    private float mSpeedXDropFPSLimit = 50.0f;
    private int mEnableLoadControlBufferingTimeout = 0;
    private int mEnableDebugUINotify = 0;
    private int mGetMasterClockByPts = 0;
    private int mAlwaysDoAVSync = 0;
    private int mEnableFallbackSWDec = 1;
    private int mAudioInfoId = -1;
    private int mEnableDeinterlace = 0;
    private int mTextureRenderForbidReuseVideoSurfaceTexture = 0;
    private int mTextureRenderForbidForbidReuseTexture = 0;
    private int mDecoderRenderVC2PreCreateRender = 0;
    private int mVC2LowerRenderCapacity = 0;
    private int mVC2LowerRenderCapacityNOSR = 0;
    private int mVC2DecodecLowLatency = 0;
    private int mVC2WppMode = 0;
    private int mVC2DynamicControl = 0;
    private int mAudioPtsMSCorrectionExtension = 0;
    private int mLowerAudioMemCapacity = 0;
    private int mVC2ThreadNum = 4;
    private int mSetPlayerSurfaceWithLock = 0;
    private int mEnableSurfaceHashmapJudgement = 0;
    private int mEnableTextureRenderNativeWindow = 0;
    private int mEnableFrameCallbackInRenderThread = 0;
    private int mEnableNotifyRenderException = 0;
    private boolean mHaveSetSpeedTest = false;
    private int mPlayType = 0;
    private SubDesInfoModelProvider mSubDesInfoModel = null;
    public VideoEngineGetInfoListener mVideoEngineGetInfoListener = null;
    private LinkedList<Pair<Surface, Integer>> mExtraSurfaceQueue = new LinkedList<>();
    private TTVideoEngineSurfaceCallback mSurfaceCallback = null;
    private long mPlayStartTime = -1;
    private long mRenderStartTime = -1;
    public long currentBitrate = -1;
    private int mStartupDowngradeType = 0;
    private Resolution mResolutionBeforeDowngrade = null;
    private String mQualityDescBeforeDowngrade = "";
    public long mLastSwitchResolutionTime = 0;
    private boolean mSeamSwitchingResolution = false;
    private boolean mResolutionSwitching = false;
    private long mResolutionSwitchingStartTime = 0;
    private boolean mHasFetchedSubtitle = false;
    private boolean mHasAudioFirstFrameShown = false;
    private int mStartTime = 0;
    private int mLoopStartTime = 0;
    private int mLoopEndTime = 0;
    private int mLoopCount = 0;
    private int mEnableOppoControl = 0;
    private int mReuseSocket = 0;
    private int mDrmType = 0;
    private int mDrmDowngrade = 0;
    private int mDrmCloseRootCheck = 0;
    private boolean mDrmRetry = true;
    private String mFileKey = null;
    private String mDecryptionKey = "";
    private String mSpadea = "";
    private String mTokenUrlTemplate = "";
    public String mGroupID = "";
    public boolean mIsPreloaderItem = false;
    private TTAVPreloaderItem mPreloaderItem = null;
    private String mSubLanIds = "";
    private String mSubIds = "";
    private String mSubFormat = "";
    private String mSubHostName = "";
    private String mSubVersions = "";
    private boolean mIsFeedInfo = false;
    private boolean mIsPlayItem = false;
    private TTVideoEnginePlayItem mPlayItem = null;
    private boolean mFirstURL = true;
    private boolean mFirstHost = true;
    private boolean mFirstIP = true;
    private boolean mFirstQuality = true;
    private boolean mFirstQualityType = true;
    private boolean mFirstResolution = true;
    private boolean mCacheControlEnabled = false;
    private boolean mIsPreDecodeAutoPause = true;
    private boolean mIsPrepareDecodeOnly = false;
    private boolean mOSPlayerIgnoreHeaders = false;
    private long mBufferingStartT = 0;
    private long mPauseStartT = 0;
    private FileDescriptor mPlayFd = null;
    private long mPipeOffset = 0;
    private long mPipeLength = 0;
    private IMediaDataSource mMediaDataSource = null;
    private boolean mUseDNSCache = false;
    private int mDNSExpiredTime = 0;
    private boolean mUseVideoModelCache = false;
    private boolean mUseVideoModelCacheForce = false;
    private int mIsUsePlayerDNS = -1;
    public boolean mIsFetchingInfo = false;
    public int mDataLoaderEnable = 0;
    private HashMap<String, Resolution> mResolutionMap = null;
    private boolean mIsUseBoe = false;
    private int mLimitMDLCacheSize = 0;
    public ArrayList<String> mUsingDataLoaderPlayTaskKeys = new ArrayList<>();
    public ArrayList<String> mUsingDataLoaderPlayFilePaths = new ArrayList<>();
    private String mUsingDataLoaderPlayRawKey = null;
    private boolean mAllowedExpiredModel = false;
    public int mIsDisableShortSeek = 0;
    private AudioProcessor mAudioProcessor = null;
    private int mAsyncSetAudioProcessor = 0;
    private TraitObjectManager mTraitObjManager = new TraitObjectManager();
    private int mUseTextureRender = 0;
    private int mCleanSurfaceWhenReset = 0;
    public int mFirstFrameOpenTexture = 0;
    public boolean mTextureFirstFrame = false;
    public boolean mPlayerFirstFrame = false;
    private String mTextureRenderErrorMsg = null;
    public boolean mDecodedVideoFirstFrame = false;
    private int mTextureSrOpen = 0;
    private TextureRenderStrategy mTRSrategy = new TextureRenderStrategy();
    private int mOldTextureAlgType = -1;
    private int mTextureAlgType = -1;
    private int mSrBackend = 0;
    private int mSrScaleType = 0;
    private int mSrPoolSize = 0;
    private String mProgramCacheDir = "";
    private int mUseBmfComponent = 0;
    private int mMaxTextureWidth = 0;
    private int mMaxTextureHeight = 0;
    private String mSRLibPath = "";
    private Bundle mLensBundle = null;
    private boolean mAsyncInitEffect = false;
    private boolean mEnableSRStrategy = false;
    public SRStrategy mSRStrategy = new SRStrategy();
    private int mEnableVideoFrameMetaCallback = 0;
    private int mNoAVSync = 0;
    private int mRenderHDR2SDR = 0;
    private int mSyncUpdateSurface = 0;
    private Queue<Bundle> mEffectBundle = new LinkedList();
    private Map<Integer, String> currentParams = null;
    private Map<Integer, String> expectedParams = null;
    private String mCurrentQuality = "";
    private String mCurrentQualityDesc = "";
    private int mCurrentQualityType = 0;
    private boolean mAsyncPlayHitVMCache = false;
    private boolean mIsUseServerDns = false;
    private int mUseAudioHWDec = 0;
    private int mDefaultRenderType = 3;
    private boolean mEnableHttps = false;
    private boolean mRetryEnableHttps = false;
    private boolean mCheckHijack = false;
    private boolean mHijackRetry = true;
    private int mHijackRetryCount = 0;
    private int mHijackRetryMainDNSType = 2;
    private int mHijackRetryBackupDNSType = 0;
    private String mCheckInfoString = null;
    private int mEnableFlushSeek = 0;
    private int mSoloPlayEnable = 1;
    private int mCurrentSubId = 0;
    private int mEnableOptSubLoadTime = 0;
    private int mEnableSubtitleSenseBuffering = 0;
    private int mEnableSubtitleLazyLoading = 0;
    private int mMaskDelayLoading = 0;
    private int mMaskEnableDataloader = 0;
    private int mMaskRangeOpt = 0;
    private int mMaskHeaderLen = 0;
    private int mEnablexHEAACSupport = 0;
    private int mDecodeAACThroughFDKAAC = 0;
    private int mEnableAudioSeekingNoAccurate = 0;
    private int mEnableSetPlayInfoToP2P = 1;
    private int mFirstRangeSize = 0;
    private int mNetSpeedLevel = -1;
    private int mSupportPlayWhenNoSurface = 0;
    public int mEnableGetPlayerReqOffset = 1;
    private boolean mShouldUseAudioRenderStart = false;
    public long mLastSetSurfaceNullTime = 0;
    public int mSetValidSurfaceTimeout = 0;
    private int mDelayBufferingUpdate = 0;
    private int mPostPrepare = 0;
    private int mStopSourceAsync = 0;
    private int mDisableHWDecSeamless = 0;
    private int mEnableVideoCodecPixelAlign = 0;
    private int mDisableMcReuse = 0;
    private int mCodecFrcLevel = 0;
    private int mPrepareCacheMs = 1000;
    private float mFirstFrameSecOffset = 0.0f;
    private int mEnableCacheTimeStamp = 0;
    private int mKeepFormatThreadAlive = 0;
    private int mSkipBufferTimeout = 0;
    private final long mSerial = System.currentTimeMillis();
    private int mCacheJFrameField = 0;
    private int mTimeBarPercentage = 0;
    private int mBestResolutionType = 0;
    private int mEnableIndexCache = 0;
    private int mEnableAsync = 0;
    private int mEnableFragRange = 0;
    private int mLazySeek = 1;
    private int mFFCodecerHeaacV2Compat = 0;
    private int mRangeMode = 0;
    private int mReadMode = 0;
    private int mUpdateTimestampMode = 1;
    private int mEnableOpenTimeout = 1;
    private int mSegmentFormatFlag = 2;
    private int mVideoRangeSize = 1048576;
    private int mAudioRangeSize = 409600;
    private int mVideoRangeTime = 5000;
    private int mAudioRangeTime = 10000;
    private int mSeekExact = 0;
    private int mEnableDirectUrlCheck = 0;
    private int mFindStreamInfoProbeSize = 5000000;
    private int mFindStreamInfoProbDuration = 0;
    private int mNetworkReconnectCount = 0;
    private int mDummyAudioSleep = 1;
    public long mVVTime = 0;
    public long mVideoPreloadSize = 0;
    public URLInfo mURLInfo = new URLInfo();
    private int mIsTTHlsDrm = 0;
    private String mTTHlsDrmToken = "";
    private int mVoiceType = -1;
    private int mAccurateLayout = 0;
    private int mFallbackApiRetry = 0;
    private boolean mEnableForceDisableOESRender = false;
    private boolean mForceDisableOESRender = false;
    private int mResumeFileIOBlockThresMs = 0;
    private int mUseCodecPool = 0;
    private int mNeedAdaptiveWorkaround = 0;
    private int mEnableClearMDLCache = 0;
    private int mEglVersion = 2;
    private int mStartupSwitchCSModel = -1;
    private int mStartupModel = -1;
    private long mStartUpBitrate = -1;
    private long mPredictStartBitrate = -1;
    private long mUserExpectedBitrate = -1;
    private long mDowngradeBitrate = -1;
    private long mMaxCacheBitrate = -1;
    private long mAbrStartupBitrateBeforeFitScreen = -1;
    private float mAbrStartUpSpeed = -1.0f;
    private float mAbrStartUpPredictSpeed = -1.0f;
    private float mAbrStartUpAverageSpeed = -1.0f;
    private float mAbrUserQualitySensitivity = -1.0f;
    private int mAbrUserEnterFullScreen = -1;
    public String mAbrVer = null;
    private String mNetVer = null;
    String mStartUpResolution = "";
    private String mAbrSrInfo = "";
    private String mAbrStartupInfo = "";
    private int mGearStrategyEnabled = 0;
    private GearStrategyConfig mGearStrategyConfig = new GearStrategyConfig();
    private Map mGearStrategyEvent = new HashMap();
    private int mEnableABR = 0;
    private boolean mABRUsed = false;
    private int mStandAlongAbrStartUp = 0;
    private int mABRTimerIntervalMilliseconds = 500;
    private int mABRSwitchMode = 0;
    private int mABRSwitchSensitivity = 0;
    private int mABRSwitchCSModel = 1;
    private int mABRStartupModel = 0;
    private int mABROnceType = 0;
    private int mABRFixedLevel = 2;
    private int mABRStartupSpeedType = 4;
    private int mABR4GMaxResolutionIndex = Resolution.Undefine.getIndex();
    private int mWifiDefaultResolutionIndex = Resolution.SuperHigh.getIndex();
    private int mStartupMaxBitRateIndex = Resolution.SuperHigh.getIndex();
    private int mABRWithSR = 1;
    private String mABR4GMaxResolutionQuality = null;
    private String mWifiDefaultResolutionQuality = null;
    private String mStartupMaxBitRateQuality = null;
    private String mClassLoaderState = null;
    private int mDowngradeResolutionIndex = Resolution.Undefine.getIndex();
    private String mDowngradeResolutionQuality = null;
    private int mNativeCallAbr = 0;
    private int mABR4GMaxResolutionMode = 0;
    private int mABRSpeedPredictOutType = 0;
    private float mABRStartupBandwidthParameter = 0.9f;
    private float mABRStallPenaltyParameter = 9.0f;
    private float mABRSwitchPenaltyParameter = 2.0f;
    private float mABRBandwidthParameter = 1.0f;
    private int mABRProbeMode = 0;
    private int mABREnableAggressivePortraitLowBit = 0;
    private int mScreenWidth = -1;
    private int mScreenHeight = -1;
    private int mPlayerViewWidth = -1;
    private int mPlayerViewHeight = -1;
    private int mDisablePlayerStayAwake = 0;
    private boolean mEnableSpeedReport = false;
    private float mNetworkSpeedReportSamplingRate = 0.0f;
    private int mEnableNativeYV12Render = 0;
    private int mForceCloseCodec = 0;
    private int mFilePlayNoBuffering = 0;
    private int mNoBufferUpdate = 0;
    private int mClipHEAACV2FirstPtsPacket = 0;
    private int mEnableVideoTimestampMonotonic = 0;
    private int mFeedPacketUntilEmpty = 0;
    private int mEnableDemuxNonBlockRead = 0;
    private int mEnableThreadPriority = 0;
    private int mThreadPriorityValue = 0;
    private int mEnableVodVideoRenderStall = 0;
    private int mRenderStallThreshold = 0;
    private int mEnableOptInaccurateStart = 0;
    private int mEnableOptSeekClk = 0;
    private int mEnableAudioTrackSmoothClock = 0;
    private int mDisableSpiltVoiceWrite = 0;
    private int mIgnoreDirectlyBuffering = 0;
    private int mDynamicThreadPriorityValue = 0;
    private int mEnableMediaCodecRealtime = 1;
    private int mEnablePreRenderBufferingUpdate = 0;
    private int mPreRenderBufferingUpdatePercentage = 0;
    private int mEnableHEAACV2PtsMSCorrection = 0;
    private int mEnableVC1BlockList = 1;
    private int mEnableHChipAdaptiveWorkAround = 0;
    private int mEnableMChipSkipAdaptiveWorkAround = 0;
    private int mEnableCPPBYTEVC1CodecOpt = 0;
    private boolean mQuickGetFileCache = false;
    private int mReportFirstFrameFrameBufferOnly = 0;
    private int mEnbalePreDemux = 0;
    private int mEnableCPPBYTEVC2CodecOpt = 0;
    private int mEnableAudioMemIntergration = 0;
    private int mEnableBufferingLowerCapacity = 0;
    private int mEnableDowngradeAsyncCodec = 0;
    private int mEnableMediaCodecSyncClose = 0;
    private int mEnableSeekBuffering = 0;
    private int mBytevc2NalsizeCheck = 0;
    private int mHardwareCodecerFlushClose = 0;
    private int mOptAudioRenderTimeReport = 0;
    private int mBT601CloseCodecAsync = 0;
    private int mForbidFallbackNativeRender = 0;
    private int mDecoderRenderContinueRetry = 0;
    private int mDecoderRenderClearSurface = 0;
    private int mDecoderRenderClearTextureRenderRef = 0;
    public int mEnableDecoderRenderVC2RenderLatency = 0;
    private int mDecoderRenderVC2RenderLatencyGeneral = 0;
    private int mDecoderRenderVC2RenderLatencySR = 0;
    protected String mTraceId = "";
    private boolean mEnableLooperThread = false;
    public HashMap<String, String> mBashDashDefaultMDLKeys = new HashMap<>();
    private String mSubPathInfo = null;
    private List<String> mFileHashs = new ArrayList();
    private int mReadCacheMode = 0;
    public int mEnableBarrageMask = 0;
    private int mEnableMaskThread = 0;
    private int mEnableAIBarrageThread = 0;
    public int mEnableAIBarrage = 0;
    private int mLiveStartIndex = -3;
    private int mEnableRefreshByTime = 0;
    public int mEnableSub = 0;
    private int mEnableSubThread = 0;
    private int mOpenSubRetryTimes = -1;
    private int mEnableOptSubSearch = 0;
    private int mEnableRecreateSubIfDetached = 0;
    public int mCurPosition = -1;
    private int mPosUpdateInterval = 0;
    public int mAudioCodecProfile = -1;
    public int mVideoCodecProfile = -1;
    private long mBitrate = -1;
    private float mContainerFPS = 0.0f;
    private int mThreadSafeRefSwitcher = 0;
    private int mEnableNetLevel = 0;
    private int mNetSpeedInterval = 0;
    private boolean mCloseRenderStartMsgOnSwitchResolutionDone = false;
    private int mEnableFastStop = 0;
    private int mEnableCodecRecycle = 0;
    private int mTlsLog = 0;
    public IntertrustDrmHelper mIntertrustDrmHelper = null;
    public int mFrameCount = 0;
    private boolean mHeartBeatStarted = false;
    private boolean mEnableHeartBeat = false;
    private boolean mGetPositionSkipLooper = false;
    private boolean mPlayDurationExcludePlayerMethod = false;
    private int mHeartBeatInterval = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
    private int mSRNotUseReason = 0;
    private long mSendEngineMsgTimeout = 0;
    private int mMediacodecStopTimeout = 0;
    private int mQueryWinEnable = -1;
    private int mPreferNearestMaxPosOffset = -1;
    private int mMediaCodecAsyncModeEnable = -1;
    private int mSettingCodecName = -1;
    private ArrayList<String> mPrivCodecName = new ArrayList<>();
    private int mAVsyncRefined = -1;
    private int mOnlyPlayAudioForBothStream = -1;
    private int mIgnoreSurfaceCreated = -1;
    private int mNativeRenderRotationAdapt = 0;
    private boolean mEnableOutletDropLimit = false;
    private int mPreciseCache = 0;
    private Map<String, Object> mMediaInfoMap = new ConcurrentHashMap();
    private int mEnableClockResumeResetEof = 0;
    private int mMdlEnableSeekReopen = 0;
    private int mIgnoreAudioRenderEOSDelayMs = 0;
    private int mAutoAddMedia = 1;
    private int mEnableOptimizeMp4Abr = 0;
    private int mEnableMediaCodecFairMutex = 0;
    private int mEnableRangeOptimize = 0;
    private int mThreadName2CharSuffix = 0;
    private int mEnableOptimizePrerender = 0;
    private int mEnableAsyncDownload = 0;
    public int mEnablePreloadGear = 0;
    private int mEnableAsyncProbe = 0;
    private int mEnableOptimizeAsyncDownload = 0;
    private int mMetrcisAbility = 0;
    private int mMetrcisInterVal = 60;
    private int mEnableCacheInfo = 0;
    private int mEnableOptimizeRadioMode = 0;
    private int mEnableOptimizeIO = 0;
    private int mEnableOptimizeDashSeek = 0;
    private int mAnRenderRefreshSurface = 0;
    private Surface mSurfaceRecord = null;
    private TTVideoEngineFFmpegProtocol mFFmpegProtocol = null;
    private String mForceCodec = null;
    private boolean mSkipStartWhenPrepared = false;
    private int mEnableMp4Check = 0;
    private long mPrecisePausePts = 0;
    private int mHlsSubDemuxerProbeType = -1;
    public int mEnableTmpLog = 0;
    private int mCodecAndSurfaceReuse = -1;
    private int mMCMaxWidth = -1;
    private int mMCMaxHeight = -1;
    private int mAsyncManageResource = -1;
    private int mAudioUseDirectBuffer = -1;
    private int mCloseCodecPool = -1;
    private int mMaxCodecNumsInPool = -1;
    private int mDummySurfaceForbid = -1;
    private int mCalibrationAudioPts = -1;
    private int mAudioPtsCalibrationType = -1;
    private int mSetSurfaceRetryCount = -1;
    private int mSetSurfaceRetryInterval = -1;
    private int mChangeRecBufferSpeed = -1;
    private int mEnableVideoSecondFrame = -1;
    private int mGiveBackCodecEarly = -1;
    private int mWaitingCodecMs = -1;
    private int mAsyncSetWindow = -1;
    private int mAutoDisconnectedCpu = -1;
    private int mForbidBufferingNotFinished = -1;
    private int mUseVdpDisk = -1;
    private int mEnableReportFirstAVSyncFrame = 1;
    private int mQueryAdaptivePlayback = -1;
    private int mFlushWhenSetSurface = -1;
    private int mEnableMediaCodecDeathCheck = -1;
    private int mMediaCodecDeathCheckInterval = -1;
    private int mMediaCodecDeathTimeout = -1;
    private int mCodecPoolSupportDynamicExtend = -1;
    private int mDynamicExtendCodecNums = -1;
    private int mEnableOptimizeHWDec2SWDec = -1;
    private int mCreateAudioTrackEarly = -1;
    private int mEnableMediaCodecPipeline = -1;
    private int mFrameNumsInMediaCodec = -1;
    private int mEnableMCRenderHandleSAR = -1;
    private int mRecBufferThresh = -1;
    private int mRecBufferType = -1;
    private int mUserExitTimeMs = -1;
    private int mAudioGraphRefactor = -1;
    private int mAudioDecoderGraphMerged = -1;
    private int mCodecPoolVersion = -1;
    private int mDiscardCodecStrategy1 = -1;
    private int mDiscardCodecStrategy2 = -1;
    private int mCodecHistoryLength = -1;
    private int mCodecMaxUsedCount = -1;
    private int mEngineRetryNotify = -1;
    private int mEnableFallbackInMaxInstanceErr = -1;
    private int mSetSurfaceDirectly = -1;
    private int mEnableStartPlaySync = -1;
    private int mEnableClearTextureRefAsync = 0;
    private boolean mEnableSetupMediaCodec = false;
    private boolean mRefreshSurfaceFlag = false;
    private boolean mRefreshSurfaceDone = false;
    private boolean mRefreshTextureSurface = false;
    private Set<Integer> effectTypeSet = new CopyOnWriteArraySet();
    public boolean mEnableReportPreloadTraceId = false;
    private boolean mErrorThrowOptEnable = false;
    public String mMDLGroupId = null;
    private String mInitialUrlBeforeMdlProxy = null;
    private boolean mBashRetryRestartPlayer = false;

    private void initEngine(Context context, int i, Map map) {
        com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_initEngine(this, context, i, map);
    }

    public static void setNativeMDLRegister() {
        mHasRegisterMdlProto = true;
    }

    void _doPlay() {
        com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_doPlay(this);
    }

    void _doPrepare() {
        com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop__doPrepare(this);
    }

    void _doReleaseAsync() {
        com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_doReleaseAsync(this);
    }

    public void _playInternal(String str, Map map) {
        com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop__playInternal(this, str, map);
    }

    @Override
    protected MediaPlayer createMediaPlayer() {
        return com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_createMediaPlayer(this);
    }

    public void fetchedVideoInfo(IVideoModel iVideoModel) {
    }

    @Override
    public void setDefaultFileCacheDir(String str) {
    }

    @Override
    public void setFileCacheDir(String str) {
    }

    @Override
    public void setStrategySource(StrategySource strategySource) {
    }

    public static class MyTextureLogListenerExt implements u.b {
        private MyTextureLogListenerExt() {
        }

        MyTextureLogListenerExt(AnonymousClass1 anonymousClass1) {
            this();
        }

        @Override
        public void d(String str, String str2) {
            TTVideoEngineLog.d(str, str2);
        }

        @Override
        public void e(String str, String str2) {
            TTVideoEngineLog.e(str, str2);
        }

        @Override
        public void i(String str, String str2) {
            TTVideoEngineLog.i(str, str2);
        }

        @Override
        public void k(String str, String str2) {
            TTVideoEngineLog.k(str, str2);
        }

        @Override
        public void t(String str, String str2) {
            TTVideoEngineLog.t(str, str2);
        }

        @Override
        public void w(String str, String str2) {
            TTVideoEngineLog.w(str, str2);
        }
    }

    @Override
    public boolean getCacheControlEnabled() {
        return this.mCacheControlEnabled;
    }

    @Override
    public Context getContext() {
        return this.mContext;
    }

    @Override
    public String getCurrentQualityDesc() {
        return this.mCurrentQualityDesc;
    }

    @Override
    public Resolution getCurrentResolution() {
        return this.currentResolution;
    }

    @Override
    public String getDirectUrl() {
        return this.mDirectURL;
    }

    @Override
    public GearStrategyConfig getGearStrategyEngineConfig() {
        return this.mGearStrategyConfig;
    }

    @Override
    public String getHash() {
        return this.mEngineHash;
    }

    @Override
    public IVideoModel getIVideoModel() {
        return this.mVideoModel;
    }

    @Override
    public IVideoEventLogger getLogger() {
        return this.mLogger;
    }

    @Override
    public MediaPlayer getMediaPlayer() {
        return this.mMediaPlayer;
    }

    @Override
    public boolean getMirrorHorizontal() {
        return this.mIsMirrorHorizontal;
    }

    @Override
    public boolean getMirrorVertical() {
        return this.mIsMirrorVertical;
    }

    @Override
    public int getPlayAPIVersion() {
        return this.mPlayAPIVersion;
    }

    @Override
    public String getQualityDescBeforeDowngrade() {
        return this.mQualityDescBeforeDowngrade;
    }

    @Override
    public Resolution getResolutionBeforeDowngrade() {
        return this.mResolutionBeforeDowngrade;
    }

    @Override
    public int getRotation() {
        return this.mRotation;
    }

    @Override
    public String getSubTag() {
        return this.mSubTag;
    }

    @Override
    public String getTag() {
        return this.mTag;
    }

    @Override
    public VideoSurface getTextureSurface() {
        return this.mTextureSurface;
    }

    @Override
    public String getTraceId() {
        return this.mTraceId;
    }

    @Override
    public String getVideoID() {
        return this.mVideoID;
    }

    @Override
    public boolean isDashSource() {
        return this.mIsDashSource;
    }

    @Override
    public boolean isPrepared() {
        return this.mPrepared;
    }

    @Override
    public boolean isReleased() {
        return this.mReleased;
    }

    public TTVideoEngineImpl(Context context, int i, Map map, TTVideoEngine tTVideoEngine) {
        this.mEngineWrapper = tTVideoEngine;
        if (EngineGlobalConfig.getInstance().getLazyLoadVideodec() != 1) {
            TTVideoEngineLog.d(logcatTag(), "JniUtils.loadLibrary in TTVideoEngineImpl new");
            JniUtils.loadLibrary();
        }
        TTVideoEngineLog.i(logcatTag(), "init2, type:" + i + ", this:" + this + ", version:1.10.158.101-novel");
        initEngine(context, i, map);
    }

    public void TTVideoEngineImpl___playInternal$___twin___(String str, Map<String, String> map) {
        int i;
        String str2;
        IVideoModel iVideoModel;
        String str3;
        String jSONObject;
        IVideoModel iVideoModel2;
        String str4;
        VideoInfo videoInfo;
        VideoInfo videoInfo2;
        int i2;
        char c2;
        VideoInfo videoInfo3;
        VideoInfo videoInfo4;
        AudioProcessor audioProcessor;
        int i3;
        if (this.mConfigCenterVersion > 0) {
            _playInternal2(str, map);
            return;
        }
        TTVideoEngineLog.d(logcatTag(), "_playInternal url=" + str + " mUseTextureRender=" + this.mUseTextureRender + " mUseSRTexture=" + this.mUseSRTexture);
        if (this.mEnableSetPlayInfoToP2P == 1 && !TTVideoEngineHelper.isMayUseP2P(str)) {
            this.mEnableSetPlayInfoToP2P = 0;
            TTVideoEngineLog.d(logcatTag(), "not may use p2p, change enablesetplayinfo to 0, url" + str);
        }
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_playInternal should stop");
            return;
        }
        if (this.mMediaPlayer != null && needReleaseMediaPlayer()) {
            releaseMediaPlayer();
        }
        _logFirstURL(this.mURLInfo.hostURL);
        if ((this.mUseTextureRender != 0 || this.mUseSRTexture || !this.mEffectBundle.isEmpty() || this.mTRSrategy.isInitForEffect(1)) && this.mTextureSurface == null && ((i = this.mVC2LowerRenderCapacity) <= 0 || (i > 0 && (!this.mEffectBundle.isEmpty() || this.mTextureSrOpen > 0)))) {
            if (this.mFirstFrameOpenTexture == 1) {
                final Looper looper = TTHelper.getLooper();
                EngineThreadPool.addExecuteTask(new Runnable() {
                    @Override
                    public final void run() {
                        TTVideoEngineImpl.this.lambda$_playInternal$7$TTVideoEngineImpl(looper);
                    }
                });
            } else {
                setupTextureRender();
            }
            if ((this.mVC2DynamicControl & 1) == 1 && this.mRenderType == 5 && this.mTextureSurface != null) {
                this.mRenderType = 0;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, this.mRenderType);
                }
            }
        } else {
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null && this.mUseSRTexture && (videoSurface.getIntOption(10) == 0 || ((i3 = this.mOldTextureAlgType) != -1 && i3 != this.mTextureAlgType))) {
                initSr(this.mTextureSurface);
            } else if (this.mVC2LowerRenderCapacityNOSR > 0) {
                this.mRenderType = 5;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, this.mRenderType);
                }
            }
        }
        boolean z = isSupportSeamlessSwitch(str) || isSupportSeamlessSwitch(this.mVideoModel);
        updateConfigParams(this.mConfigParams);
        IVideoModel iVideoModel3 = this.mVideoModel;
        if (iVideoModel3 != null) {
            String dynamicType = iVideoModel3.getDynamicType();
            if (!TextUtils.isEmpty(dynamicType) && dynamicType.equals("segment_base") && this.mVideoModelVersion == 3) {
                this.mBashEnabled = true;
                this.mEngineConfig.setIntOption(33, 1);
            }
        }
        if (FeatureManager.isLicenseExpired()) {
            fallbackOSPlayer();
        }
        _configHardwareDecode();
        if (this.mMediaPlayer == null) {
            MediaPlayer mediaPlayer = this.mAsyncPlayer;
            if (mediaPlayer != null) {
                this.mMediaPlayer = mediaPlayer;
                this.mAsyncPlayer = null;
            } else {
                this.mEnableSetupMediaCodec = false;
                this.mMediaPlayer = createMediaPlayer();
            }
            if (this.mMediaPlayer == null) {
                _notifyError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9993, "create player failed"));
                return;
            }
            if (!isInHousePlayer() && (audioProcessor = this.mAudioProcessor) != null && !NativeAudioProcessor.isNativeAudioProcessor(audioProcessor)) {
                this.mAudioProcessor.audioRelease(1);
                this.mAudioProcessor = null;
            }
            if (this.mDashEnabled && !isInHousePlayer() && this.mDrmType != 2) {
                receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "dash not supported"));
                return;
            }
            boolean z2 = this.mBashEnabled && str != null && str.startsWith("mem://bash");
            if ((z2 || this.mCodecType.equals("bytevc1") || this.mCodecType.equals("bytevc2") || this.mHttpsEnabled) && this.mMediaPlayer != null && isOSPlayer()) {
                receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "create os player failed"));
                return;
            }
            if ((z2 || this.mCodecType.equals("bytevc2")) && this.mMediaPlayer != null && isPlayerType(5)) {
                receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "create exoplayer failed"));
                return;
            }
            if ((this.mDashEnabled || z2 || this.mCodecType.equals("bytevc1") || this.mCodecType.equals("bytevc2") || this.mHttpsEnabled) && this.mMediaPlayer != null && (this.mMediaPlayer.getPlayerType() == 3 || this.mMediaPlayer.getPlayerType() == 4)) {
                receivedError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9989, "create own plugin player failed"));
                return;
            }
            int i4 = this.mOverlayMode;
            if ((i4 == 2 || i4 == 4) && this.mMediaPlayer.getPlayerType() != 1 && this.mMediaPlayer.getPlayerType() != 2) {
                receivedError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9993, "osplayer don't support overlay"));
                return;
            }
            this.mPlayerType = transMediaPlayerType(this.mMediaPlayer);
            setMediaPlayerOptions();
            registerListenerMediaPlayer();
            if ((this.mMediaPlayer instanceof MediaPlayerWrapper) && this.mLoadControlInterface != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setLoadControl(this.mLoadControlInterface);
            }
            if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
                i iVar = this.mABRModule;
                long b2 = (iVar == null || this.mNativeCallAbr <= 0) ? 0L : iVar.b(55, -1L);
                if (b2 > 0 && b2 == this.mMediaPlayer.getIntOption(831, -1)) {
                    ABRStrategy e = this.mABRModule.e();
                    ((MediaPlayerWrapper) this.mMediaPlayer).setABRStrategy(e);
                    e.release();
                } else {
                    ((MediaPlayerWrapper) this.mMediaPlayer).setABRStrategy(new MyABRStrategy());
                }
            }
            this.mPrepared = false;
        } else if (this.mError != null || this.mSeamSwitchingResolution) {
            TTVideoEngineLog.i(logcatTag(), "mediaPlayer reset, surface holder:" + this.mSurfaceHolder + ", surace:" + this.mSurface);
            _updateLogger();
            if (this.mSeamSwitchingResolution && this.mError == null) {
                this.mLogger.accumulateSize();
            }
            this.mMediaPlayer.reset();
            this.mPrepared = false;
            this.mError = null;
            this.mMediaPlayer.setIntOption(133, 0);
            this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, 0);
        } else {
            this.mMediaPlayer.setIntOption(1301, 0);
        }
        _tryRegisterMdlHandle(this.mMediaPlayer);
        this.mLogger.setIntOption(92, this.mEnableThreadPriority);
        if (z) {
            this.mMediaPlayer.setIntOption(132, 1);
            this.mMediaPlayer.setIntOption(287, 1);
            this.mMediaPlayer.setIntOption(172, this.mEnableABR);
            this.mMediaPlayer.setIntOption(678, this.mABRProbeMode);
            this.mABRUsed = this.mEnableABR == 1 || this.mABRUsed;
        }
        String logcatTag = logcatTag();
        StringBuilder sb = new StringBuilder();
        sb.append("AIBarrage: Thread switcher on: ");
        sb.append(this.mEnableAIBarrageThread >= 1 ? 1 : 0);
        sb.append(", barrageInterface exist: ");
        sb.append(this.mAIBarrageInfoInterface != null ? 1 : 0);
        TTVideoEngineLog.i(logcatTag, sb.toString());
        if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
            if (this.mEnableMaskThread > 0 && this.mMaskInfoInterface != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setMaskInfo(this.mMaskInfoInterface);
            }
            if (this.mEnableAIBarrageThread > 0 && this.mAIBarrageInfoInterface != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setAIBarrageInfo(this.mAIBarrageInfoInterface);
            }
            if (this.mEnableSubThread > 0 && this.mSubInfoInterface != null) {
                TTVideoEngineLog.d(logcatTag(), "subtitle: set mSubInfoInterface to mMediaPlayer");
                ((MediaPlayerWrapper) this.mMediaPlayer).setSubInfo(this.mSubInfoInterface);
            } else {
                TTVideoEngineLog.d(logcatTag(), "subtitle: no valied mSubInfoInterfaceset to MediaPlayer");
            }
        }
        if (this.mVideoModel != null) {
            if (!this.mHasSetAESrcLoudness) {
                if (this.mDashEnabled && (videoInfo4 = this.mDynamicAudioInfo) != null) {
                    this.mSrcLoudness = videoInfo4.getValueFloat(39);
                } else {
                    VideoInfo videoInfo5 = this.currentVideoInfo;
                    if (videoInfo5 != null) {
                        this.mSrcLoudness = videoInfo5.getValueFloat(39);
                    }
                }
                if (this.mSrcLoudness == 0.0f) {
                    this.mSrcLoudness = this.mVideoModel.getVideoRefFloat(224);
                }
            }
            if (!this.mHasSetAESrcPeak) {
                if (this.mDashEnabled && (videoInfo3 = this.mDynamicAudioInfo) != null) {
                    this.mSrcPeak = videoInfo3.getValueFloat(40);
                } else {
                    VideoInfo videoInfo6 = this.currentVideoInfo;
                    if (videoInfo6 != null) {
                        this.mSrcPeak = videoInfo6.getValueFloat(40);
                    }
                }
                if (this.mSrcPeak == 0.0f) {
                    this.mSrcPeak = this.mVideoModel.getVideoRefFloat(225);
                }
            }
            if (!this.mHasSetAEVolumeInfo) {
                this.mLuRange = this.mVideoModel.getVideoRefFloat(252);
                this.mLuStart = this.mVideoModel.getVideoRefFloat(247);
                this.mLuEnd = this.mVideoModel.getVideoRefFloat(248);
                this.mMaxMomLu = this.mVideoModel.getVideoRefFloat(249);
                this.mMaxShortermLu = this.mVideoModel.getVideoRefFloat(250);
                this.mVolumInfoVer = this.mVideoModel.getVideoRefInt(251);
                this.mVolumeInfoJson = this.mVideoModel.getVideoRefStr(260);
            }
            if (this.mAEForbidCompressor && this.mSrcLoudness == 0.0f && this.mSrcPeak == 0.0f) {
                this.mEnableVolumeBalance = 0;
            }
        }
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.useHardwareDecode(this.mHardwareDecodeEnablePlayer2);
            this.mLogger.enableStartPlayAutomatically(this.mIsStartPlayAutomatically);
            this.mLogger.setIntOption(24, this.mBufferTimeout);
            this.mLogger.setFramesDropNum(this.mFrameDropNum);
            this.mLogger.useCodecPool(this.mUseCodecPool);
            this.mLogger.useAsyncInit(this.mAsyncInitEnable, this.mCodecId);
            this.mLogger.setMediaCodecRender(this.mMediaCodecRender);
            this.mLogger.setIntOption(16, this.mUseMediacodecAudio);
            if (!this.mSeamSwitchingResolution) {
                this.mLogger.setIntOption(26, this.mNotifyBufferingDirectly);
            }
            this.mLogger.setIntOption(27, this.mBufferDataMiliSeconds);
            this.mLogger.setIntOption(29, this.mEnableVolumeBalance);
            this.mLogger.setIntOption(54, this.mAEType);
            this.mLogger.setIntOption(32, this.mHardwareDropNonRef);
            if (this.mHttpsEnabled) {
                this.mLogger.setIntOption(33, 1);
            }
            if (this.mPosUpdateInterval > 0) {
                this.mLogger.setIntOption(35, 1);
            }
            if (this.mLoadControlInterface != null) {
                this.mLogger.setIntOption(36, 1);
            }
            this.mLogger.setIntOption(37, this.mRenderType);
            this.mLogger.setIntOption(38, this.mScaleType);
            this.mLogger.setIntOption(39, this.mVoiceType);
            this.mLogger.setIntOption(40, this.mSkipFfmpegFindStreamInfo);
            this.mLogger.setIntOption(41, this.mPostPrepare);
            this.mLogger.setIntOption(42, this.mCodecFrcLevel);
            this.mLogger.setIntOption(44, this.mKeepFormatThreadAlive);
            this.mLogger.setIntOption(47, this.mEnableSubThread);
            this.mLogger.setIntOption(49, this.mEnableSub);
            this.mLogger.setIntOption(46, this.mEnableMaskThread);
            this.mLogger.setIntOption(48, this.mEnableBarrageMask);
            if (this.mEnableLooperThread) {
                this.mLogger.setIntOption(30, 1);
            }
            int i5 = this.mMdlEnableSeekReopen;
            if (i5 > 0) {
                this.mLogger.addFeature("mdl_seek_reopen", Integer.valueOf(i5));
            }
            this.mLogger.setIntOption(143, this.mMaskRangeOpt);
            this.mLogger.setIntOption(144, this.mMaskEnableDataloader);
            this.mLogger.setIntOption(145, this.mMaskDelayLoading);
            VideoInfo videoInfo7 = this.currentVideoInfo;
            if (videoInfo7 != null) {
                this.mLogger.setStringOption(152, videoInfo7.getValueStr(15));
            }
            VideoInfo videoInfo8 = this.mDynamicAudioInfo;
            if (videoInfo8 != null) {
                this.mLogger.setStringOption(153, videoInfo8.getValueStr(15));
            }
        }
        resetMediaPlayerOptions();
        _sendMdlCacheMsg();
        if (!this.mPrepared && ((this.mMediaPlayer.getPlayerType() == 1 || this.mMediaPlayer.getPlayerType() == 2 || this.mMediaPlayer.getPlayerType() == 3 || this.mMediaPlayer.getPlayerType() == 4) && this.mIsPreloaderItem && this.mPreloaderItem != null)) {
            this.mMediaPlayer.setIntOption(14, 1);
            this.mMediaPlayer.setStringOption(17, this.mPreloaderItem.mFileKey);
            this.mMediaPlayer.setCacheFile(this.mPreloaderItem.mFilePath, 1);
            this.mMediaPlayer.setIntOption(18, 20);
        }
        if (!this.mIsLocal && !this.mIsDirectURL && !this.mIsPlayItem && !this.mIsPreloaderItem && this.mDrmType != 2 && (videoInfo2 = this.currentVideoInfo) != null) {
            int mediatype = videoInfo2.getMediatype();
            int valueInt = this.currentVideoInfo.getValueInt(3);
            String valueStr = this.currentVideoInfo.getValueStr(31);
            int i6 = (getConfigInt(313, this.mCheckHijack ? 1 : 0) != 1 || TextUtils.isEmpty(valueStr)) ? 0 : 1;
            boolean _isDashSource = _isDashSource(this.currentVideoInfo);
            this.mIsDashSource = _isDashSource;
            this.mDashEnabled = _isDashSource;
            this.mEngineConfig.setIntOption(17, this.mIsDashSource ? 1 : 0);
            if (this.mEnableTmpLog == 1) {
                showLongLog("brian set bitrate:" + valueInt + ", to player, resolution:" + this.currentVideoInfo.getValueStr(7));
            }
            if (z) {
                long j = this.mPredictStartBitrate;
                if (j > 0) {
                    valueInt = (int) j;
                    this.mPredictStartBitrate = -1L;
                }
                this.mMediaPlayer.setIntOption(mediatype == VideoRef.TYPE_VIDEO ? 130 : 131, valueInt);
                if (i6 != 0) {
                    this.mMediaPlayer.setStringOption(mediatype != VideoRef.TYPE_VIDEO ? 203 : 202, valueStr);
                }
            } else if (i6 != 0) {
                this.mMediaPlayer.setStringOption(202, valueStr);
            }
            this.mMediaPlayer.setIntOption(246, this.mHijackRetryCount > 0 ? 0 : 1);
            this.mLogger.setCheckHijack(i6);
            this.mLogger.setHijackRetry(this.mHijackRetry ? 1 : 0);
            if (this.mHardwareDecodeEnablePlayer2 == 1) {
                int i7 = this.mCodecId;
                String valueStr2 = this.currentVideoInfo.getValueStr(8);
                if (!TextUtils.isEmpty(valueStr2)) {
                    valueStr2.hashCode();
                    switch (valueStr2.hashCode()) {
                        case 3148040:
                            if (valueStr2.equals("h264")) {
                                c2 = 0;
                                break;
                            }
                            c2 = 65535;
                            break;
                        case 355428636:
                            if (valueStr2.equals("bytevc1")) {
                                c2 = 1;
                                break;
                            }
                            c2 = 65535;
                            break;
                        case 355428637:
                            if (valueStr2.equals("bytevc2")) {
                                c2 = 2;
                                break;
                            }
                            c2 = 65535;
                            break;
                        default:
                            c2 = 65535;
                            break;
                    }
                    switch (c2) {
                        case 0:
                            i2 = 0;
                            break;
                        case 1:
                            i2 = 1;
                            break;
                        case 2:
                            i2 = 33;
                            break;
                    }
                    TTVideoEngineLog.i(logcatTag(), "videoInfo codec id = " + i2);
                    this.mMediaPlayer.setIntOption(182, i2);
                    this.mLogger.useAsyncInit(this.mAsyncInitEnable, i2);
                }
                i2 = i7;
                TTVideoEngineLog.i(logcatTag(), "videoInfo codec id = " + i2);
                this.mMediaPlayer.setIntOption(182, i2);
                this.mLogger.useAsyncInit(this.mAsyncInitEnable, i2);
            }
        } else {
            if (this.mIsDirectURL) {
                String configString = getConfigString(662, this.mCheckInfoString);
                int i8 = (getConfigInt(313, this.mCheckHijack ? 1 : 0) != 1 || TextUtils.isEmpty(configString)) ? 0 : 1;
                if (i8 != 0) {
                    this.mMediaPlayer.setStringOption(202, configString);
                    this.mMediaPlayer.setIntOption(246, this.mHijackRetryCount > 0 ? 0 : 1);
                    this.mLogger.setCheckHijack(i8);
                    this.mLogger.setHijackRetry(this.mHijackRetry ? 1 : 0);
                }
            }
            this.mDashEnabled = false;
            this.mEngineConfig.setIntOption(17, 0);
            this.mIsDashSource = false;
        }
        if (!this.mPrepared) {
            if ((this.mIsLocal || this.mIsDirectURL) && !TextUtils.isEmpty(this.mDecryptionKey)) {
                this.mLogger.setEncryptKey(this.mDecryptionKey);
                if ((this.mDataLoaderEnable == 0 || DataLoaderHelper.getDataLoader().getIntValue(9009) == 0) && (this.mMediaPlayer.getPlayerType() == 0 || this.mMediaPlayer.getPlayerType() == 5)) {
                    receivedError(Error.createForPlayer(this.mMediaPlayer, -9987, "Player can't decode encryted video"));
                    return;
                }
                this.mMediaPlayer.setStringOption(64, this.mDecryptionKey);
            }
            if (this.mDashEnabled) {
                IVideoModel iVideoModel4 = this.mVideoModel;
                if (iVideoModel4 != null) {
                    str4 = iVideoModel4.getSpadea();
                    if (!TextUtils.isEmpty(str4)) {
                        this.mLogger.setEncryptKey(str4);
                        if ((this.mDataLoaderEnable == 0 || DataLoaderHelper.getDataLoader().getIntValue(9009) == 0) && ((this.mMediaPlayer.getPlayerType() == 0 || this.mMediaPlayer.getPlayerType() == 5) && this.mDrmType != 2)) {
                            receivedError(Error.createForPlayer(this.mMediaPlayer, -9987, "Player can't decode encryted video"));
                            return;
                        }
                        this.mMediaPlayer.setStringOption(144, str4);
                    }
                }
                str4 = null;
                if (!TextUtils.isEmpty(str4)) {
                }
            } else {
                if (!this.mIsLocal && !this.mIsPlayItem && !this.mIsPreloaderItem && !this.mIsDirectURL && (videoInfo = this.currentVideoInfo) != null && !TextUtils.isEmpty(videoInfo.getValueStr(5))) {
                    str4 = this.currentVideoInfo.getValueStr(5);
                } else {
                    if (!TextUtils.isEmpty(this.mSpadea)) {
                        str4 = this.mSpadea;
                    }
                    str4 = null;
                }
                if (!TextUtils.isEmpty(str4)) {
                }
            }
        }
        try {
            TTVideoEngineLog.d(logcatTag(), "set screen on");
            this.mMediaPlayer.setScreenOnWhilePlaying(true);
            this.mMediaPlayer.setLooping(this.mLooping);
            this.mLogger.setLooping(this.mLooping);
            if (this.mPlayFd != null) {
                this.mMediaPlayer.setDataSource(this.mPlayFd, this.mPipeOffset, this.mPipeLength);
            } else if (this.mMediaDataSource != null) {
                this.mMediaPlayer.setDataSource(this.mMediaDataSource);
            } else {
                Map<String, String> hashMap = map == null ? new HashMap<>() : map;
                VideoInfo videoInfo9 = this.currentVideoInfo;
                int calculateSizeBySecond = (videoInfo9 == null || videoInfo9.getBitrateFitterInfo() == null) ? 0 : this.currentVideoInfo.getBitrateFitterInfo().calculateSizeBySecond(this.mFirstFrameSecOffset);
                if (calculateSizeBySecond > 0) {
                    hashMap.put("X-PCDN-FRange-Sec", Float.toString(this.mFirstFrameSecOffset));
                    hashMap.put("X-PCDN-FRange-Size", Integer.toString(calculateSizeBySecond));
                    this.mLogger.setIntOption(59, calculateSizeBySecond);
                } else {
                    int i9 = this.mFirstRangeSize;
                    if (i9 > 0) {
                        hashMap.put("X-PCDN-FRange-Size", Integer.toString(i9));
                        this.mLogger.setIntOption(59, this.mFirstRangeSize);
                    }
                }
                VideoInfo videoInfo10 = this.currentVideoInfo;
                if (videoInfo10 != null && videoInfo10.mSize > 0) {
                    hashMap.put("X-VideoModel-FSize", Long.toString(this.currentVideoInfo.mSize));
                }
                this.mLogger.setIntOption(60, this.mNetSpeedLevel);
                _setDataSource(str, hashMap);
            }
            if (isInHousePlayer()) {
                _settingThirdPartyProtocol();
                this.mMediaPlayer.setIntOption(100, this.mStartTime);
                this.mMediaPlayer.setIntOption(154, this.mReuseSocket);
                this.mMediaPlayer.setIntOption(137, this.mLoopStartTime);
                this.mMediaPlayer.setIntOption(138, this.mLoopEndTime);
                this.mMediaPlayer.setIntOption(193, this.mLoopCount);
                this.mMediaPlayer.setIntOption(143, this.mSeekEndEnabled);
                this.mMediaPlayer.setIntOption(l.i, this.mDrmType);
                this.mMediaPlayer.setIntOption(209, this.mDrmCloseRootCheck);
                this.mMediaPlayer.setIntOption(208, this.mDrmDowngrade);
                this.mMediaPlayer.setIntOption(241, this.mEnableIndexCache);
                this.mMediaPlayer.setIntOption(242, this.mEnableFragRange);
                this.mMediaPlayer.setIntOption(262, this.mEnableAsync);
                this.mMediaPlayer.setIntOption(258, this.mRangeMode);
                this.mMediaPlayer.setIntOption(146, this.mLazySeek);
                this.mMediaPlayer.setIntOption(371, this.mFFCodecerHeaacV2Compat);
                this.mMediaPlayer.setIntOption(830, this.mCacheJFrameField);
                this.mMediaPlayer.setIntOption(277, this.mReadMode);
                this.mMediaPlayer.setIntOption(288, this.mUpdateTimestampMode);
                this.mMediaPlayer.setIntOption(291, this.mEnableOpenTimeout);
                this.mMediaPlayer.setIntOption(243, this.mVideoRangeSize);
                this.mMediaPlayer.setIntOption(244, this.mAudioRangeSize);
                this.mMediaPlayer.setIntOption(259, this.mVideoRangeTime);
                this.mMediaPlayer.setIntOption(260, this.mAudioRangeTime);
                this.mMediaPlayer.setIntOption(250, this.mIsTTHlsDrm);
                this.mMediaPlayer.setIntOption(515, this.mSeekExact);
                this.mMediaPlayer.setIntOption(298, this.mLiveStartIndex);
                this.mMediaPlayer.setIntOption(299, this.mEnableRefreshByTime);
                if (!TextUtils.isEmpty(this.mVideoID)) {
                    this.mMediaPlayer.setStringOption(l.h, this.mVideoID);
                }
                if (!TextUtils.isEmpty(this.mTokenUrlTemplate)) {
                    this.mMediaPlayer.setStringOption(207, this.mTokenUrlTemplate);
                }
                if (!TextUtils.isEmpty(this.mTTHlsDrmToken)) {
                    this.mMediaPlayer.setStringOption(249, this.mTTHlsDrmToken);
                }
                if (this.mAudioStreamType != -2) {
                    this.mMediaPlayer.setIntOption(MotionEventCompat.ACTION_MASK, this.mAudioStreamType);
                }
                if (this.mAudioChannelType != 0) {
                    this.mMediaPlayer.setIntOption(989, this.mAudioChannelType);
                }
                this.mMediaPlayer.setIntOption(960, this.mAudioTrackSessionId);
                this.mLogger.setDrmType(this.mDrmType);
                this.mLogger.setDrmTokenUrl(this.mTokenUrlTemplate);
                this.mLogger.setIntOption(43, this.mLazySeek);
                if (TTVideoEngineConfig.setEGLBitDepth > 8) {
                    this.mMediaPlayer.setIntOption(1083, 1);
                }
            }
            if (this.mSeamSwitchingResolution || this.mRetrying) {
                this.mMediaPlayer.setIntOption(100, this.mLastPlaybackTime);
            }
            if (!TextUtils.isEmpty(this.mBarrageMaskUrl) && this.mEnableMaskThread > 0) {
                if (this.mDataLoaderEnable > 0 && this.mMaskEnableDataloader > 0 && !TextUtils.isEmpty(this.mMaskFileHash)) {
                    String _proxyUrl = DataLoaderHelper.getDataLoader()._proxyUrl(this.mMaskFileHash, this.mVideoID, 0L, new String[]{this.mBarrageMaskUrl}, Resolution.Undefine, null, null, null, null, false, false, null, 0L, null);
                    if (!TextUtils.isEmpty(_proxyUrl)) {
                        this.mBarrageMaskUrl = _proxyUrl;
                    }
                }
                this.mMediaPlayer.setIntOption(1803, this.mMaskHeaderLen);
                this.mMediaPlayer.setIntOption(1802, this.mMaskRangeOpt);
                this.mMediaPlayer.setIntOption(613, this.mEnableBarrageMask);
                this.mMediaPlayer.setStringOption(612, this.mBarrageMaskUrl);
                IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                if (iVideoEventLogger2 != null) {
                    iVideoEventLogger2.setMaskUrl(this.mBarrageMaskUrl);
                    this.mLogger.setStringOption(146, this.mMaskFileHash);
                    this.mLogger.setLongOption(MediaPlayer.MEDIA_PLAYER_OPTION_ABR_STREAM_INFO, this.mMaskFileSize);
                }
            }
            if (!TextUtils.isEmpty(this.mAIBarrageUrl) && this.mEnableAIBarrageThread > 0) {
                this.mMediaPlayer.setIntOption(751, this.mEnableAIBarrage);
                this.mMediaPlayer.setStringOption(750, this.mAIBarrageUrl);
            }
            TTVideoEngineLog.d(logcatTag(), "mask thread: " + this.mEnableMaskThread + "mask option: " + this.mEnableBarrageMask + " url:" + this.mBarrageMaskUrl);
            TTVideoEngineLog.d(logcatTag(), "AIBarrage: thread enable: " + this.mEnableAIBarrageThread + " enable option: " + this.mEnableAIBarrage + " url:" + this.mAIBarrageUrl);
            if (TextUtils.isEmpty(this.mDirectURL) && TextUtils.isEmpty(this.mLocalURL)) {
                if (this.mEnableABR > 0 && this.mABRSwitchMode == 0) {
                    _logFirstResolution(Resolution.Auto);
                } else {
                    _logFirstResolution(this.currentResolution);
                    TTVideoEngineLog.i(logcatTag(), "log first resolution:" + _resolutionToString(this.currentResolution));
                }
                _logFirstQuality(this.mCurrentQuality);
                int i10 = this.mCurrentQualityType;
                if (i10 != 0) {
                    _logFirstQualityType(i10);
                }
                IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                if (iVideoEventLogger3 != null && (iVideoModel2 = this.mVideoModel) != null) {
                    iVideoEventLogger3.setIntOption(62, iVideoModel2.getVideoRefInt(9));
                }
            }
            if (this.mShouldStop) {
                TTVideoEngineLog.w(logcatTag(), "_playInternal interrupted by stop");
                return;
            }
            if (DataLoaderHelper.getDataLoader().getIntValue(1150) != 0) {
                if (StrategyHelper.helper().needCheckPlayerVersion()) {
                    StrategyHelper.helper().checkPlayerVersion(this.mMediaPlayer.getIntOption(903, -1));
                }
                if (!StrategyHelper.helper().playerIsMatch()) {
                    TTVideoEngineLog.e(logcatTag(), "iPlayer version is not match");
                } else {
                    String str5 = this.mVideoID;
                    if (this.mIsLocal && this.mLocalURL != null) {
                        str5 = TTHelper.md5(this.mLocalURL);
                    } else {
                        FileDescriptor fileDescriptor = this.mPlayFd;
                        if (fileDescriptor != null) {
                            str5 = fileDescriptor.toString();
                        }
                    }
                    if (TextUtils.isEmpty(str5)) {
                        str5 = (String) this.mMediaInfoMap.get("vid");
                    }
                    this.mLogger.setStringOption(154, str5);
                    TTVideoEngineLog.i(logcatTag(), "[strategy] set mediaId to player, mediaId = " + str5);
                    if (str5 != null) {
                        this.mMediaPlayer.setStringOption(901, str5);
                    }
                    if (this.mAutoAddMedia > 0) {
                        try {
                            iVideoModel = this.mVideoModel;
                        } catch (Throwable unused) {
                            str2 = null;
                        }
                        if (iVideoModel != null) {
                            jSONObject = iVideoModel.toMediaInfoJsonString();
                        } else if (this.mMediaInfoMap.isEmpty()) {
                            str3 = null;
                            str2 = str3;
                            if (str2 != null) {
                                StrategyHelper.helper().getCenter().a(str2, (ISelectBitrateListener) null, (String) null, false, true);
                            }
                        } else {
                            jSONObject = new JSONObject(this.mMediaInfoMap).toString();
                        }
                        str3 = jSONObject;
                        str2 = str3;
                        if (str2 != null) {
                        }
                    }
                    this.mMediaPlayer.setIntOption(904, this.mPreciseCache);
                    this.mLogger.addFeature("precise_cache", Integer.valueOf(this.mPreciseCache));
                    long longOption = this.mMediaPlayer.getLongOption(902, 0L);
                    if (longOption != 0 && !TextUtils.isEmpty(str5)) {
                        TTVideoEngineLog.i(logcatTag(), "[strategy] create player. mediaId = " + str5 + ", traceId = " + this.mTraceId);
                        StrategyHelper.helper().getCenter().a(longOption, str5, this.mTraceId, TextUtils.isEmpty(this.mTag) ? "default" : this.mTag);
                        StrategyHelper.helper().getCenter().a(this.mTraceId, 56006, getConfigString(1410, this.mPlayLoadConfig));
                        StrategyHelper.helper().getCenter().a(this.mTraceId, 56007, getConfigString(1411, this.mPlayRangeConfig));
                        StrategyHelper.helper().getCenter().a(this.mTraceId, 56008, getConfigString(1412, this.mPlayBufferConfig));
                        if (this.mIsStartPlayAutomatically) {
                            StrategyHelper.helper().getCenter().e(str5);
                        }
                    }
                }
            }
            if (!this.mPrepared) {
                this.mRetryingNotHandleError = false;
                this.mMediaPlayer.setIntOption(99, this.mEnablePlaySpeedExtend);
                this.mMediaPlayer.setIntOption(50501, this.mAllowAllExtensions);
                this.mMediaPlayer.setIntOption(42026, this.mExtVoiceFormat);
                this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK, this.mEnableMasterM3u8Optimize);
                if (this.mPlaybackParams != null && !isOSPlayer()) {
                    this.mMediaPlayer.setPlaybackParams(this.mPlaybackParams);
                    this.mLogger.setPlaybackParams(this.mPlaybackParams);
                }
                this.mLogger.setSurfaceSourceType("internal");
                this.mLogger.setSurfaceBegin();
                if (this.mSurfaceHolderByKernel != 0) {
                    if (this.mSurfaceHolder != null) {
                        this.mMediaPlayer.setDisplay(this.mSurfaceHolder);
                    }
                    if (this.mSurface != null || this.mTextureSurface != null) {
                        setSurfaceHook(this.mSurface);
                    }
                } else if (this.mSurfaceHolder != null) {
                    if (this.mSurfaceCallback == null) {
                        TTVideoEngineLog.d(logcatTag(), "setsurface regist callback, this:" + this);
                        addSurfaceCallback(this.mSurfaceHolder);
                        setSurfaceHook(this.mSurfaceHolder.getSurface());
                    } else {
                        TTVideoEngineLog.d(logcatTag(), "setsurface hook, this:" + this);
                        setSurfaceHook(this.mSurfaceHolder.getSurface());
                    }
                } else if (this.mSurface != null || this.mTextureSurface != null) {
                    setSurfaceHook(this.mSurface);
                }
                this.mLogger.setSurfaceEnd();
                if (this.mTextureSurface != null) {
                    synchronized (this.mExtraSurfaceQueue) {
                        _setExtraSurface();
                    }
                }
                _updateTextureState(1);
                this.mMediaPlayer.setStringOption(1021, produceUserAgentString());
                try {
                    IVideoEventLogger iVideoEventLogger4 = this.mLogger;
                    if (iVideoEventLogger4 != null) {
                        iVideoEventLogger4.prepareStart();
                    }
                    this.mMediaPlayer.prepareAsync();
                    if (getConfigInt(160, this.mDataLoaderEnable) > 0 && EngineGlobalConfig.getInstance().getPcdnAuto() == 1) {
                        this.mLogger.addFeature("enable_pcdn_auto", 1);
                    }
                    notifyPrepare();
                } catch (Exception e2) {
                    TTVideoEngineLog.d(e2);
                    receivedError(Error.createForPlayer(this.mMediaPlayer, -9992, e2.toString()));
                    return;
                }
            } else {
                this.mLogger.prepareStart();
                this.mLogger.prepareEnd();
                _resumeVideo();
            }
            this.mState = 3;
        } catch (Throwable th) {
            receivedError(Error.createForPlayer(this.mMediaPlayer, -9992, th.toString()));
        }
    }

    private void _playInternal2(String str, Map<String, String> map) {
        IVideoEventLogger iVideoEventLogger;
        boolean z;
        String str2;
        IVideoModel iVideoModel;
        String str3;
        String jSONObject;
        int i;
        IVideoEventLogger iVideoEventLogger2;
        IVideoModel iVideoModel2;
        String _proxyUrl;
        String str4;
        VideoInfo videoInfo;
        VideoInfo videoInfo2;
        int i2;
        char c2;
        float valueFloat;
        VideoInfo videoInfo3;
        float valueFloat2;
        VideoInfo videoInfo4;
        AudioProcessor audioProcessor;
        int i3;
        TTVideoEngineLog.d(logcatTag(), "_playInternal url=" + str + " mUseTextureRender=" + this.mUseTextureRender + " mUseSRTexture=" + this.mUseSRTexture);
        if (this.mEnableSetPlayInfoToP2P == 1 && !TTVideoEngineHelper.isMayUseP2P(str)) {
            this.mEnableSetPlayInfoToP2P = 0;
            TTVideoEngineLog.d(logcatTag(), "not may use p2p, change enablesetplayinfo to 0, url" + str);
        }
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_playInternal should stop");
            return;
        }
        if (this.mMediaPlayer != null && needReleaseMediaPlayer()) {
            releaseMediaPlayer();
        }
        _logFirstURL(this.mURLInfo.hostURL);
        if ((this.mUseTextureRender != 0 || this.mUseSRTexture || !this.mEffectBundle.isEmpty() || this.mTRSrategy.isInitForEffect(1)) && this.mTextureSurface == null && (this.mEngineConfig.getIntOption(4014) <= 0 || !this.mEffectBundle.isEmpty() || this.mTextureSrOpen > 0)) {
            if (this.mEngineConfig.getIntOption(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME) == 1) {
                final Looper looper = TTHelper.getLooper();
                EngineThreadPool.addExecuteTask(new Runnable() {
                    @Override
                    public final void run() {
                        TTVideoEngineImpl.this.lambda$_playInternal2$8$TTVideoEngineImpl(looper);
                    }
                });
            } else {
                setupTextureRender();
            }
            if ((this.mVC2DynamicControl & 1) == 1 && this.mRenderType == 5 && this.mTextureSurface != null) {
                this.mRenderType = 0;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, this.mRenderType);
                }
            }
        } else {
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null && this.mUseSRTexture && (videoSurface.getIntOption(10) == 0 || ((i3 = this.mOldTextureAlgType) != -1 && i3 != this.mTextureAlgType))) {
                initSr(this.mTextureSurface);
            } else if (this.mEngineConfig.getIntOption(4014) > 0) {
                this.mRenderType = 5;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, this.mRenderType);
                }
            }
        }
        boolean z2 = isSupportSeamlessSwitch(str) || isSupportSeamlessSwitch(this.mVideoModel);
        updateConfigParams(this.mConfigParams);
        IVideoModel iVideoModel3 = this.mVideoModel;
        if (iVideoModel3 != null) {
            String dynamicType = iVideoModel3.getDynamicType();
            if (!TextUtils.isEmpty(dynamicType) && dynamicType.equals("segment_base") && this.mVideoModelVersion == 3) {
                this.mEngineConfig.setIntOption(33, 1);
            }
        }
        if (FeatureManager.isLicenseExpired()) {
            fallbackOSPlayer();
        }
        _configHardwareDecode();
        boolean z3 = this.mEngineConfig.getIntOption(17) == 1;
        int intOption = this.mEngineConfig.getIntOption(34);
        try {
            if (this.mMediaPlayer == null) {
                MediaPlayer mediaPlayer = this.mAsyncPlayer;
                if (mediaPlayer != null) {
                    this.mMediaPlayer = mediaPlayer;
                    this.mAsyncPlayer = null;
                } else {
                    this.mEnableSetupMediaCodec = false;
                    this.mMediaPlayer = createMediaPlayer();
                }
                if (this.mMediaPlayer == null) {
                    _notifyError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9993, "create player failed"));
                    return;
                }
                if (!isInHousePlayer() && (audioProcessor = this.mAudioProcessor) != null && !NativeAudioProcessor.isNativeAudioProcessor(audioProcessor)) {
                    this.mAudioProcessor.audioRelease(1);
                    this.mAudioProcessor = null;
                }
                if (z3 && !isInHousePlayer() && intOption != 2) {
                    receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "dash not supported"));
                    return;
                }
                boolean z4 = this.mEngineConfig.getIntOption(33) == 1 && str != null && str.startsWith("mem://bash");
                String stringOption = this.mEngineConfig.getStringOption(1000);
                if (stringOption == null) {
                    stringOption = "";
                }
                if ((z4 || stringOption.equals("bytevc1") || stringOption.equals("bytevc2") || this.mHttpsEnabled) && this.mMediaPlayer != null && isOSPlayer()) {
                    receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "create os player failed"));
                    return;
                }
                if ((z4 || stringOption.equals("bytevc2")) && this.mMediaPlayer != null && isPlayerType(5)) {
                    receivedError(Error.createForPlayer(this.mMediaPlayer, -9993, "create exoplayer failed"));
                    return;
                }
                if ((z3 || z4 || stringOption.equals("bytevc1") || stringOption.equals("bytevc2") || this.mHttpsEnabled) && this.mMediaPlayer != null && (this.mMediaPlayer.getPlayerType() == 3 || this.mMediaPlayer.getPlayerType() == 4)) {
                    receivedError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9989, "create own plugin player failed"));
                    return;
                }
                if ((this.mEngineConfig.getIntOption(650) == 2 || this.mEngineConfig.getIntOption(650) == 4) && this.mMediaPlayer.getPlayerType() != 1 && this.mMediaPlayer.getPlayerType() != 2) {
                    receivedError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9993, "osplayer don't support overlay"));
                    return;
                }
                this.mPlayerType = transMediaPlayerType(this.mMediaPlayer);
                setMediaPlayerOptions2();
                registerListenerMediaPlayer();
                if ((this.mMediaPlayer instanceof MediaPlayerWrapper) && this.mLoadControlInterface != null) {
                    ((MediaPlayerWrapper) this.mMediaPlayer).setLoadControl(this.mLoadControlInterface);
                }
                if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
                    long b2 = (this.mABRModule == null || this.mEngineConfig.getIntOption(682) <= 0) ? 0L : this.mABRModule.b(55, -1L);
                    if (b2 > 0 && b2 == this.mMediaPlayer.getIntOption(831, -1)) {
                        ABRStrategy e = this.mABRModule.e();
                        ((MediaPlayerWrapper) this.mMediaPlayer).setABRStrategy(e);
                        e.release();
                    } else {
                        ((MediaPlayerWrapper) this.mMediaPlayer).setABRStrategy(new MyABRStrategy());
                    }
                }
                this.mPrepared = false;
            } else {
                if (this.mError != null || this.mSeamSwitchingResolution) {
                    TTVideoEngineLog.i(logcatTag(), "mediaPlayer reset, surface holder:" + this.mSurfaceHolder + ", surace:" + this.mSurface);
                    _updateLogger();
                    if (this.mSeamSwitchingResolution && this.mError == null) {
                        this.mLogger.accumulateSize();
                    }
                    this.mMediaPlayer.reset();
                    this.mPrepared = false;
                    this.mError = null;
                    this.mMediaPlayer.setIntOption(133, 0);
                    this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, 0);
                    _tryRegisterMdlHandle(this.mMediaPlayer);
                    this.mLogger.setIntOption(92, this.mEngineConfig.getIntOption(562));
                    if (z2) {
                        this.mMediaPlayer.setIntOption(132, 1);
                        this.mMediaPlayer.setIntOption(287, 1);
                        this.mMediaPlayer.setIntOption(172, this.mEnableABR);
                        this.mMediaPlayer.setIntOption(678, this.mEngineConfig.getIntOption(717));
                        this.mABRUsed = this.mEnableABR == 1 || this.mABRUsed;
                    }
                    int intOption2 = this.mEngineConfig.getIntOption(MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME);
                    String logcatTag = logcatTag();
                    StringBuilder sb = new StringBuilder();
                    sb.append("AIBarrage: Thread switcher on: ");
                    sb.append(intOption2 < 1 ? 1 : 0);
                    sb.append(", barrageInterface exist: ");
                    sb.append(this.mAIBarrageInfoInterface == null ? 1 : 0);
                    TTVideoEngineLog.i(logcatTag, sb.toString());
                    if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
                        if (this.mEnableMaskThread > 0 && this.mMaskInfoInterface != null) {
                            ((MediaPlayerWrapper) this.mMediaPlayer).setMaskInfo(this.mMaskInfoInterface);
                        }
                        if (intOption2 > 0 && this.mAIBarrageInfoInterface != null) {
                            ((MediaPlayerWrapper) this.mMediaPlayer).setAIBarrageInfo(this.mAIBarrageInfoInterface);
                        }
                        if (this.mEnableSubThread > 0 && this.mSubInfoInterface != null) {
                            TTVideoEngineLog.d(logcatTag(), "subtitle: set mSubInfoInterface to mMediaPlayer");
                            ((MediaPlayerWrapper) this.mMediaPlayer).setSubInfo(this.mSubInfoInterface);
                        } else {
                            TTVideoEngineLog.d(logcatTag(), "subtitle: no valied mSubInfoInterfaceset to MediaPlayer");
                        }
                    }
                    if (this.mVideoModel != null) {
                        if (!this.mEngineConfig.isKeySet(345)) {
                            if (z3 && (videoInfo4 = this.mDynamicAudioInfo) != null) {
                                valueFloat2 = videoInfo4.getValueFloat(39);
                            } else {
                                VideoInfo videoInfo5 = this.currentVideoInfo;
                                valueFloat2 = videoInfo5 != null ? videoInfo5.getValueFloat(39) : 0.0f;
                            }
                            if (valueFloat2 == 0.0f) {
                                valueFloat2 = this.mVideoModel.getVideoRefFloat(224);
                            }
                            this.mEngineConfig.setFloatOption(345, valueFloat2);
                        }
                        if (!this.mEngineConfig.isKeySet(346)) {
                            if (z3 && (videoInfo3 = this.mDynamicAudioInfo) != null) {
                                valueFloat = videoInfo3.getValueFloat(40);
                            } else {
                                VideoInfo videoInfo6 = this.currentVideoInfo;
                                valueFloat = videoInfo6 != null ? videoInfo6.getValueFloat(40) : 0.0f;
                            }
                            if (valueFloat == 0.0f) {
                                valueFloat = this.mVideoModel.getVideoRefFloat(225);
                            }
                            this.mEngineConfig.setFloatOption(346, valueFloat);
                        }
                        if (this.mEngineConfig.getFloatOption(347) > 0.0f && this.mEngineConfig.getFloatOption(345) == 0.0f && this.mEngineConfig.getFloatOption(346) == 0.0f) {
                            this.mEngineConfig.setIntOption(329, 0);
                        }
                        if (!this.mEngineConfig.isKeySet(356)) {
                            this.mEngineConfig.setFloatOption(350, this.mVideoModel.getVideoRefFloat(252));
                            this.mEngineConfig.setFloatOption(351, this.mVideoModel.getVideoRefFloat(247));
                            this.mEngineConfig.setFloatOption(352, this.mVideoModel.getVideoRefFloat(248));
                            this.mEngineConfig.setFloatOption(48, this.mVideoModel.getVideoRefFloat(249));
                            this.mEngineConfig.setFloatOption(354, this.mVideoModel.getVideoRefFloat(250));
                            this.mEngineConfig.setIntOption(356, this.mVideoModel.getVideoRefInt(251));
                            this.mEngineConfig.setStringOption(360, this.mVideoModel.getVideoRefStr(260));
                        }
                    }
                    iVideoEventLogger = this.mLogger;
                    if (iVideoEventLogger == null) {
                        iVideoEventLogger.useHardwareDecode(this.mHardwareDecodeEnablePlayer2);
                        this.mLogger.enableStartPlayAutomatically(this.mIsStartPlayAutomatically);
                        this.mLogger.setIntOption(24, this.mEngineConfig.getIntOption(11));
                        this.mLogger.setFramesDropNum(this.mEngineConfig.getIntOption(207));
                        this.mLogger.useCodecPool(this.mEngineConfig.getIntOption(332));
                        this.mLogger.useAsyncInit(this.mAsyncInitEnable, this.mCodecId);
                        this.mLogger.setDisableAccurateStart(this.mDisableAccurateStart);
                        this.mLogger.setMediaCodecRender(this.mEngineConfig.getIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY));
                        this.mLogger.setIntOption(16, this.mEngineConfig.getIntOption(216));
                        if (!this.mSeamSwitchingResolution) {
                            this.mLogger.setIntOption(26, this.mNotifyBufferingDirectly);
                        }
                        int intOption3 = this.mEngineConfig.getIntOption(118);
                        if (intOption3 == 0) {
                            intOption3 = this.mEngineConfig.getIntOption(200) * 1000;
                        }
                        this.mLogger.setIntOption(27, intOption3);
                        this.mLogger.setIntOption(29, this.mEngineConfig.getIntOption(329));
                        this.mLogger.setIntOption(54, this.mEngineConfig.getIntOption(343));
                        this.mLogger.setIntOption(32, this.mHardwareDropNonRef);
                        if (this.mHttpsEnabled) {
                            this.mLogger.setIntOption(33, 1);
                        }
                        if (getConfigInt(602, this.mPosUpdateInterval) > 0) {
                            this.mLogger.setIntOption(35, 1);
                        }
                        if (this.mLoadControlInterface != null) {
                            this.mLogger.setIntOption(36, 1);
                        }
                        this.mLogger.setIntOption(37, this.mRenderType);
                        this.mLogger.setIntOption(38, this.mEngineConfig.getIntOption(2));
                        this.mLogger.setIntOption(39, this.mVoiceType);
                        this.mLogger.setIntOption(40, this.mEngineConfig.getIntOption(l.g));
                        this.mLogger.setIntOption(41, this.mEngineConfig.getIntOption(482));
                        this.mLogger.setIntOption(42, this.mEngineConfig.getIntOption(490));
                        this.mLogger.setIntOption(44, this.mEngineConfig.getIntOption(509));
                        this.mLogger.setIntOption(47, this.mEnableSubThread);
                        this.mLogger.setIntOption(49, this.mEnableSub);
                        this.mLogger.setIntOption(46, this.mEnableMaskThread);
                        this.mLogger.setIntOption(48, this.mEngineConfig.getIntOption(499));
                        if (this.mEnableLooperThread) {
                            this.mLogger.setIntOption(30, 1);
                        }
                        if (this.mEngineConfig.getIntOption(800) > 0) {
                            this.mLogger.addFeature("mdl_seek_reopen", Integer.valueOf(this.mEngineConfig.getIntOption(800)));
                        }
                        this.mLogger.setIntOption(143, this.mEngineConfig.getIntOption(1302));
                        this.mLogger.setIntOption(144, this.mEngineConfig.getIntOption(1301));
                        this.mLogger.setIntOption(145, this.mEngineConfig.getIntOption(1300));
                        VideoInfo videoInfo7 = this.currentVideoInfo;
                        if (videoInfo7 != null) {
                            this.mLogger.setStringOption(152, videoInfo7.getValueStr(15));
                        }
                        VideoInfo videoInfo8 = this.mDynamicAudioInfo;
                        if (videoInfo8 != null) {
                            this.mLogger.setStringOption(153, videoInfo8.getValueStr(15));
                        }
                    }
                    resetMediaPlayerOptions2();
                    _sendMdlCacheMsg();
                    if (!this.mPrepared && ((this.mMediaPlayer.getPlayerType() == 1 || this.mMediaPlayer.getPlayerType() == 2 || this.mMediaPlayer.getPlayerType() == 3 || this.mMediaPlayer.getPlayerType() == 4) && this.mIsPreloaderItem && this.mPreloaderItem != null)) {
                        this.mMediaPlayer.setIntOption(14, 1);
                        this.mMediaPlayer.setStringOption(17, this.mPreloaderItem.mFileKey);
                        this.mMediaPlayer.setCacheFile(this.mPreloaderItem.mFilePath, 1);
                        this.mMediaPlayer.setIntOption(18, 20);
                    }
                    if (this.mIsLocal && !this.mIsDirectURL && !this.mIsPlayItem && !this.mIsPreloaderItem && intOption != 2 && (videoInfo2 = this.currentVideoInfo) != null) {
                        int mediatype = videoInfo2.getMediatype();
                        int valueInt = this.currentVideoInfo.getValueInt(3);
                        String valueStr = this.currentVideoInfo.getValueStr(31);
                        int i4 = (this.mEngineConfig.getIntOption(313) != 1 || TextUtils.isEmpty(valueStr)) ? 0 : 1;
                        this.mIsDashSource = _isDashSource(this.currentVideoInfo);
                        this.mEngineConfig.setIntOption(17, this.mIsDashSource ? 1 : 0);
                        z = this.mIsDashSource;
                        if (this.mEnableTmpLog == 1) {
                            showLongLog("brian set bitrate:" + valueInt + ", to player, resolution:" + this.currentVideoInfo.getValueStr(7));
                        }
                        if (z2) {
                            long j = this.mPredictStartBitrate;
                            if (j > 0) {
                                valueInt = (int) j;
                                this.mPredictStartBitrate = -1L;
                            }
                            this.mMediaPlayer.setIntOption(mediatype == VideoRef.TYPE_VIDEO ? 130 : 131, valueInt);
                            if (i4 != 0) {
                                this.mMediaPlayer.setStringOption(mediatype != VideoRef.TYPE_VIDEO ? 203 : 202, valueStr);
                            }
                        } else if (i4 != 0) {
                            this.mMediaPlayer.setStringOption(202, valueStr);
                        }
                        this.mMediaPlayer.setIntOption(246, this.mHijackRetryCount > 0 ? 0 : 1);
                        this.mLogger.setCheckHijack(i4);
                        this.mLogger.setHijackRetry(this.mEngineConfig.getIntOption(427) == 1 ? 1 : 0);
                        if (this.mHardwareDecodeEnablePlayer2 == 1) {
                            int i5 = this.mCodecId;
                            String valueStr2 = this.currentVideoInfo.getValueStr(8);
                            if (!TextUtils.isEmpty(valueStr2)) {
                                valueStr2.hashCode();
                                switch (valueStr2.hashCode()) {
                                    case 3148040:
                                        if (valueStr2.equals("h264")) {
                                            c2 = 0;
                                            break;
                                        }
                                        c2 = 65535;
                                        break;
                                    case 355428636:
                                        if (valueStr2.equals("bytevc1")) {
                                            c2 = 1;
                                            break;
                                        }
                                        c2 = 65535;
                                        break;
                                    case 355428637:
                                        if (valueStr2.equals("bytevc2")) {
                                            c2 = 2;
                                            break;
                                        }
                                        c2 = 65535;
                                        break;
                                    default:
                                        c2 = 65535;
                                        break;
                                }
                                switch (c2) {
                                    case 0:
                                        i2 = 0;
                                        break;
                                    case 1:
                                        i2 = 1;
                                        break;
                                    case 2:
                                        i2 = 33;
                                        break;
                                }
                                TTVideoEngineLog.i(logcatTag(), "videoInfo codec id = " + i2);
                                this.mMediaPlayer.setIntOption(182, i2);
                                this.mLogger.useAsyncInit(this.mAsyncInitEnable, i2);
                            }
                            i2 = i5;
                            TTVideoEngineLog.i(logcatTag(), "videoInfo codec id = " + i2);
                            this.mMediaPlayer.setIntOption(182, i2);
                            this.mLogger.useAsyncInit(this.mAsyncInitEnable, i2);
                        }
                    } else {
                        if (this.mIsDirectURL) {
                            String stringOption2 = this.mEngineConfig.getStringOption(662);
                            if (this.mEngineConfig.getIntOption(313) == 1 && !TextUtils.isEmpty(stringOption2)) {
                                this.mMediaPlayer.setStringOption(202, stringOption2);
                                this.mMediaPlayer.setIntOption(246, this.mHijackRetryCount > 0 ? 0 : 1);
                                this.mLogger.setCheckHijack(1);
                                this.mLogger.setHijackRetry(this.mEngineConfig.getIntOption(427) == 1 ? 1 : 0);
                            }
                        }
                        this.mEngineConfig.setIntOption(17, 0);
                        this.mIsDashSource = false;
                        z = false;
                    }
                    if (!this.mPrepared) {
                        if ((this.mIsLocal || this.mIsDirectURL) && !TextUtils.isEmpty(this.mDecryptionKey)) {
                            this.mLogger.setEncryptKey(this.mDecryptionKey);
                            if ((getConfigInt(160, this.mDataLoaderEnable) == 0 || DataLoaderHelper.getDataLoader().getIntValue(9009) == 0) && (this.mMediaPlayer.getPlayerType() == 0 || this.mMediaPlayer.getPlayerType() == 5)) {
                                receivedError(Error.createForPlayer(this.mMediaPlayer, -9987, "Player can't decode encryted video"));
                                return;
                            }
                            this.mMediaPlayer.setStringOption(64, this.mDecryptionKey);
                        }
                        if (z) {
                            IVideoModel iVideoModel4 = this.mVideoModel;
                            if (iVideoModel4 != null) {
                                str4 = iVideoModel4.getSpadea();
                                if (!TextUtils.isEmpty(str4)) {
                                    this.mLogger.setEncryptKey(str4);
                                    if ((getConfigInt(160, this.mDataLoaderEnable) == 0 || DataLoaderHelper.getDataLoader().getIntValue(9009) == 0) && ((this.mMediaPlayer.getPlayerType() == 0 || this.mMediaPlayer.getPlayerType() == 5) && intOption != 2)) {
                                        receivedError(Error.createForPlayer(this.mMediaPlayer, -9987, "Player can't decode encryted video"));
                                        return;
                                    }
                                    this.mMediaPlayer.setStringOption(144, str4);
                                }
                            }
                            str4 = null;
                            if (!TextUtils.isEmpty(str4)) {
                            }
                        } else {
                            if (!this.mIsLocal && !this.mIsPlayItem && !this.mIsPreloaderItem && !this.mIsDirectURL && (videoInfo = this.currentVideoInfo) != null && !TextUtils.isEmpty(videoInfo.getValueStr(5))) {
                                str4 = this.currentVideoInfo.getValueStr(5);
                            } else {
                                if (!TextUtils.isEmpty(this.mSpadea)) {
                                    str4 = this.mSpadea;
                                }
                                str4 = null;
                            }
                            if (!TextUtils.isEmpty(str4)) {
                            }
                        }
                    }
                    TTVideoEngineLog.d(logcatTag(), "set screen on");
                    this.mMediaPlayer.setScreenOnWhilePlaying(true);
                    this.mMediaPlayer.setLooping(this.mLooping);
                    this.mLogger.setLooping(this.mLooping);
                    if (this.mPlayFd == null) {
                        this.mMediaPlayer.setDataSource(this.mPlayFd, this.mPipeOffset, this.mPipeLength);
                    } else if (this.mMediaDataSource != null) {
                        this.mMediaPlayer.setDataSource(this.mMediaDataSource);
                    } else {
                        Map<String, String> hashMap = map == null ? new HashMap<>() : map;
                        float intOption4 = this.mEngineConfig.getIntOption(497) / 1000.0f;
                        int intOption5 = this.mEngineConfig.getIntOption(486);
                        VideoInfo videoInfo9 = this.currentVideoInfo;
                        int calculateSizeBySecond = (videoInfo9 == null || videoInfo9.getBitrateFitterInfo() == null) ? 0 : this.currentVideoInfo.getBitrateFitterInfo().calculateSizeBySecond(intOption4);
                        if (calculateSizeBySecond > 0) {
                            hashMap.put("X-PCDN-FRange-Sec", Float.toString(intOption4));
                            hashMap.put("X-PCDN-FRange-Size", Integer.toString(calculateSizeBySecond));
                            this.mLogger.setIntOption(59, calculateSizeBySecond);
                        } else if (intOption5 > 0) {
                            hashMap.put("X-PCDN-FRange-Size", Integer.toString(intOption5));
                            this.mLogger.setIntOption(59, intOption5);
                        }
                        VideoInfo videoInfo10 = this.currentVideoInfo;
                        if (videoInfo10 != null && videoInfo10.mSize > 0) {
                            hashMap.put("X-VideoModel-FSize", Long.toString(this.currentVideoInfo.mSize));
                        }
                        this.mLogger.setIntOption(60, this.mEngineConfig.getIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_NETSPEED_LEVEL));
                        _setDataSource(str, hashMap);
                    }
                    if (isInHousePlayer()) {
                        _settingThirdPartyProtocol();
                        this.mMediaPlayer.setIntOption(100, this.mStartTime);
                        if (!TextUtils.isEmpty(this.mVideoID)) {
                            this.mMediaPlayer.setStringOption(l.h, this.mVideoID);
                        }
                        if (!TextUtils.isEmpty(this.mTokenUrlTemplate)) {
                            this.mMediaPlayer.setStringOption(207, this.mTokenUrlTemplate);
                        }
                        if (!TextUtils.isEmpty(this.mTTHlsDrmToken)) {
                            this.mMediaPlayer.setStringOption(249, this.mTTHlsDrmToken);
                        }
                        this.mLogger.setDrmType(intOption);
                        this.mLogger.setDrmTokenUrl(this.mTokenUrlTemplate);
                        this.mLogger.setIntOption(43, this.mEngineConfig.getIntOption(498));
                        if (TTVideoEngineConfig.setEGLBitDepth > 8) {
                            this.mMediaPlayer.setIntOption(1083, 1);
                        }
                    }
                    if (!this.mSeamSwitchingResolution || this.mRetrying) {
                        this.mMediaPlayer.setIntOption(100, this.mLastPlaybackTime);
                    }
                    if (!TextUtils.isEmpty(this.mBarrageMaskUrl) && this.mEnableMaskThread > 0) {
                        if (this.mEngineConfig.getIntOption(160) > 0 && this.mEngineConfig.getIntOption(1301) > 0 && !TextUtils.isEmpty(this.mMaskFileHash)) {
                            _proxyUrl = DataLoaderHelper.getDataLoader()._proxyUrl(this.mMaskFileHash, this.mVideoID, 0L, new String[]{this.mBarrageMaskUrl}, Resolution.Undefine, null, null, null, null, false, false, null, 0L, null);
                            if (!TextUtils.isEmpty(_proxyUrl)) {
                                this.mBarrageMaskUrl = _proxyUrl;
                            }
                        }
                        this.mMediaPlayer.setIntOption(1803, this.mMaskHeaderLen);
                        this.mMediaPlayer.setIntOption(1802, this.mEngineConfig.getIntOption(1302));
                        this.mMediaPlayer.setIntOption(613, this.mEngineConfig.getIntOption(499));
                        this.mMediaPlayer.setStringOption(612, this.mBarrageMaskUrl);
                        this.mLogger.setMaskUrl(this.mBarrageMaskUrl);
                        this.mLogger.setStringOption(146, this.mMaskFileHash);
                        this.mLogger.setLongOption(MediaPlayer.MEDIA_PLAYER_OPTION_ABR_STREAM_INFO, this.mMaskFileSize);
                    }
                    if (!TextUtils.isEmpty(this.mAIBarrageUrl) && this.mEngineConfig.getIntOption(MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME) > 0) {
                        this.mMediaPlayer.setIntOption(751, this.mEngineConfig.getIntOption(512));
                        this.mMediaPlayer.setStringOption(750, this.mAIBarrageUrl);
                    }
                    TTVideoEngineLog.d(logcatTag(), "mask url:" + this.mBarrageMaskUrl);
                    TTVideoEngineLog.d(logcatTag(), "AIBarrage: url:" + this.mAIBarrageUrl);
                    if (TextUtils.isEmpty(this.mDirectURL) && TextUtils.isEmpty(this.mLocalURL)) {
                        if (this.mEnableABR <= 0 && this.mEngineConfig.getIntOption(503) == 0) {
                            _logFirstResolution(Resolution.Auto);
                        } else {
                            _logFirstResolution(this.currentResolution);
                            TTVideoEngineLog.i(logcatTag(), "log first resolution:" + _resolutionToString(this.currentResolution));
                        }
                        _logFirstQuality(this.mCurrentQuality);
                        i = this.mCurrentQualityType;
                        if (i != 0) {
                            _logFirstQualityType(i);
                        }
                        iVideoEventLogger2 = this.mLogger;
                        if (iVideoEventLogger2 != null && (iVideoModel2 = this.mVideoModel) != null) {
                            iVideoEventLogger2.setIntOption(62, iVideoModel2.getVideoRefInt(9));
                        }
                    }
                    if (!this.mShouldStop) {
                        TTVideoEngineLog.w(logcatTag(), "_playInternal interrupted by stop");
                        return;
                    }
                    if (DataLoaderHelper.getDataLoader().getIntValue(1150) != 0) {
                        if (StrategyHelper.helper().needCheckPlayerVersion()) {
                            StrategyHelper.helper().checkPlayerVersion(this.mMediaPlayer.getIntOption(903, -1));
                        }
                        if (!StrategyHelper.helper().playerIsMatch()) {
                            TTVideoEngineLog.e(logcatTag(), "iPlayer version is not match");
                        } else {
                            String str5 = this.mVideoID;
                            if (this.mIsLocal && this.mLocalURL != null) {
                                str5 = TTHelper.md5(this.mLocalURL);
                            } else {
                                FileDescriptor fileDescriptor = this.mPlayFd;
                                if (fileDescriptor != null) {
                                    str5 = fileDescriptor.toString();
                                }
                            }
                            if (TextUtils.isEmpty(str5)) {
                                str5 = (String) this.mMediaInfoMap.get("vid");
                            }
                            this.mLogger.setStringOption(154, str5);
                            TTVideoEngineLog.i(logcatTag(), "[strategy] set mediaId to player, mediaId = " + str5);
                            if (str5 != null) {
                                this.mMediaPlayer.setStringOption(901, str5);
                            }
                            if (this.mEngineConfig.getIntOption(721) > 0) {
                                try {
                                    iVideoModel = this.mVideoModel;
                                } catch (Throwable unused) {
                                    str2 = null;
                                }
                                if (iVideoModel != null) {
                                    jSONObject = iVideoModel.toMediaInfoJsonString();
                                } else if (this.mMediaInfoMap.isEmpty()) {
                                    str3 = null;
                                    str2 = str3;
                                    if (str2 != null) {
                                        StrategyHelper.helper().getCenter().a(str2, (ISelectBitrateListener) null, (String) null, false, true);
                                    }
                                } else {
                                    jSONObject = new JSONObject(this.mMediaInfoMap).toString();
                                }
                                str3 = jSONObject;
                                str2 = str3;
                                if (str2 != null) {
                                }
                            }
                            int intOption6 = this.mEngineConfig.getIntOption(703);
                            this.mMediaPlayer.setIntOption(904, intOption6);
                            this.mLogger.addFeature("precise_cache", Integer.valueOf(intOption6));
                            long longOption = this.mMediaPlayer.getLongOption(902, 0L);
                            if (longOption != 0 && !TextUtils.isEmpty(str5)) {
                                TTVideoEngineLog.i(logcatTag(), "[strategy] create player. mediaId = " + str5 + ", traceId = " + this.mTraceId);
                                StrategyHelper.helper().getCenter().a(longOption, str5, this.mTraceId, TextUtils.isEmpty(this.mTag) ? "default" : this.mTag);
                                StrategyHelper.helper().getCenter().a(this.mTraceId, 56006, getConfigString(1410, this.mPlayLoadConfig));
                                StrategyHelper.helper().getCenter().a(this.mTraceId, 56007, getConfigString(1411, this.mPlayRangeConfig));
                                StrategyHelper.helper().getCenter().a(this.mTraceId, 56008, getConfigString(1412, this.mPlayBufferConfig));
                                if (this.mIsStartPlayAutomatically) {
                                    StrategyHelper.helper().getCenter().e(str5);
                                }
                            }
                        }
                    }
                    if (!this.mPrepared) {
                        this.mRetryingNotHandleError = false;
                        this.mMediaPlayer.setIntOption(99, this.mEngineConfig.getIntOption(257));
                        this.mMediaPlayer.setIntOption(50501, this.mEngineConfig.getIntOption(1405));
                        this.mMediaPlayer.setIntOption(42026, this.mEngineConfig.getIntOption(1406));
                        this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK, this.mEngineConfig.getIntOption(258));
                        if (this.mPlaybackParams != null && !isOSPlayer()) {
                            this.mMediaPlayer.setPlaybackParams(this.mPlaybackParams);
                            this.mLogger.setPlaybackParams(this.mPlaybackParams);
                        }
                        this.mLogger.setSurfaceSourceType("internal");
                        this.mLogger.setSurfaceBegin();
                        if (getConfigInt(951, this.mSurfaceHolderByKernel) != 0) {
                            if (this.mSurfaceHolder != null) {
                                this.mMediaPlayer.setDisplay(this.mSurfaceHolder);
                            }
                            if (this.mSurface != null || this.mTextureSurface != null) {
                                setSurfaceHook(this.mSurface);
                            }
                        } else if (this.mSurfaceHolder != null) {
                            if (this.mSurfaceCallback == null) {
                                TTVideoEngineLog.d(logcatTag(), "setsurface regist callback, this:" + this);
                                addSurfaceCallback(this.mSurfaceHolder);
                                setSurfaceHook(this.mSurfaceHolder.getSurface());
                            } else {
                                TTVideoEngineLog.d(logcatTag(), "setsurface hook, this:" + this);
                                setSurfaceHook(this.mSurfaceHolder.getSurface());
                            }
                        } else if (this.mSurface != null || this.mTextureSurface != null) {
                            setSurfaceHook(this.mSurface);
                        }
                        this.mLogger.setSurfaceEnd();
                        if (this.mTextureSurface != null) {
                            synchronized (this.mExtraSurfaceQueue) {
                                _setExtraSurface();
                            }
                        }
                        _updateTextureState(1);
                        this.mMediaPlayer.setStringOption(1021, produceUserAgentString());
                        try {
                            IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                            if (iVideoEventLogger3 != null) {
                                iVideoEventLogger3.prepareStart();
                            }
                            this.mMediaPlayer.prepareAsync();
                            if (getConfigInt(160, this.mDataLoaderEnable) > 0 && EngineGlobalConfig.getInstance().getPcdnAuto() == 1) {
                                this.mLogger.addFeature("enable_pcdn_auto", 1);
                            }
                            notifyPrepare();
                        } catch (Exception e2) {
                            TTVideoEngineLog.d(e2);
                            receivedError(Error.createForPlayer(this.mMediaPlayer, -9992, e2.toString()));
                            return;
                        }
                    } else {
                        this.mLogger.prepareStart();
                        this.mLogger.prepareEnd();
                        _resumeVideo();
                    }
                    this.mState = 3;
                    return;
                }
                this.mMediaPlayer.setIntOption(1301, 0);
            }
            TTVideoEngineLog.d(logcatTag(), "set screen on");
            this.mMediaPlayer.setScreenOnWhilePlaying(true);
            this.mMediaPlayer.setLooping(this.mLooping);
            this.mLogger.setLooping(this.mLooping);
            if (this.mPlayFd == null) {
            }
            if (isInHousePlayer()) {
            }
            if (!this.mSeamSwitchingResolution) {
            }
            this.mMediaPlayer.setIntOption(100, this.mLastPlaybackTime);
            if (!TextUtils.isEmpty(this.mBarrageMaskUrl)) {
                if (this.mEngineConfig.getIntOption(160) > 0) {
                    _proxyUrl = DataLoaderHelper.getDataLoader()._proxyUrl(this.mMaskFileHash, this.mVideoID, 0L, new String[]{this.mBarrageMaskUrl}, Resolution.Undefine, null, null, null, null, false, false, null, 0L, null);
                    if (!TextUtils.isEmpty(_proxyUrl)) {
                    }
                }
                this.mMediaPlayer.setIntOption(1803, this.mMaskHeaderLen);
                this.mMediaPlayer.setIntOption(1802, this.mEngineConfig.getIntOption(1302));
                this.mMediaPlayer.setIntOption(613, this.mEngineConfig.getIntOption(499));
                this.mMediaPlayer.setStringOption(612, this.mBarrageMaskUrl);
                this.mLogger.setMaskUrl(this.mBarrageMaskUrl);
                this.mLogger.setStringOption(146, this.mMaskFileHash);
                this.mLogger.setLongOption(MediaPlayer.MEDIA_PLAYER_OPTION_ABR_STREAM_INFO, this.mMaskFileSize);
            }
            if (!TextUtils.isEmpty(this.mAIBarrageUrl)) {
                this.mMediaPlayer.setIntOption(751, this.mEngineConfig.getIntOption(512));
                this.mMediaPlayer.setStringOption(750, this.mAIBarrageUrl);
            }
            TTVideoEngineLog.d(logcatTag(), "mask url:" + this.mBarrageMaskUrl);
            TTVideoEngineLog.d(logcatTag(), "AIBarrage: url:" + this.mAIBarrageUrl);
            if (TextUtils.isEmpty(this.mDirectURL)) {
                if (this.mEnableABR <= 0) {
                }
                _logFirstResolution(this.currentResolution);
                TTVideoEngineLog.i(logcatTag(), "log first resolution:" + _resolutionToString(this.currentResolution));
                _logFirstQuality(this.mCurrentQuality);
                i = this.mCurrentQualityType;
                if (i != 0) {
                }
                iVideoEventLogger2 = this.mLogger;
                if (iVideoEventLogger2 != null) {
                    iVideoEventLogger2.setIntOption(62, iVideoModel2.getVideoRefInt(9));
                }
            }
            if (!this.mShouldStop) {
            }
        } catch (Throwable th) {
            receivedError(Error.createForPlayer(this.mMediaPlayer, -9992, th.toString()));
            return;
        }
        _tryRegisterMdlHandle(this.mMediaPlayer);
        this.mLogger.setIntOption(92, this.mEngineConfig.getIntOption(562));
        if (z2) {
        }
        int intOption22 = this.mEngineConfig.getIntOption(MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME);
        String logcatTag2 = logcatTag();
        StringBuilder sb2 = new StringBuilder();
        sb2.append("AIBarrage: Thread switcher on: ");
        sb2.append(intOption22 < 1 ? 1 : 0);
        sb2.append(", barrageInterface exist: ");
        sb2.append(this.mAIBarrageInfoInterface == null ? 1 : 0);
        TTVideoEngineLog.i(logcatTag2, sb2.toString());
        if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
        }
        if (this.mVideoModel != null) {
        }
        iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger == null) {
        }
        resetMediaPlayerOptions2();
        _sendMdlCacheMsg();
        if (!this.mPrepared) {
            this.mMediaPlayer.setIntOption(14, 1);
            this.mMediaPlayer.setStringOption(17, this.mPreloaderItem.mFileKey);
            this.mMediaPlayer.setCacheFile(this.mPreloaderItem.mFilePath, 1);
            this.mMediaPlayer.setIntOption(18, 20);
        }
        if (this.mIsLocal) {
        }
        if (this.mIsDirectURL) {
        }
        this.mEngineConfig.setIntOption(17, 0);
        this.mIsDashSource = false;
        z = false;
        if (!this.mPrepared) {
        }
    }

    void _doSetIntOption(int i, int i2) {
        int i3;
        if (this.mConfigCenterVersion > 0) {
            _doSetIntOption2(i, i2);
            return;
        }
        if (ConfigItemFactory.isCommonPlayerOption(i)) {
            this.mOptionHolder.setIntOption(i, i2);
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setIntOption(i, i2);
            }
        }
        if (i != 0) {
            if (i == 1) {
                this.mEnhancementType = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(37, i2);
                }
            } else if (i == 2) {
                this.mScaleType = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(38, i2);
                }
            } else if (i == 4) {
                this.mLayoutType = i2;
                if (this.mTextureSurface != null) {
                    setTextureLayoutMode(i2);
                } else if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(36, i2);
                }
            } else if (i != 5) {
                if (i == 6) {
                    this.mSettedKeys.add(1000);
                    if (i2 != 0) {
                        this.mCodecType = "bytevc1";
                    }
                } else if (i == 7) {
                    this.mHasSetHardWare = true;
                    MediaPlayer mediaPlayer = this.mAsyncPlayer;
                    if (mediaPlayer == null) {
                        mediaPlayer = this.mMediaPlayer;
                    }
                    this.mHardwareDecodeEnablePlayer2 = i2;
                    this.mSettedKeys.add(Integer.valueOf(i));
                    TTVideoEngineLog.i(logcatTag(), "hardware enable = " + this.mHardwareDecodeEnablePlayer2);
                    if (mediaPlayer != null) {
                        mediaPlayer.setIntOption(59, i2);
                    }
                } else if (i != 11) {
                    if (i == 12) {
                        i3 = DataLoaderHelper.getDataLoader().getIntValue(12) != 200 ? i2 : 0;
                        this.mNetworkTimeout = i3;
                        if (this.mMediaPlayer != null) {
                            this.mMediaPlayer.setIntOption(9, 1000000 * i3);
                        }
                        this.mLogger.setIntOption(25, i3);
                        TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                    }
                    if (i == 160) {
                        this.mDataLoaderEnable = i2;
                        TTVideoEngineLog.d(logcatTag(), "DataLoaderEnable is: " + this.mDataLoaderEnable);
                    } else if (i == 161) {
                        this.mLimitMDLCacheSize = i2;
                    } else if (i == 183) {
                        this.mEGLNeedWorkAround = i2;
                        if (this.mMediaPlayer != null && i2 == 0) {
                            this.mMediaPlayer.setIntOption(183, i2);
                        }
                    } else if (i != 184) {
                        switch (i) {
                            case 9:
                                this.mDecoderType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(67, i2);
                                    break;
                                }
                                break;
                            case 16:
                                this.mTestAction = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(83, this.mTestAction);
                                    break;
                                }
                                break;
                            case 17:
                                this.mDashEnabled = i2 == 1;
                                break;
                            case 18:
                                this.mUseDNSCache = i2 == 1;
                                break;
                            case 19:
                                this.mDNSExpiredTime = i2;
                                break;
                            case 20:
                                this.mDisableAccurateStart = i2;
                                this.mLogger.setDisableAccurateStart(i2);
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(133, i2);
                                    break;
                                }
                                break;
                            case 21:
                                if (i2 == 1) {
                                    this.mUseVideoModelCache = true;
                                    this.mVideoModelCache = VideoModelCache.getInstance();
                                    VideoModelDBManager.getInstance(this.mContext);
                                    break;
                                } else {
                                    this.mUseVideoModelCache = false;
                                    break;
                                }
                            case 22:
                                VideoModelCache videoModelCache = this.mVideoModelCache;
                                if (videoModelCache != null) {
                                    videoModelCache.setTimeOutInSec(i2);
                                    break;
                                }
                                break;
                            case 23:
                                VideoModelCache videoModelCache2 = this.mVideoModelCache;
                                if (videoModelCache2 != null) {
                                    videoModelCache2.setCacheNb(i2);
                                    break;
                                }
                                break;
                            case 24:
                                this.mLoopStartTime = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(137, i2);
                                    break;
                                }
                                break;
                            case 25:
                                this.mLoopEndTime = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(138, i2);
                                    break;
                                }
                                break;
                            case ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW:
                                this.mReuseSocket = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(154, i2);
                                    break;
                                }
                                break;
                            case IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK:
                                this.mEnableSharp = i2;
                                break;
                            case 110:
                                this.mIsUsePlayerDNS = i2;
                                break;
                            case 118:
                                this.mBufferDataMiliSeconds = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(86, i2);
                                    break;
                                }
                                break;
                            case 120:
                                this.mMediaCodecSyncMode = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(90, i2);
                                    break;
                                }
                                break;
                            case 250:
                                this.mIsTTHlsDrm = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(250, i2);
                                    break;
                                }
                                break;
                            case MotionEventCompat.ACTION_MASK:
                                this.mAudioStreamType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(MotionEventCompat.ACTION_MASK, i2);
                                    break;
                                }
                                break;
                            case b.f2360b:
                                this.mAudioChannelType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(989, i2);
                                    break;
                                }
                                break;
                            case 257:
                                this.mEnablePlaySpeedExtend = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(99, i2);
                                    break;
                                }
                                break;
                            case 258:
                                this.mEnableMasterM3u8Optimize = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK, i2);
                                    break;
                                }
                                break;
                            case 299:
                            case TTVideoEngineInterface.PLAYER_OPTION_USE_AJ_MEDIACODEC:
                                break;
                            case 301:
                                if (!FeatureManager.hasPermission("pcdn")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mP2PCDNType = i2;
                                if (EngineGlobalConfig.getInstance().getPcdnAuto() == 0) {
                                    DataLoaderHelper.getDataLoader().checkLoaderType(this.mP2PCDNType);
                                    break;
                                }
                                break;
                            case 302:
                                if (!FeatureManager.hasPermission("pcdn")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mForbidP2P = i2;
                                break;
                            case 310:
                                this.mNetworkTryCount = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(230, i2);
                                    break;
                                }
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_PREFER_NEARESTSAMPLE:
                                this.mMovPreferNearestSample = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(95, i2);
                                    break;
                                }
                                break;
                            case 312:
                                this.mEnableHttps = i2 == 1;
                                break;
                            case 313:
                                this.mCheckHijack = i2 == 1;
                                break;
                            case 314:
                                this.mTimeBarPercentage = i2;
                                break;
                            case 320:
                            case 472:
                                this.mOutputLog = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(223, i2);
                                }
                                DataLoaderHelper.getDataLoader().setIntValue(512, i2);
                                break;
                            case 321:
                                this.mExposeSignal = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(301, i2);
                                    break;
                                }
                                break;
                            case 322:
                                this.mNotifyBufferingDirectly = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, i2);
                                }
                                this.mLogger.setIntOption(26, i2);
                                break;
                            case 323:
                                this.mMediaCodecSkipNonRef = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(216, i2);
                                    break;
                                }
                                break;
                            case 324:
                                this.mUseQcomLowLatency = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY, i2);
                                    break;
                                }
                                break;
                            case 329:
                                if (!FeatureManager.hasPermission("volume_balance")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mEnableVolumeBalance = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(302, i2);
                                    break;
                                }
                                break;
                            case 330:
                                this.mDisablePlayerTimeOut = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(247, i2);
                                    break;
                                }
                                break;
                            case 331:
                                this.mEnableSeekInterrupt = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(248, this.mEnableSeekInterrupt);
                                    break;
                                }
                                break;
                            case 332:
                                this.mUseCodecPool = i2;
                                MediaPlayer mediaPlayer2 = this.mAsyncPlayer;
                                if (mediaPlayer2 == null) {
                                    mediaPlayer2 = this.mMediaPlayer;
                                }
                                if (mediaPlayer2 != null) {
                                    mediaPlayer2.setIntOption(400, this.mUseCodecPool);
                                    break;
                                }
                                break;
                            case 333:
                                this.mNeedAdaptiveWorkaround = i2;
                                MediaPlayer mediaPlayer3 = this.mAsyncPlayer;
                                if (mediaPlayer3 == null) {
                                    mediaPlayer3 = this.mMediaPlayer;
                                }
                                if (mediaPlayer3 != null) {
                                    mediaPlayer3.setIntOption(254, this.mNeedAdaptiveWorkaround);
                                    break;
                                }
                                break;
                            case 334:
                                this.mScreenWidth = i2;
                                break;
                            case 335:
                                this.mScreenHeight = i2;
                                break;
                            case 339:
                                this.mEnableVideoCodecPixelAlign = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(280, i2);
                                    break;
                                }
                                break;
                            case 341:
                                this.mPlayerViewWidth = i2;
                                i iVar = this.mABRModule;
                                if (iVar != null) {
                                    iVar.a(6, i2);
                                }
                                IVideoEventLogger iVideoEventLogger = this.mLogger;
                                if (iVideoEventLogger != null) {
                                    iVideoEventLogger.setPlayerViewSize(i2, 0);
                                    break;
                                }
                                break;
                            case 342:
                                this.mPlayerViewHeight = i2;
                                i iVar2 = this.mABRModule;
                                if (iVar2 != null) {
                                    iVar2.a(7, i2);
                                }
                                IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                                if (iVideoEventLogger2 != null) {
                                    iVideoEventLogger2.setPlayerViewSize(0, i2);
                                    break;
                                }
                                break;
                            case 343:
                                this.mAEType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(643, i2);
                                    break;
                                }
                                break;
                            case 356:
                                this.mVolumInfoVer = i2;
                                this.mHasSetAEVolumeInfo = true;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1159, i2);
                                    break;
                                }
                                break;
                            case 357:
                                this.mDeviceAEPlayAbility = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1160, i2);
                                    break;
                                }
                                break;
                            case 358:
                                this.mSpeedXDrop = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(358, i2);
                                    break;
                                }
                                break;
                            case 370:
                                this.mEnableLoadControlBufferingTimeout = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(370, i2);
                                    break;
                                }
                                break;
                            case 371:
                                this.mOpenVoiceEarly = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(827, i2);
                                    break;
                                }
                                break;
                            case 372:
                                this.mCloseRenderStartMsgOnSwitchResolutionDone = i2 != 0;
                                break;
                            case 400:
                                this.mIsUseBoe = i2 == 1;
                                break;
                            case 401:
                                this.mEnableOppoControl = i2;
                                break;
                            case 402:
                                this.mSeekEndEnabled = i2;
                                break;
                            case 403:
                                this.mIsUseServerDns = i2 == 1;
                                break;
                            case 410:
                                this.mAsyncPlayHitVMCache = i2 == 1;
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL:
                                TTPlayerConfiger.setValue(24, i2);
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_ENABEL_HARDWARE_DECODE_AUDIO:
                                this.mUseAudioHWDec = i2;
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_DEFAULT_RENDER_TYPE:
                                this.mDefaultRenderType = i2;
                                MediaPlayer mediaPlayer4 = this.mMediaPlayer;
                                break;
                            case 417:
                                this.mSoloPlayEnable = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(185, i2);
                                    break;
                                }
                                break;
                            case 419:
                                this.mBestResolutionType = i2;
                                break;
                            case 420:
                                this.mEnableIndexCache = i2;
                                break;
                            case 421:
                                this.mEnableFragRange = i2;
                                break;
                            case 422:
                                this.mVideoRangeSize = i2;
                                break;
                            case 423:
                                this.mAudioRangeSize = i2;
                                break;
                            case 424:
                                this.mHijackRetryMainDNSType = i2;
                                break;
                            case 425:
                                this.mHijackRetryBackupDNSType = i2;
                                break;
                            case 427:
                                this.mHijackRetry = i2 == 1;
                                break;
                            case 430:
                                this.mVoiceType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(378, i2);
                                    break;
                                }
                                break;
                            case 431:
                                this.mAccurateLayout = i2;
                                break;
                            case 432:
                                this.mSettedKeys.add(1000);
                                if (i2 != 0) {
                                    this.mCodecType = "bytevc2";
                                    break;
                                }
                                break;
                            case 442:
                                this.mAsyncSetAudioProcessor = i2;
                                break;
                            case 450:
                                this.mAllowedExpiredModel = i2 > 0;
                                break;
                            case 460:
                                this.mHardwareDropNonRef = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(252, i2);
                                }
                                this.mLogger.setIntOption(32, this.mHardwareDropNonRef);
                                break;
                            case 470:
                                TTVideoEngineConfig.openPerformanceUtils = i2 == 1;
                                break;
                            case 471:
                                this.mFallbackApiRetry = i2;
                                if (i2 == 1) {
                                    AVMDLURLFetcherBridge.setNewFetcherMaker(FetcherMakerNew.getInstance());
                                    break;
                                } else {
                                    AVMDLURLFetcherBridge.setNewFetcherMaker(null);
                                    break;
                                }
                            case 473:
                                this.mRangeMode = i2;
                                break;
                            case 474:
                                this.mVideoRangeTime = i2;
                                break;
                            case 475:
                                this.mAudioRangeTime = i2;
                                break;
                            case 476:
                                this.mEglVersion = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(b.f2360b, this.mEglVersion);
                                    break;
                                }
                                break;
                            case 478:
                                this.mEnableAsync = i2;
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_DISABLE_EVENTV3_ASYNC:
                                IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                                if (iVideoEventLogger3 != null) {
                                    iVideoEventLogger3.setIntOption(10, i2);
                                    break;
                                }
                                break;
                            case 480:
                                if (!FeatureManager.hasPermission("audio_only")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mRadioModeEnable = i2;
                                this.mLastSwitchRadioModeTime = System.currentTimeMillis();
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(261, i2);
                                }
                                this.mLogger.setIntOption(45, i2);
                                this.mLogger.setIntOption(11, i2);
                                if (shouldStartTextureRenderCheck()) {
                                    this.mTextureSurface.setIntOption(33, 1);
                                    break;
                                } else {
                                    VideoSurface videoSurface = this.mTextureSurface;
                                    if (videoSurface != null && i2 == 1) {
                                        videoSurface.setIntOption(33, 0);
                                        break;
                                    }
                                }
                                break;
                            case 481:
                                this.mDelayBufferingUpdate = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(263, i2);
                                    break;
                                }
                                break;
                            case 482:
                                this.mPostPrepare = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(276, i2);
                                    break;
                                }
                                break;
                            case 483:
                                this.mReadMode = i2;
                                break;
                            case 484:
                                this.mStopSourceAsync = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(278, i2);
                                    break;
                                }
                                break;
                            case 485:
                                this.mDisableHWDecSeamless = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(279, i2);
                                    break;
                                }
                                break;
                            case 486:
                                this.mFirstRangeSize = i2;
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_SET_NETSPEED_LEVEL:
                                this.mNetSpeedLevel = i2;
                                break;
                            case 488:
                                this.mDisableMcReuse = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(401, i2);
                                    break;
                                }
                                break;
                            case 489:
                                this.mSegmentFormatFlag = i2;
                                break;
                            case 490:
                                this.mCodecFrcLevel = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(285, i2);
                                    break;
                                }
                                break;
                            case 491:
                                if (i2 > 0) {
                                    this.mPrepareCacheMs = i2;
                                    if (this.mMediaPlayer != null) {
                                        this.mMediaPlayer.setIntOption(286, i2);
                                        break;
                                    }
                                }
                                break;
                            case 492:
                                this.mUseFallbackAPI = i2 > 0;
                                break;
                            case 493:
                                this.mDirectUrlBashEnabled = i2 == 1;
                                break;
                            case 494:
                                if (!FeatureManager.hasPermission("abr")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mEnableABR = i2;
                                if (i2 > 0) {
                                    if (this.mABRModule == null) {
                                        this.mABRModule = _initABRModule(this.mVideoModel);
                                    }
                                    if (this.mABRModule != null && isSupportSeamlessSwitch(this.mVideoModel)) {
                                        this.mABRModule.c(TTVideoEngine.sABRAlgorithmType, this.mABRTimerIntervalMilliseconds);
                                        this.mLogger.setIsEnableABR(1);
                                    }
                                } else {
                                    i iVar3 = this.mABRModule;
                                    if (iVar3 != null) {
                                        iVar3.c();
                                        this.mLogger.setIsEnableABR(0);
                                    }
                                }
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(172, i2);
                                    break;
                                }
                                break;
                            case 495:
                                this.mUpdateTimestampMode = i2;
                                break;
                            case 496:
                                this.mEnableOpenTimeout = i2;
                                break;
                            case 497:
                                this.mFirstFrameSecOffset = i2 / 1000.0f;
                                break;
                            case 498:
                                this.mLazySeek = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(146, i2);
                                    break;
                                }
                                break;
                            case 499:
                                this.mEnableBarrageMask = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(613, i2);
                                }
                                IVideoEventLogger iVideoEventLogger4 = this.mLogger;
                                if (iVideoEventLogger4 != null) {
                                    iVideoEventLogger4.setIntOption(48, i2);
                                    break;
                                }
                                break;
                            case 500:
                                this.mABRTimerIntervalMilliseconds = i2;
                                break;
                            case 501:
                                this.mABRSwitchSensitivity = i2;
                                break;
                            case 502:
                                this.mABR4GMaxResolutionIndex = i2;
                                break;
                            case 503:
                                this.mABRSwitchMode = i2;
                                break;
                            case 504:
                                this.mABRSwitchCSModel = i2;
                                c.c(i2);
                                break;
                            case 505:
                                this.mABRStartupModel = i2;
                                c.e(i2);
                                break;
                            case 506:
                                this.mABRFixedLevel = i2;
                                c.d(i2);
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_ABR_4GMAX_RESOULUTION_MODE:
                                this.mABR4GMaxResolutionMode = i2;
                                break;
                            case 508:
                                this.mEnableCacheTimeStamp = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(292, i2);
                                    break;
                                }
                                break;
                            case 509:
                                this.mKeepFormatThreadAlive = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(293, i2);
                                    break;
                                }
                                break;
                            case MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_DIR:
                                if (!FeatureManager.hasPermission("subtitle_mask")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mEnableMaskThread = i2;
                                IVideoEventLogger iVideoEventLogger5 = this.mLogger;
                                if (iVideoEventLogger5 != null) {
                                    iVideoEventLogger5.setIntOption(46, i2);
                                    break;
                                }
                                break;
                            case MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME:
                                if (!FeatureManager.hasPermission("subtitle_mask")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mEnableAIBarrageThread = i2;
                                break;
                            case 512:
                                this.mEnableAIBarrage = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(751, i2);
                                    break;
                                }
                                break;
                            case 515:
                                this.mSeekExact = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(515, i2);
                                    break;
                                }
                                break;
                            case 516:
                                this.mSkipBufferTimeout = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(297, i2);
                                    break;
                                }
                                break;
                            case 517:
                                this.mLiveStartIndex = i2;
                                break;
                            case 518:
                                this.mEnableRefreshByTime = i2;
                                break;
                            case 519:
                                this.mUseServerDecodingMode = i2 != 0;
                                break;
                            case 520:
                                this.mClearShutDown = i2 != 0;
                                break;
                            case 521:
                                this.mStandAlongAbrStartUp = i2;
                                if (i2 > 0 && this.mEnableABR == 0) {
                                    TTVideoEngine.sABRAlgorithmType = 4;
                                    break;
                                }
                                break;
                            case 522:
                                this.mEnableSpeedReport = i2 != 0;
                                this.mLogger.setIntOption(18, i2);
                                break;
                            case 523:
                                TTVideoEngine.sReportSpeedInfoMaxWindowSize = i2;
                                this.mLogger.setIntOption(19, i2);
                                break;
                            case 525:
                                this.mABRSpeedPredictOutType = i2;
                                break;
                            case 530:
                                this.mCurrentSubId = i2;
                                if (this.mMediaPlayer != null && this.mLogger != null) {
                                    this.mMediaPlayer.setIntOption(619, i2);
                                    this.mLogger.addSubtitleSwitchTime();
                                    break;
                                }
                                break;
                            case 533:
                                this.mEnableSub = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(618, i2);
                                }
                                IVideoEventLogger iVideoEventLogger6 = this.mLogger;
                                if (iVideoEventLogger6 != null) {
                                    iVideoEventLogger6.setIntOption(49, i2);
                                    break;
                                }
                                break;
                            case 534:
                                if (!FeatureManager.hasPermission("subtitle_mask")) {
                                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                                    return;
                                }
                                this.mEnableSubThread = i2;
                                IVideoEventLogger iVideoEventLogger7 = this.mLogger;
                                if (iVideoEventLogger7 != null) {
                                    iVideoEventLogger7.setIntOption(47, i2);
                                    break;
                                }
                                break;
                            case 536:
                                this.mWifiDefaultResolutionIndex = i2;
                                break;
                            case 537:
                                this.mStartupMaxBitRateIndex = i2;
                                break;
                            case 541:
                                this.mFFCodecerHeaacV2Compat = i2;
                                break;
                            case 542:
                                this.mCleanSurfaceWhenReset = i2;
                                break;
                            case 543:
                                this.mEnableNativeYV12Render = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(542, i2);
                                    break;
                                }
                                break;
                            case 544:
                                this.mDowngradeResolutionIndex = i2;
                                break;
                            case 548:
                                this.mCacheJFrameField = i2;
                                break;
                            case 550:
                                this.mForceCloseCodec = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(550, i2);
                                    break;
                                }
                                break;
                            case 551:
                                this.mFilePlayNoBuffering = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(551, i2);
                                    break;
                                }
                                break;
                            case 552:
                                this.mNoBufferUpdate = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(552, i2);
                                    break;
                                }
                                break;
                            case 557:
                                this.mClipHEAACV2FirstPtsPacket = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(557, i2);
                                    break;
                                }
                                break;
                            case 558:
                                this.mWaitForFetchInfoResult = i2 != 0;
                                break;
                            case 559:
                                this.mEnableVideoTimestampMonotonic = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(558, i2);
                                    break;
                                }
                                break;
                            case 560:
                                this.mFeedPacketUntilEmpty = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(559, i2);
                                    break;
                                }
                                break;
                            case 561:
                                this.mEnableDemuxNonBlockRead = i2;
                                break;
                            case 562:
                                this.mEnableThreadPriority = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(561, i2);
                                    break;
                                }
                                break;
                            case 563:
                                this.mThreadPriorityValue = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(562, i2);
                                    break;
                                }
                                break;
                            case 564:
                                this.mEnableAudioTrackSmoothClock = i2;
                                break;
                            case 565:
                                this.mDisableSpiltVoiceWrite = i2;
                                break;
                            case 566:
                                this.mNativeRenderRotationAdapt = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(565, i2);
                                    break;
                                }
                                break;
                            case 567:
                                this.mIgnoreDirectlyBuffering = i2;
                                break;
                            case 568:
                                this.mOpenSubRetryTimes = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(853, i2);
                                    break;
                                }
                                break;
                            case 569:
                                this.mEnableRecreateSubIfDetached = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(854, i2);
                                    break;
                                }
                                break;
                            case 570:
                                this.mDynamicThreadPriorityValue = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(568, i2);
                                    break;
                                }
                                break;
                            case 571:
                                this.mABRWithSR = i2;
                                break;
                            case 572:
                                this.mEnableMediaCodecRealtime = i2;
                                break;
                            case 573:
                                this.mABROnceType = i2;
                                break;
                            case 574:
                                this.mABRStartupSpeedType = i2;
                                GracieSelector.setSpeedType(i2);
                                break;
                            case 575:
                                this.mEnablePreRenderBufferingUpdate = i2;
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_PRE_RENDER_BUFFERING_UPDATE_PRECENTAGE:
                                this.mPreRenderBufferingUpdatePercentage = i2;
                                break;
                            case 577:
                                this.mEnableHEAACV2PtsMSCorrection = i2;
                                break;
                            case 578:
                                this.mEnableVC1BlockList = i2;
                                break;
                            case 579:
                                this.mEnableHChipAdaptiveWorkAround = i2;
                                break;
                            case 580:
                                this.mEnableMChipSkipAdaptiveWorkAround = i2;
                                break;
                            case 581:
                                this.mEnableCPPBYTEVC1CodecOpt = i2;
                                break;
                            case 582:
                                this.mIgnoreAudioRenderEOSDelayMs = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(664, i2);
                                    break;
                                }
                                break;
                            case 583:
                                this.mGearStrategyEnabled = i2;
                                break;
                            case 584:
                                this.mQuickGetFileCache = i2 == 1;
                                break;
                            case 585:
                                this.mReportFirstFrameFrameBufferOnly = i2;
                                break;
                            case 586:
                                this.mEnbalePreDemux = i2;
                                break;
                            case 587:
                                this.mEnableForceDisableOESRender = i2 == 1;
                                break;
                            case 588:
                                this.mForceDisableOESRender = i2 == 1;
                                break;
                            case 591:
                                this.mEnableCPPBYTEVC2CodecOpt = i2;
                                break;
                            case 592:
                                this.mBytevc2NalsizeCheck = i2;
                                break;
                            case 593:
                                this.mHardwareCodecerFlushClose = i2;
                                break;
                            case 594:
                                this.mOptAudioRenderTimeReport = i2;
                                break;
                            case 595:
                                this.mBT601CloseCodecAsync = i2;
                                break;
                            case 596:
                                if (isPlayerSupportSeekMode()) {
                                    this.mSeekMode = i2;
                                    break;
                                }
                                break;
                            case 597:
                                this.mRenderStallThreshold = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(322, i2);
                                    break;
                                }
                                break;
                            case 598:
                                this.mAudioPtsMSCorrectionExtension = i2;
                                break;
                            case 600:
                                this.mHlsEnabled = i2;
                                break;
                            case 601:
                                this.mEncryptEnabled = i2;
                                break;
                            case 602:
                                this.mPosUpdateInterval = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(647, i2);
                                    break;
                                }
                                break;
                            case 603:
                                this.mEnableClearMDLCache = i2;
                                break;
                            case 604:
                                this.mEnableNetLevel = i2 <= 0 ? 0 : 1;
                                IVideoEventLogger iVideoEventLogger8 = this.mLogger;
                                if (iVideoEventLogger8 != null) {
                                    iVideoEventLogger8.setIntOption(22, i2);
                                    break;
                                }
                                break;
                            case 605:
                                IVideoEventLogger iVideoEventLogger9 = this.mLogger;
                                if (iVideoEventLogger9 != null) {
                                    iVideoEventLogger9.setIntOption(23, i2);
                                    break;
                                }
                                break;
                            case 606:
                                this.mEnableDirectUrlCheck = i2;
                                break;
                            case 607:
                                this.mFindStreamInfoProbeSize = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(536, i2);
                                    break;
                                }
                                break;
                            case 608:
                                this.mFindStreamInfoProbDuration = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(537, i2);
                                    break;
                                }
                                break;
                            case 609:
                                this.mNetworkReconnectCount = i2;
                                break;
                            case 610:
                                this.mDummyAudioSleep = i2;
                                break;
                            case 611:
                                this.mDisablePlayerStayAwake = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(5003, i2);
                                    break;
                                }
                                break;
                            case 612:
                                this.mIsPreDecodeAutoPause = i2 != 0;
                                break;
                            case 613:
                                this.mEnableVideoFrameMetaCallback = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(333, i2);
                                    break;
                                }
                                break;
                            case 618:
                                IVideoEventLogger iVideoEventLogger10 = this.mLogger;
                                if (iVideoEventLogger10 != null) {
                                    iVideoEventLogger10.setIntOption(126, i2);
                                    break;
                                }
                                break;
                            case 620:
                                this.mNoAVSync = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(820, i2);
                                    break;
                                }
                                break;
                            case 621:
                                this.mLogger.setIntOption(177, i2);
                                break;
                            case 650:
                                this.mOverlayMode = i2;
                                break;
                            case 652:
                                this.mRenderHDR2SDR = i2;
                                break;
                            case 654:
                                this.mSyncUpdateSurface = i2;
                                VideoSurface videoSurface2 = this.mTextureSurface;
                                if (videoSurface2 != null) {
                                    videoSurface2.setIntOption(9, i2);
                                    break;
                                }
                                break;
                            case 656:
                                this.mEnableHeartBeat = i2 == 1;
                                break;
                            case 657:
                                if (i2 > 0) {
                                    this.mHeartBeatInterval = i2;
                                    break;
                                }
                                break;
                            case 658:
                                this.mEnableFlushSeek = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(823, i2);
                                    break;
                                }
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME:
                                this.mFirstFrameOpenTexture = i2;
                                break;
                            case 663:
                                this.mGetPositionSkipLooper = i2 == 1;
                                break;
                            case 664:
                                this.mEnableDebugUINotify = i2;
                                break;
                            case 665:
                                this.mGetMasterClockByPts = i2;
                                break;
                            case 666:
                                this.mAlwaysDoAVSync = i2;
                                break;
                            case 668:
                                if (i2 >= 0) {
                                    this.mResumeFileIOBlockThresMs = i2;
                                    break;
                                }
                                break;
                            case 669:
                                this.mEnableOptSubLoadTime = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(828, i2);
                                    break;
                                }
                                break;
                            case 670:
                                this.mEnableFallbackSWDec = i2;
                                break;
                            case 671:
                                this.mHLSSeamlessSwitch = i2 == 1;
                                break;
                            case 673:
                                this.mEnableOutletDropLimit = i2 == 1;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(149, i2);
                                }
                                this.mLogger.setIntOption(97, this.mEnableOutletDropLimit ? 1 : 0);
                                break;
                            case 675:
                                if (this.mMediaPlayer != null && this.mAudioInfoId != i2) {
                                    this.mMediaPlayer.setIntOption(660, i2);
                                }
                                this.mAudioInfoId = i2;
                                break;
                            case 677:
                                this.mThreadSafeRefSwitcher = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(870, i2);
                                    break;
                                }
                                break;
                            case 678:
                                this.mEnableOptSubSearch = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(829, i2);
                                    break;
                                }
                                break;
                            case 679:
                                this.mAVSyncInterruptEnable = i2;
                                break;
                            case 680:
                                this.mEnableClockResumeResetEof = i2;
                                break;
                            case 681:
                                this.mSkipStartWhenPrepared = i2 == 1;
                                break;
                            case 682:
                                this.mNativeCallAbr = i2;
                                break;
                            case 683:
                                this.mEnableAudioMemIntergration = i2;
                                break;
                            case 685:
                                this.mEnableBufferingLowerCapacity = i2;
                                break;
                            case 686:
                                this.mEnableDowngradeAsyncCodec = i2;
                                break;
                            case 687:
                                this.mEnableMediaCodecSyncClose = i2;
                                break;
                            case 688:
                                this.mEnableSeekBuffering = i2;
                                break;
                            case 700:
                                this.mAudioTrackSessionId = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(960, i2);
                                    break;
                                }
                                break;
                            case 703:
                                this.mPreciseCache = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(904, this.mPreciseCache);
                                    break;
                                }
                                break;
                            case TTVideoEngineInterface.PLAYER_OPTION_OPERA_EVENT_REPORT_LEVEL:
                                this.mLogger.setIntOption(100, i2);
                                break;
                            case 705:
                                this.mEnableMp4Check = i2;
                                break;
                            case 706:
                                this.mEnableDeinterlace = i2;
                                break;
                            case 707:
                                this.mSupportPlayWhenNoSurface = i2;
                                break;
                            case 708:
                                this.mEnableTextureRenderNoRenderCheck = i2;
                                VideoSurface videoSurface3 = this.mTextureSurface;
                                if (videoSurface3 != null) {
                                    videoSurface3.setIntOption(34, i2);
                                    break;
                                }
                                break;
                            case 710:
                                this.mEnableTmpLog = i2;
                                this.mLogger.setIntOption(112, i2);
                                break;
                            case 714:
                                this.mStopCloseIO = i2;
                                break;
                            case 717:
                                this.mABRProbeMode = i2;
                                break;
                            case 721:
                                this.mAutoAddMedia = i2;
                                break;
                            case 724:
                                IVideoEventLogger iVideoEventLogger11 = this.mLogger;
                                if (iVideoEventLogger11 != null) {
                                    iVideoEventLogger11.setVrScreenRefreshRate(i2);
                                    break;
                                }
                                break;
                            case 740:
                                TTVideoEngineConfig.setSurfaceTimeoutForCreated = i2;
                                break;
                            case 741:
                                TTVideoEngineConfig.setSurfaceTimeoutForDestroy = i2;
                                break;
                            case 742:
                                this.mEnableGetPlayerReqOffset = i2;
                                break;
                            case 743:
                                this.mFetchWithAbilityOption = i2 == 1;
                                break;
                            case 744:
                                this.mAudioTrackContentType = i2;
                                MediaPlayer mediaPlayer5 = this.mAsyncPlayer;
                                if (mediaPlayer5 == null) {
                                    mediaPlayer5 = this.mMediaPlayer;
                                }
                                if (mediaPlayer5 != null) {
                                    mediaPlayer5.setIntOption(1744, i2);
                                    break;
                                }
                                break;
                            case 746:
                                this.mEnableOptInaccurateStart = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(761, i2);
                                    break;
                                }
                                break;
                            case 747:
                                this.mEnableOptSeekClk = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(762, i2);
                                    break;
                                }
                                break;
                            case 800:
                                this.mMdlEnableSeekReopen = i2;
                                break;
                            case 801:
                                if (i2 != 1) {
                                    if (i2 == 0) {
                                        this.mUseVdpDisk = 1;
                                        break;
                                    }
                                } else {
                                    this.mUseVdpDisk = 0;
                                    break;
                                }
                                break;
                            case 850:
                                this.mEnableDynamicFrameDropping = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1010, i2);
                                    break;
                                }
                                break;
                            case 851:
                                this.mFrameDroppingMultiple = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1011, i2);
                                    break;
                                }
                                break;
                            case 852:
                                this.mFrameDroppingCheckPeriod = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1012, i2);
                                    break;
                                }
                                break;
                            case 853:
                                this.mFrameDroppingCheckCount = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1014, i2);
                                    break;
                                }
                                break;
                            case 854:
                                this.mEnableHWDropFrameWhenVOIsInDropState = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1055, i2);
                                    break;
                                }
                                break;
                            case 855:
                                this.mEnableHWDropFrameWhenAVOutSyncing = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1056, i2);
                                    break;
                                }
                                break;
                            case 856:
                                this.mCodecFramesDrop = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1057, i2);
                                    break;
                                }
                                break;
                            case 857:
                                if (i2 > 0) {
                                    this.mNetSpeedInterval = i2 >= 200 ? i2 : 200;
                                    break;
                                }
                                break;
                            case 858:
                                this.mEnableSubtitleSenseBuffering = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1601, i2);
                                    break;
                                }
                                break;
                            case 859:
                                this.mEnableSubtitleLazyLoading = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1602, i2);
                                    break;
                                }
                                break;
                            case 860:
                                this.mHWMaxFps = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50302, i2);
                                    break;
                                }
                                break;
                            case 861:
                                this.mHWEnableDynamicFrameDropping = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50303, i2);
                                    break;
                                }
                                break;
                            case 862:
                                this.mHWFrameDroppingMultiple = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50304, i2);
                                    break;
                                }
                                break;
                            case 863:
                                this.mHWFrameDroppingCheckPeriod = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50305, i2);
                                    break;
                                }
                                break;
                            case 864:
                                this.mHWFrameDroppingCheckCount = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50306, i2);
                                    break;
                                }
                                break;
                            case 950:
                                this.mSendEngineMsgTimeout = i2;
                                break;
                            case 951:
                                this.mSurfaceHolderByKernel = i2;
                                break;
                            case 952:
                                this.mMediacodecStopTimeout = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(952, i2);
                                    break;
                                }
                                break;
                            case 953:
                                this.mQueryWinEnable = i2;
                                if (this.mMediaPlayer != null && this.mQueryWinEnable != -1) {
                                    this.mMediaPlayer.setIntOption(982, this.mQueryWinEnable);
                                    break;
                                }
                                break;
                            case 954:
                                this.mPreferNearestMaxPosOffset = i2;
                                if (this.mMediaPlayer != null && this.mPreferNearestMaxPosOffset != -1) {
                                    this.mMediaPlayer.setIntOption(985, this.mPreferNearestMaxPosOffset);
                                    break;
                                }
                                break;
                            case 955:
                                this.mMediaCodecAsyncModeEnable = i2;
                                if (this.mMediaPlayer != null && this.mMediaCodecAsyncModeEnable != -1) {
                                    this.mMediaPlayer.setIntOption(1000, this.mMediaCodecAsyncModeEnable);
                                    break;
                                }
                                break;
                            case 956:
                                this.mSettingCodecName = i2;
                                if (this.mMediaPlayer != null && this.mSettingCodecName != -1) {
                                    this.mMediaPlayer.setIntOption(1003, i2);
                                    break;
                                }
                                break;
                            case 958:
                                this.mAVsyncRefined = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1005, i2);
                                    break;
                                }
                                break;
                            case 959:
                                this.mOnlyPlayAudioForBothStream = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1020, i2);
                                    break;
                                }
                                break;
                            case 962:
                                this.mIgnoreSurfaceCreated = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1036, i2);
                                    break;
                                }
                                break;
                            case 963:
                                this.mEnableReportFirstAVSyncFrame = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(475, i2);
                                    break;
                                }
                                break;
                            case 976:
                                this.mDummySurfaceForbid = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1034, i2);
                                    break;
                                }
                                break;
                            case 977:
                                this.mCodecAndSurfaceReuse = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1007, i2);
                                    break;
                                }
                                break;
                            case 978:
                                this.mMCMaxWidth = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1008, i2);
                                    break;
                                }
                                break;
                            case 979:
                                this.mMCMaxHeight = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1009, i2);
                                    break;
                                }
                                break;
                            case 980:
                                this.mForbidBufferingNotFinished = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1035, i2);
                                    break;
                                }
                                break;
                            case 981:
                                this.mAsyncManageResource = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1038, i2);
                                    break;
                                }
                                break;
                            case 982:
                                this.mPlayDurationExcludePlayerMethod = i2 == 1;
                                break;
                            case 983:
                                this.mAudioUseDirectBuffer = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1039, i2);
                                    break;
                                }
                                break;
                            case 984:
                                this.mIsPrepareDecodeOnly = i2 != 0;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1063, i2);
                                    break;
                                }
                                break;
                            case 985:
                                this.mCloseCodecPool = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1040, i2);
                                    break;
                                }
                                break;
                            case 986:
                                this.mMaxCodecNumsInPool = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1041, i2);
                                    break;
                                }
                                break;
                            case 987:
                                this.mCalibrationAudioPts = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1043, i2);
                                    break;
                                }
                                break;
                            case 988:
                                this.mSetSurfaceRetryCount = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1044, i2);
                                    break;
                                }
                                break;
                            case 989:
                                this.mSetSurfaceRetryInterval = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1045, i2);
                                    break;
                                }
                                break;
                            case 990:
                                this.mChangeRecBufferSpeed = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1046, i2);
                                    break;
                                }
                                break;
                            case 991:
                                this.mAutoDisconnectedCpu = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1310, i2);
                                    break;
                                }
                                break;
                            case 992:
                                this.mEnableVideoSecondFrame = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1049, i2);
                                    break;
                                }
                                break;
                            case 993:
                                this.mGiveBackCodecEarly = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1047, i2);
                                    break;
                                }
                                break;
                            case 994:
                                this.mAudioPtsCalibrationType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1311, i2);
                                    break;
                                }
                                break;
                            case 995:
                                this.mWaitingCodecMs = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1048, i2);
                                    break;
                                }
                                break;
                            case 996:
                                this.mRecBufferThresh = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1312, i2);
                                    break;
                                }
                                break;
                            case 998:
                                this.mQueryAdaptivePlayback = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1313, i2);
                                    break;
                                }
                                break;
                            case 1070:
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1070, i2);
                                }
                                this.mHlsSubDemuxerProbeType = i2;
                                break;
                            case 1072:
                                TTVideoEngineConfig.setEGLBitDepth = i2;
                                break;
                            case 1073:
                                this.mSetPlayerSurfaceWithLock = i2;
                                break;
                            case 1074:
                                this.mLogger.setDuration(i2);
                                break;
                            case 1100:
                                this.mAsyncSetWindow = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1316, i2);
                                    break;
                                }
                                break;
                            case 1101:
                                this.mEnableStartPlaySync = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1317, i2);
                                    break;
                                }
                                break;
                            case 1105:
                                this.mFlushWhenSetSurface = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1321, i2);
                                    break;
                                }
                                break;
                            case 1110:
                                this.mCreateAudioTrackEarly = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1325, i2);
                                    break;
                                }
                                break;
                            case 1111:
                                this.mEnableMediaCodecDeathCheck = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1326, i2);
                                    break;
                                }
                                break;
                            case 1112:
                                this.mMediaCodecDeathCheckInterval = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1327, i2);
                                    break;
                                }
                                break;
                            case 1113:
                                this.mMediaCodecDeathTimeout = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1328, i2);
                                    break;
                                }
                                break;
                            case 1114:
                                this.mCodecPoolSupportDynamicExtend = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1329, i2);
                                    break;
                                }
                                break;
                            case 1115:
                                this.mDynamicExtendCodecNums = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1330, i2);
                                    break;
                                }
                                break;
                            case 1117:
                                this.mEnableOptimizeHWDec2SWDec = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1332, i2);
                                    break;
                                }
                                break;
                            case 1118:
                                this.mEnableMediaCodecPipeline = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1333, i2);
                                    break;
                                }
                                break;
                            case 1119:
                                this.mFrameNumsInMediaCodec = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1334, i2);
                                    break;
                                }
                                break;
                            case 1120:
                                this.mEnableMCRenderHandleSAR = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1336, i2);
                                    break;
                                }
                                break;
                            case 1121:
                                this.mUserExitTimeMs = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1340, i2);
                                    break;
                                }
                                break;
                            case 1122:
                                this.mRecBufferType = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1341, i2);
                                    break;
                                }
                                break;
                            case 1123:
                                this.mAudioGraphRefactor = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1337, i2);
                                    break;
                                }
                                break;
                            case 1124:
                                this.mAudioDecoderGraphMerged = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1338, i2);
                                    break;
                                }
                                break;
                            case 1125:
                                this.mCodecPoolVersion = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1344, i2);
                                    break;
                                }
                                break;
                            case 1126:
                                this.mDiscardCodecStrategy1 = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1345, i2);
                                    break;
                                }
                                break;
                            case 1127:
                                this.mDiscardCodecStrategy2 = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1346, i2);
                                    break;
                                }
                                break;
                            case 1128:
                                this.mCodecHistoryLength = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1347, i2);
                                    break;
                                }
                                break;
                            case 1129:
                                this.mCodecMaxUsedCount = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1348, i2);
                                    break;
                                }
                                break;
                            case 1130:
                                this.mEngineRetryNotify = i2;
                                break;
                            case 1133:
                                this.mEnableSetupMediaCodec = i2 > 0;
                                break;
                            case 1134:
                                this.mEnableFallbackInMaxInstanceErr = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1355, i2);
                                    break;
                                }
                                break;
                            case 1135:
                                this.mSetSurfaceDirectly = i2;
                                break;
                            case 1200:
                                this.mEnableFastStop = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1050, i2);
                                    break;
                                }
                                break;
                            case 1202:
                                this.mEnableCodecRecycle = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1052, i2);
                                    break;
                                }
                                break;
                            case 1206:
                                IVideoEventLogger iVideoEventLogger12 = this.mLogger;
                                if (iVideoEventLogger12 != null) {
                                    iVideoEventLogger12.setIntOption(129, i2);
                                    break;
                                }
                                break;
                            case 1207:
                                IVideoEventLogger iVideoEventLogger13 = this.mLogger;
                                if (iVideoEventLogger13 != null) {
                                    iVideoEventLogger13.setIntOption(130, i2);
                                    break;
                                }
                                break;
                            case 1208:
                                IVideoEventLogger iVideoEventLogger14 = this.mLogger;
                                if (iVideoEventLogger14 != null) {
                                    iVideoEventLogger14.setIntOption(131, i2);
                                    break;
                                }
                                break;
                            case 1209:
                                this.mEnableOptimizeMp4Abr = i2;
                                break;
                            case 1210:
                                this.mEnableMediaCodecFairMutex = i2;
                                break;
                            case 1211:
                                this.mEnableRangeOptimize = i2;
                                break;
                            case 1212:
                                this.mThreadName2CharSuffix = i2;
                                break;
                            case 1213:
                                this.mEnableOptimizePrerender = i2;
                                break;
                            case 1214:
                                this.mEnableAsyncDownload = i2;
                                break;
                            case 1215:
                                this.mEnablePreloadGear = i2;
                                break;
                            case 1216:
                                this.mEnableAsyncProbe = i2;
                                break;
                            case 1217:
                                this.mEnableOptimizeAsyncDownload = i2;
                                break;
                            case 1218:
                                this.mMetrcisAbility = i2;
                                break;
                            case 1219:
                                this.mMetrcisInterVal = i2;
                                break;
                            case 1220:
                                this.mEnableCacheInfo = i2;
                                break;
                            case 1221:
                                this.mEnableOptimizeRadioMode = i2;
                                break;
                            case 1222:
                                this.mEnableOptimizeIO = i2;
                                break;
                            case 1223:
                                this.mEnableOptimizeDashSeek = i2;
                                break;
                            case 1224:
                                this.mAnRenderRefreshSurface = i2;
                                break;
                            case 1225:
                                this.mBashRetryRestartPlayer = i2 == 1;
                                break;
                            case 1281:
                                this.mTlsLog = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(480, i2);
                                    break;
                                }
                                break;
                            case 1300:
                                this.mMaskDelayLoading = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1800, i2);
                                    break;
                                }
                                break;
                            case 1301:
                                this.mMaskEnableDataloader = i2;
                                break;
                            case 1302:
                                this.mMaskRangeOpt = i2;
                                break;
                            case 1400:
                                this.mEnablexHEAACSupport = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1900, i2);
                                    break;
                                }
                                break;
                            case 1401:
                                this.mDecodeAACThroughFDKAAC = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1901, i2);
                                    break;
                                }
                                break;
                            case 1402:
                                this.mEnableReportPreloadTraceId = i2 == 1;
                                break;
                            case 1404:
                                this.mEnableAudioSeekingNoAccurate = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(1902, i2);
                                    break;
                                }
                                break;
                            case 1405:
                                this.mAllowAllExtensions = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(50501, i2);
                                    break;
                                }
                                break;
                            case 1406:
                                this.mExtVoiceFormat = i2;
                                break;
                            case 1413:
                                this.mABREnableAggressivePortraitLowBit = i2;
                                break;
                            case 1414:
                                this.mEnableClearTextureRefAsync = i2;
                                break;
                            case 1502:
                                this.mOutputLog = i2;
                                if (this.mMediaPlayer != null) {
                                    this.mMediaPlayer.setIntOption(223, i2);
                                    break;
                                }
                                break;
                            case 1503:
                                this.mEnableTextureRenderNativeWindow = i2;
                                VideoSurface videoSurface4 = this.mTextureSurface;
                                if (videoSurface4 != null) {
                                    videoSurface4.setIntOption(150, i2);
                                    break;
                                }
                                break;
                            case 1504:
                                this.mEnableNotifyRenderException = i2;
                                break;
                            case 1600:
                                this.mEnableFrameCallbackInRenderThread = i2;
                                VideoSurface videoSurface5 = this.mTextureSurface;
                                if (videoSurface5 != null) {
                                    videoSurface5.setIntOption(149, i2);
                                    break;
                                }
                                break;
                            case 4001:
                                this.mForbidFallbackNativeRender = i2;
                                break;
                            case 4002:
                                this.mDecoderRenderContinueRetry = i2;
                                break;
                            case 4003:
                                this.mDecoderRenderClearSurface = i2;
                                break;
                            case 4004:
                                this.mDecoderRenderClearTextureRenderRef = i2;
                                break;
                            case 4005:
                                this.mEnableDecoderRenderVC2RenderLatency = i2;
                                break;
                            case 4006:
                                if (this.mMediaPlayer != null) {
                                    if (i2 == 0) {
                                        this.mMediaPlayer.setIntOption(4006, this.mDecoderRenderVC2RenderLatencySR);
                                        break;
                                    } else {
                                        this.mMediaPlayer.setIntOption(4006, this.mDecoderRenderVC2RenderLatencyGeneral);
                                        break;
                                    }
                                }
                                break;
                            case 4007:
                                this.mDecoderRenderVC2RenderLatencyGeneral = i2;
                                break;
                            case 4008:
                                this.mDecoderRenderVC2RenderLatencySR = i2;
                                break;
                            case 4009:
                                this.mTextureRenderForbidReuseVideoSurfaceTexture = i2;
                                break;
                            case 4010:
                                this.mTextureRenderForbidForbidReuseTexture = i2;
                                break;
                            case 4011:
                                this.mDecoderRenderVC2PreCreateRender = i2;
                                break;
                            case 4012:
                                TTPlayerConfiger.setValue(34, i2);
                                break;
                            case 4013:
                                TTPlayerConfiger.setValue(35, i2);
                                break;
                            case 4014:
                                this.mVC2LowerRenderCapacity = i2;
                                break;
                            case 4015:
                                TTPlayerConfiger.setValue(36, i2);
                                break;
                            case 4016:
                                this.mVC2LowerRenderCapacityNOSR = i2;
                                break;
                            case 4017:
                                this.mVC2DecodecLowLatency = i2;
                                break;
                            case 4018:
                                this.mVC2WppMode = i2;
                                break;
                            case 4019:
                                this.mVC2DynamicControl = i2;
                                if (((i2 & 8) == 8 && this.mHardwareDecodeEnablePlayer2 <= 0) || (this.mVC2DynamicControl & 8) != 8) {
                                    int i4 = this.mVC2DynamicControl;
                                    if ((i4 & 2) == 2) {
                                        this.mEnableBufferingLowerCapacity = 1;
                                    }
                                    if ((i4 & 4) == 4) {
                                        TTPlayerConfiger.setValue(34, 1);
                                        break;
                                    }
                                }
                                break;
                            case 4020:
                                TTPlayerConfiger.setValue(39, i2);
                                break;
                            case 4021:
                                TTPlayerConfiger.setValue(40, i2);
                                break;
                            case 4022:
                                this.mOSPlayerIgnoreHeaders = i2 != 0;
                                break;
                            case 4023:
                                this.mLowerAudioMemCapacity = i2;
                                break;
                            case 4024:
                                this.mVC2ThreadNum = i2;
                                break;
                            case 4025:
                                this.mEnableSurfaceHashmapJudgement = i2;
                                break;
                            case 4100:
                                TTPlayerConfiger.setValue(41, i2);
                                break;
                            case 4101:
                                TTPlayerConfiger.setValue(42, i2);
                                break;
                            case 4200:
                                this.mDisableThreadPoolUsing = i2;
                                break;
                            case 5000:
                                this.mErrorThrowOptEnable = i2 == 1;
                                break;
                            case 5001:
                                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                                    this.mMediaPlayer.setIntOption(5001, i2);
                                }
                                this.mExoRenderReadyMs = i2;
                                break;
                            case 5002:
                                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                                    this.mMediaPlayer.setIntOption(5002, i2);
                                }
                                this.mExoConsecutiveFailNum = i2;
                                break;
                            case 5003:
                                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                                    this.mMediaPlayer.setIntOption(5003, i2);
                                }
                                this.mExoCodecReusable = i2;
                                break;
                            case 5004:
                                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                                    this.mMediaPlayer.setIntOption(5004, i2);
                                }
                                this.mExoCodecAsyncInitEnable = i2;
                                break;
                            case 5005:
                                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                                    this.mMediaPlayer.setIntOption(5005, i2);
                                }
                                this.mExoAllowMediaCodecHelper = i2;
                                break;
                            default:
                                switch (i) {
                                    case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
                                        break;
                                    case 30:
                                        break;
                                    case 31:
                                        if (this.mMediaPlayer != null) {
                                            this.mMediaPlayer.setIntOption(59, i2);
                                            break;
                                        }
                                        break;
                                    case 32:
                                        this.mLoopCount = i2;
                                        if (this.mMediaPlayer != null) {
                                            this.mMediaPlayer.setIntOption(193, i2);
                                            break;
                                        }
                                        break;
                                    case 33:
                                        this.mBashEnabled = i2 == 1;
                                        break;
                                    case 34:
                                        this.mDrmType = i2;
                                        if (this.mMediaPlayer != null) {
                                            this.mMediaPlayer.setIntOption(l.i, i2);
                                            break;
                                        }
                                        break;
                                    default:
                                        switch (i) {
                                            case 36:
                                                this.mDrmDowngrade = i2;
                                                if (this.mMediaPlayer != null) {
                                                    this.mMediaPlayer.setIntOption(208, i2);
                                                    break;
                                                }
                                                break;
                                            case 37:
                                                this.mDrmRetry = i2 == 1;
                                                break;
                                            case 38:
                                                this.mDrmCloseRootCheck = i2;
                                                if (this.mMediaPlayer != null) {
                                                    this.mMediaPlayer.setIntOption(209, i2);
                                                    break;
                                                }
                                                break;
                                            default:
                                                switch (i) {
                                                    case 198:
                                                        this.mIsDisableShortSeek = i2;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(201, i2);
                                                            break;
                                                        }
                                                        break;
                                                    case 199:
                                                        this.mUseTextureRender = i2;
                                                        DisplayMode displayMode = this.mDisplayMode;
                                                        if (displayMode != null) {
                                                            displayMode.setEnable(i2 == 0);
                                                        }
                                                        if (i2 == 1) {
                                                            MediaPlayer mediaPlayer6 = this.mAsyncPlayer;
                                                            if (mediaPlayer6 == null) {
                                                                mediaPlayer6 = this.mMediaPlayer;
                                                            }
                                                            if (mediaPlayer6 != null && this.mTextureSurface == null && (this.mVC2LowerRenderCapacity <= 0 || this.mHardwareDecodeEnablePlayer2 != 0 || this.mRenderType != 5)) {
                                                                setupTextureRender();
                                                                VideoSurface videoSurface6 = this.mTextureSurface;
                                                                if (videoSurface6 != null) {
                                                                    videoSurface6.updateTexDimension(getVideoWidth(), getVideoHeight());
                                                                }
                                                                if (this.mSurfaceHolder != null) {
                                                                    setSurfaceHook(this.mSurfaceHolder.getSurface());
                                                                    break;
                                                                } else if (this.mSurface != null) {
                                                                    setSurfaceHook(this.mSurface);
                                                                    break;
                                                                }
                                                            }
                                                        }
                                                        break;
                                                    case 200:
                                                        this.mBufferDataMiliSeconds = i2 * 1000;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(86, this.mBufferDataMiliSeconds);
                                                            break;
                                                        }
                                                        break;
                                                    case 201:
                                                        this.mTestNetSpeedDiff = i2;
                                                        if (i2 < 500) {
                                                            this.mTestNetSpeedDiff = 500;
                                                            TTVideoEngineLog.e(logcatTag(), "setIntOption: netspeed diff is less than 500ms,set it to 500ms");
                                                        }
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(66, this.mTestNetSpeedDiff);
                                                            break;
                                                        }
                                                        break;
                                                    case 202:
                                                        this.mMaxBufferDataMilliSeconds = i2;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(110, i2);
                                                            break;
                                                        }
                                                        break;
                                                    case 203:
                                                        break;
                                                    case l.g:
                                                        this.mSkipFfmpegFindStreamInfo = i2;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(96, i2);
                                                            break;
                                                        }
                                                        break;
                                                    case l.h:
                                                        this.mMaxFps = i2;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(134, i2);
                                                            break;
                                                        }
                                                        break;
                                                    case l.i:
                                                        IVideoEventLogger iVideoEventLogger15 = this.mLogger;
                                                        if (iVideoEventLogger15 != null) {
                                                            iVideoEventLogger15.didSentEvent(i2);
                                                            break;
                                                        }
                                                        break;
                                                    case 207:
                                                        if (this.mFrameDropNum >= 0) {
                                                            this.mFrameDropNum = i2;
                                                            if (this.mMediaPlayer != null) {
                                                                this.mMediaPlayer.setIntOption(159, i2);
                                                                break;
                                                            }
                                                        } else {
                                                            return;
                                                        }
                                                        break;
                                                    case 208:
                                                        this.mKsyFrameWait = i2;
                                                        if (this.mMediaPlayer != null) {
                                                            this.mMediaPlayer.setIntOption(192, i2);
                                                            break;
                                                        }
                                                        break;
                                                    default:
                                                        switch (i) {
                                                            case 213:
                                                                this.mLoopReferVideo = i2;
                                                                if (this.mMediaPlayer != null) {
                                                                    this.mMediaPlayer.setIntOption(195, i2);
                                                                    break;
                                                                }
                                                                break;
                                                            case 214:
                                                                this.mSkipAudioGraph = i2;
                                                                if (this.mMediaPlayer != null) {
                                                                    this.mMediaPlayer.setIntOption(199, i2);
                                                                    break;
                                                                }
                                                                break;
                                                            case IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY:
                                                                this.mMediaCodecRender = i2;
                                                                if (this.mMediaPlayer != null) {
                                                                    this.mMediaPlayer.setIntOption(88, i2);
                                                                    break;
                                                                }
                                                                break;
                                                            case 216:
                                                                this.mUseMediacodecAudio = i2;
                                                                if (this.mMediaPlayer != null) {
                                                                    this.mMediaPlayer.setIntOption(97, i2);
                                                                    break;
                                                                }
                                                                break;
                                                            default:
                                                                super.setIntOption(i, i2);
                                                                break;
                                                        }
                                                }
                                        }
                                }
                        }
                    } else {
                        this.mOriginalRetry = i2;
                        if (this.mMediaPlayer != null) {
                            this.mMediaPlayer.setIntOption(197, i2);
                        }
                    }
                } else {
                    this.mBufferTimeout = i2;
                    this.mSettedKeys.add(Integer.valueOf(i));
                    if (this.mMediaPlayer != null) {
                        this.mMediaPlayer.setIntOption(81, i2);
                    }
                    this.mLogger.setIntOption(24, i2);
                }
            } else {
                if ((i2 == 1 || i2 == 2) && !FeatureManager.hasPermission("vr_panorama")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mRenderType = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, i2);
                }
            }
        } else {
            this.mPlayerCache = i2;
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setIntOption(24, i2);
            }
        }
        i3 = i2;
        TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
    }

    void _doParseIPAddress(IVideoModel iVideoModel) {
        int i;
        String str;
        int i2;
        String str2;
        int i3;
        String[] strArr;
        int i4;
        boolean z;
        String str3;
        Error error;
        int i5;
        String str4;
        String[] strArr2;
        ?? r7;
        int i6;
        int i7;
        int i8;
        int i9;
        VideoInfo videoInfo;
        int i10;
        String str5;
        String str6;
        int i11;
        int i12;
        String str7;
        String[] strArr3;
        ArrayList arrayList;
        String str8;
        VideoInfo videoInfo2;
        int i13;
        boolean z2;
        VideoInfo videoInfo3;
        String str9;
        String str10;
        f a2;
        IGearStrategyListener iGearStrategyListener;
        Object obj;
        Map<String, String> map;
        String str11;
        long j;
        String str12;
        int i14;
        int i15;
        int i16;
        int i17;
        int i18;
        int i19;
        int i20;
        int i21;
        Object value;
        IVideoInfo videoInfoByBitrate;
        boolean z3;
        int i22;
        float f;
        float f2;
        float f3;
        float f4;
        long j2;
        long j3;
        long j4;
        i iVar;
        int i23;
        i iVar2;
        Iterator<VideoInfo> it2;
        String str13;
        Object value2;
        Resolution resolution;
        boolean z4;
        IVideoModel iVideoModel2 = iVideoModel;
        if (iVideoModel2 == null) {
            receivedError(new Error("kTTVideoErrorDomainFetchingInfo", -9997, "_parseIPAddress:VideoModel is empty"));
            return;
        }
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_doParseIPAddress should stop");
            return;
        }
        int configInt = getConfigInt(34, this.mDrmType);
        if (configInt == 2 && this.mPlayerType == 2 && !_initIntertrustDrm()) {
            return;
        }
        IVideoModel iVideoModel3 = this.mVideoModel;
        if (iVideoModel3 != null) {
            String dynamicType = iVideoModel3.getDynamicType();
            if (!TextUtils.isEmpty(dynamicType) && dynamicType.equals("segment_base") && this.mVideoModelVersion == 3) {
                this.mBashEnabled = true;
                this.mEngineConfig.setIntOption(33, 1);
            }
        }
        if (this.mSRStrategy.getSRStrategyMode() == 0) {
            SRStrategyConfig sRStrategyConfig = new SRStrategyConfig();
            sRStrategyConfig.setMaxWidth(this.mMaxTextureWidth).setMaxHeight(this.mMaxTextureHeight);
            int i24 = iVideoModel2.hasFormat(IVideoModel.Format.DASH) ? 2 : 0;
            if (iVideoModel2.hasFormat(IVideoModel.Format.MP4)) {
                i24 |= 1;
            }
            sRStrategyConfig.setCurrentVideoFormatType(i24);
            sRStrategyConfig.setCurrentDuration(iVideoModel2.getVideoRefInt(3));
            List<VideoInfo> videoInfoList = iVideoModel.getVideoInfoList();
            if (videoInfoList != null && videoInfoList.size() > 0) {
                Iterator<VideoInfo> it3 = videoInfoList.iterator();
                while (it3.hasNext()) {
                    String valueStr = it3.next().getValueStr(7);
                    if (valueStr != null && valueStr.toLowerCase().contains("hdr")) {
                        z4 = true;
                        break;
                    }
                }
            }
            z4 = false;
            sRStrategyConfig.setIsHdr(z4);
            this.mSRStrategy.updateConfig(sRStrategyConfig);
        }
        int configInt2 = getConfigInt(419, this.mBestResolutionType);
        int configInt3 = getConfigInt(583, this.mGearStrategyEnabled);
        String str14 = "";
        if (this.mHasFirstFrameShown) {
            i = configInt2;
            str = "";
            i2 = configInt;
            str2 = "kTTVideoErrorDomainFetchingInfo";
            i3 = configInt3;
        } else {
            if (this.mStandAlongAbrStartUp > 0 && this.mEnableABR == 0 && configInt3 == 0) {
                long currentTimeMillis = System.currentTimeMillis();
                i fromPreloaded = ABRPool.getInstance().getFromPreloaded(iVideoModel2.getVideoRefStr(2));
                if (fromPreloaded == null) {
                    fromPreloaded = ABRPool.getInstance().getFromCache();
                    if (fromPreloaded == null) {
                        fromPreloaded = new DefaultABRModule();
                        z3 = false;
                    } else {
                        z3 = true;
                    }
                    setMediaInfo2Abr(fromPreloaded, iVideoModel2);
                } else {
                    z3 = true;
                }
                if (this.expectedResolution != Resolution.Auto && ((resolution = this.expectedResolution) != null || this.expectedParams != null)) {
                    VideoInfo videoInfo4 = iVideoModel2.getVideoInfo(resolution, this.expectedParams, true);
                    if (videoInfo4 != null) {
                        long valueInt = videoInfo4.getValueInt(3);
                        fromPreloaded.a(22, valueInt);
                        this.mUserExpectedBitrate = valueInt;
                    }
                } else {
                    this.mUserExpectedBitrate = -1L;
                    fromPreloaded.a(22, -1L);
                }
                Resolution valueOf = Resolution.valueOf(getConfigInt(544, this.mDowngradeResolutionIndex));
                String configString = getConfigString(545, this.mDowngradeResolutionQuality);
                if (valueOf != Resolution.Undefine || !TextUtils.isEmpty(configString)) {
                    HashMap hashMap = new HashMap();
                    hashMap.put(32, configString);
                    VideoInfo videoInfo5 = iVideoModel2.getVideoInfo(valueOf, (Map<Integer, String>) hashMap, false);
                    if (videoInfo5 != null) {
                        long valueInt2 = videoInfo5.getValueInt(3);
                        fromPreloaded.a(33, valueInt2);
                        this.mDowngradeBitrate = valueInt2;
                    }
                } else {
                    this.mDowngradeBitrate = -1L;
                    fromPreloaded.a(33, -1L);
                }
                if (fromPreloaded != null) {
                    setMediaBuffer2Abr(fromPreloaded, iVideoModel2);
                    fromPreloaded.a(14, 1);
                    float f5 = 0.0f;
                    if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                        Map<String, String> b2 = StrategyCenter.sNetAbrSpeedPredictor.b(VideoRef.TYPE_VIDEO);
                        if (b2 != null && b2.get("download_speed") != null) {
                            f5 = Float.parseFloat(b2.get("download_speed"));
                        }
                        float a3 = StrategyCenter.sNetAbrSpeedPredictor.a(0);
                        f3 = StrategyCenter.sNetAbrSpeedPredictor.e();
                        f4 = StrategyCenter.sNetAbrSpeedPredictor.a(VideoRef.TYPE_VIDEO, 1, true);
                        f2 = StrategyCenter.sNetAbrSpeedPredictor.a(VideoRef.TYPE_VIDEO, this.mABRStartupSpeedType, false);
                        f = a3;
                    } else {
                        f = 0.0f;
                        f2 = 0.0f;
                        f3 = 0.0f;
                        f4 = 0.0f;
                    }
                    fromPreloaded.a(25, f5);
                    fromPreloaded.a(23, f);
                    fromPreloaded.a(24, f3);
                    fromPreloaded.a(27, f4);
                    fromPreloaded.a(28, f2);
                    fromPreloaded.a(21, TTNetWorkListener.getInstance().getCurrentAccessType());
                    HARInfo hARInfo = TTVideoEngine.getHARInfo();
                    if (hARInfo != null) {
                        fromPreloaded.a(70, hARInfo.getHARStatus());
                        fromPreloaded.a(71, hARInfo.getHARScore());
                    }
                    fromPreloaded.a(39, (this.mSRStrategy.isSREnabled() && getConfigInt(571, this.mABRWithSR) == 1) ? 1 : 0);
                    boolean isSRSatisfied = this.mSRStrategy.isSRSatisfied();
                    fromPreloaded.a(40, isSRSatisfied ? 1 : 0);
                    fromPreloaded.b(this.mSRStrategy.getSRBenchmark());
                    this.mSRStrategy.setStrategyInfo("srs", Integer.valueOf(isSRSatisfied ? 1 : 0));
                    fromPreloaded.a(75, this.mTag);
                    fromPreloaded.a(76, this.mSubTag);
                    this.mAbrVer = fromPreloaded.a();
                    ABRResult b3 = fromPreloaded.b(getConfigInt(573, this.mABROnceType), 1);
                    if (fromPreloaded.b(79, 0L) > 0) {
                        HashMap hashMap2 = new HashMap();
                        hashMap2.put("cap_adaptive_bitrate", Arrays.asList("origin_audio_review_status", "item_category_0"));
                        this.mLogger.addLabelUsage(hashMap2);
                    }
                    if (fromPreloaded.b(80, 0L) > 0) {
                        HashMap hashMap3 = new HashMap();
                        hashMap3.put("per_adaptive_bitrate", Arrays.asList("score", "enter_full_screen"));
                        this.mLogger.addLabelUsage(hashMap3);
                    }
                    Map<String, Object> parseABRResult = GearStrategy.parseABRResult(b3);
                    if (parseABRResult != null) {
                        Object obj2 = parseABRResult.get("video_bitrarte");
                        j2 = obj2 != null ? ((Long) obj2).longValue() : 0L;
                        Object obj3 = parseABRResult.get("audio_bitrarte");
                        long longValue = obj3 != null ? ((Long) obj3).longValue() : 0L;
                        Object obj4 = parseABRResult.get("video_bitrarte_origin");
                        long longValue2 = obj4 != null ? ((Long) obj4).longValue() : 0L;
                        Object obj5 = parseABRResult.get("downgrade_type");
                        if (obj5 != null) {
                            this.mStartupDowngradeType = ((Integer) obj5).intValue();
                        }
                        long j5 = longValue2;
                        i2 = configInt;
                        j4 = longValue;
                        j3 = j5;
                    } else {
                        i2 = configInt;
                        j2 = 0;
                        j3 = 0;
                        j4 = 0;
                    }
                    GearStrategyConfig gearStrategyConfig = this.mGearStrategyConfig;
                    if (gearStrategyConfig == null || gearStrategyConfig.getGearStrategyListener() == null) {
                        i22 = configInt2;
                        str2 = "kTTVideoErrorDomainFetchingInfo";
                    } else {
                        HashMap hashMap4 = new HashMap();
                        str2 = "kTTVideoErrorDomainFetchingInfo";
                        hashMap4.put("video_bitrarte", "" + j2);
                        hashMap4.put("video_bitrarte_origin", "" + j3);
                        i22 = configInt2;
                        this.mGearStrategyConfig.getGearStrategyListener().onAfterSelect(iVideoModel2, hashMap4, 1, this.mGearStrategyConfig.getUserData());
                    }
                    TTVideoEngineLog.i(logcatTag(), "[GearStrategy]parseABRResult: videoBitrate=" + j2 + " audioBitrate=" + j4 + " bitrateOrigin=" + j3 + " downgradeType=" + this.mStartupDowngradeType);
                    if (this.mSRStrategy.getSRStrategyMode() == 0) {
                        if (1 == this.mStartupDowngradeType) {
                            this.mUseSRTexture = true;
                            this.mTextureSrOpen = 1;
                            this.mSRNotUseReason = 0;
                            SRStrategyConfig config = this.mSRStrategy.getConfig();
                            if (config != null && (value2 = config.getValue(1, null)) != null) {
                                setEffect((Bundle) value2);
                            }
                        } else {
                            this.mUseSRTexture = false;
                            this.mTextureSrOpen = 0;
                            this.mSRNotUseReason = this.mSRStrategy.getSRNotUseReason();
                        }
                    }
                    long j6 = j2 + j4;
                    this.currentBitrate = j6;
                    this.mStartUpBitrate = j6;
                    long j7 = j2;
                    long j8 = j4;
                    this.mMaxCacheBitrate = fromPreloaded.b(15, -1L);
                    this.mAbrStartupBitrateBeforeFitScreen = fromPreloaded.b(44, -1L);
                    this.mAbrStartUpSpeed = fromPreloaded.b(16, -1.0f);
                    this.mAbrStartUpPredictSpeed = fromPreloaded.b(17, -1.0f);
                    this.mAbrStartUpAverageSpeed = fromPreloaded.b(18, -1.0f);
                    this.mAbrSrInfo = fromPreloaded.b(74, "");
                    this.mAbrStartupInfo = fromPreloaded.b(77, "");
                    this.mStartupSwitchCSModel = c.c();
                    this.mStartupModel = c.e();
                    TTVideoEngineLog.i(logcatTag(), "[SelectorLog] standalong abr startup bitrate=" + j6 + " bitrateShiftFrom=" + j3 + " fromPool=" + z3);
                    List<VideoInfo> videoInfoList2 = iVideoModel.getVideoInfoList();
                    if (j6 <= 0 || videoInfoList2 == null) {
                        i3 = configInt3;
                        iVar = fromPreloaded;
                        str10 = "";
                    } else {
                        Resolution resolution2 = this.currentResolution;
                        HashMap hashMap5 = new HashMap();
                        Iterator<VideoInfo> it4 = videoInfoList2.iterator();
                        while (it4.hasNext()) {
                            VideoInfo next = it4.next();
                            if (next == null || next.getMediatype() == VideoRef.TYPE_AUDIO || next.getResolution() == null) {
                                i23 = configInt3;
                                iVar2 = fromPreloaded;
                                it2 = it4;
                                str13 = str14;
                            } else {
                                i23 = configInt3;
                                iVar2 = fromPreloaded;
                                long valueInt3 = next.getValueInt(3);
                                StringBuilder sb = new StringBuilder();
                                it2 = it4;
                                sb.append("resolution=");
                                str13 = str14;
                                sb.append(next.getResolution().toString(VideoRef.TYPE_VIDEO));
                                sb.append(", resolutionBitRate =");
                                sb.append(valueInt3);
                                TTVideoEngineLog.i("SelectorLog", sb.toString());
                                if (valueInt3 == j6) {
                                    Resolution resolution3 = next.getResolution();
                                    if (!TextUtils.isEmpty(next.getValueStr(32))) {
                                        hashMap5.put(32, next.getValueStr(32));
                                    }
                                    resolution2 = resolution3;
                                }
                                if (j3 > 0 && valueInt3 == j3) {
                                    this.mResolutionBeforeDowngrade = next.getResolution();
                                    this.mQualityDescBeforeDowngrade = next.getValueStr(32);
                                }
                            }
                            configInt3 = i23;
                            fromPreloaded = iVar2;
                            it4 = it2;
                            str14 = str13;
                        }
                        i3 = configInt3;
                        iVar = fromPreloaded;
                        str10 = str14;
                        this.currentResolution = resolution2;
                        if (hashMap5.size() > 0) {
                            this.currentParams = hashMap5;
                        }
                    }
                    if (z3) {
                        ABRPool.getInstance().giveBack(iVar);
                    } else {
                        iVar.d();
                    }
                    long currentTimeMillis2 = System.currentTimeMillis();
                    this.mGearStrategyEvent.put("vbitrate", Long.valueOf(j7));
                    this.mGearStrategyEvent.put("vbitrateo", Long.valueOf(j3));
                    this.mGearStrategyEvent.put("abitrate", Long.valueOf(j8));
                    this.mGearStrategyEvent.put(com.bytedance.ies.android.loki.ability.method.b.f17368a, Integer.valueOf(this.mStartupDowngradeType));
                    this.mGearStrategyEvent.put("begin", Long.valueOf(currentTimeMillis));
                    this.mGearStrategyEvent.put("end", Long.valueOf(currentTimeMillis2));
                } else {
                    i22 = configInt2;
                    str10 = "";
                    i2 = configInt;
                    str2 = "kTTVideoErrorDomainFetchingInfo";
                    i3 = configInt3;
                }
                i = i22;
            } else {
                str10 = "";
                i2 = configInt;
                str2 = "kTTVideoErrorDomainFetchingInfo";
                i3 = configInt3;
                if (i3 > 0 && this.mEnableABR == 0) {
                    long currentTimeMillis3 = System.currentTimeMillis();
                    if (this.mGearStrategyConfig == null) {
                        this.mGearStrategyConfig = new GearStrategyConfig();
                    }
                    this.mGearStrategyConfig.setIntValueIfNotExist(4, i3);
                    this.mGearStrategyConfig.setStringValueIfNotExist(28, this.mTag);
                    this.mGearStrategyConfig.setStringValueIfNotExist(29, this.mSubTag);
                    this.mGearStrategyConfig.setIntValueIfNotExist(24, getConfigInt(334, this.mScreenWidth));
                    this.mGearStrategyConfig.setIntValueIfNotExist(25, getConfigInt(335, this.mScreenHeight));
                    this.mGearStrategyConfig.setIntValueIfNotExist(26, this.mPlayerViewWidth);
                    this.mGearStrategyConfig.setIntValueIfNotExist(27, this.mPlayerViewHeight);
                    this.mGearStrategyConfig.setIntValueIfNotExist(23, getConfigInt(584, this.mQuickGetFileCache ? 1 : 0));
                    this.mGearStrategyConfig.setIntValueIfNotExist(12, getConfigInt(571, this.mABRWithSR));
                    this.mGearStrategyConfig.setIntValueIfNotExist(13, this.mSRStrategy.isSREnabled() ? 1 : 0);
                    boolean isSRSatisfied2 = this.mSRStrategy.isSRSatisfied();
                    this.mGearStrategyConfig.setIntValueIfNotExist(14, isSRSatisfied2 ? 1 : 0);
                    this.mGearStrategyConfig.setObjectValueIfNotExist(15, this.mSRStrategy.getSRBenchmark());
                    GearStrategy.getSrSupportBitrate(iVideoModel2, this.mSRStrategy, this.mGearStrategyConfig);
                    GearStrategyConfig gearStrategyConfig2 = this.mGearStrategyConfig;
                    if (gearStrategyConfig2 != null) {
                        IGearStrategyListener gearStrategyListener = gearStrategyConfig2.getGearStrategyListener();
                        obj = this.mGearStrategyConfig.getUserData();
                        map = this.mGearStrategyConfig.getParam();
                        iGearStrategyListener = gearStrategyListener;
                    } else {
                        iGearStrategyListener = null;
                        obj = null;
                        map = null;
                    }
                    if (iGearStrategyListener != null) {
                        iGearStrategyListener.onBeforeSelect(iVideoModel2, map, 1, obj);
                    }
                    Map<String, String> select = GearStrategy.select(iVideoModel2, 1, this.mGearStrategyConfig);
                    if (iGearStrategyListener != null) {
                        iGearStrategyListener.onAfterSelect(iVideoModel2, select, 1, obj);
                    }
                    if (select != null) {
                        int stringMapGetInt = GearStrategy.stringMapGetInt(select, "video_bitrarte", 0);
                        int stringMapGetInt2 = GearStrategy.stringMapGetInt(select, "video_bitrarte_origin", 0);
                        int stringMapGetInt3 = GearStrategy.stringMapGetInt(select, "audio_bitrarte", 0);
                        i18 = GearStrategy.stringMapGetInt(select, "error_code", 0);
                        int stringMapGetInt4 = GearStrategy.stringMapGetInt(select, "strategy_type", -1);
                        i20 = GearStrategy.stringMapGetInt(select, "strategy_module", -1);
                        int stringMapGetInt5 = GearStrategy.stringMapGetInt(select, "expected_bitrate", -1);
                        int stringMapGetInt6 = GearStrategy.stringMapGetInt(select, "bdowngrade_bitrate", -1);
                        str11 = str10;
                        String stringMapGetString = GearStrategy.stringMapGetString(select, "extra_info", str11);
                        this.mStartupDowngradeType = GearStrategy.stringMapGetInt(select, "downgrade_type", this.mStartupDowngradeType);
                        this.mAbrUserQualitySensitivity = GearStrategy.stringMapGetFloat(select, "user_quality_sen", this.mAbrUserQualitySensitivity);
                        this.mAbrUserEnterFullScreen = GearStrategy.stringMapGetInt(select, "user_enter_fullscreen", this.mAbrUserEnterFullScreen);
                        this.mMaxCacheBitrate = GearStrategy.stringMapGetLong(select, "max_cache_bitrate", this.mMaxCacheBitrate);
                        this.mAbrStartupBitrateBeforeFitScreen = GearStrategy.stringMapGetLong(select, "bitrate_before_fit_screen", this.mAbrStartupBitrateBeforeFitScreen);
                        this.mAbrStartUpSpeed = GearStrategy.stringMapGetFloat(select, "startup_speed", this.mAbrStartUpSpeed);
                        this.mAbrStartUpPredictSpeed = GearStrategy.stringMapGetFloat(select, "predict_speed", this.mAbrStartUpPredictSpeed);
                        this.mAbrStartUpAverageSpeed = GearStrategy.stringMapGetFloat(select, "average_speed", this.mAbrStartUpAverageSpeed);
                        this.mAbrVer = GearStrategy.stringMapGetString(select, "abr_ver", this.mAbrVer);
                        this.mAbrSrInfo = GearStrategy.stringMapGetString(select, "sr_info", this.mAbrSrInfo);
                        this.mAbrStartupInfo = GearStrategy.stringMapGetString(select, "startup_info", this.mAbrStartupInfo);
                        str12 = stringMapGetString;
                        i19 = stringMapGetInt5;
                        i16 = stringMapGetInt;
                        i15 = stringMapGetInt4;
                        i14 = stringMapGetInt6;
                        j = currentTimeMillis3;
                        i21 = stringMapGetInt3;
                        i17 = stringMapGetInt2;
                    } else {
                        str11 = str10;
                        j = currentTimeMillis3;
                        str12 = str11;
                        i14 = -1;
                        i15 = -1;
                        i16 = 0;
                        i17 = 0;
                        i18 = 0;
                        i19 = -1;
                        i20 = -1;
                        i21 = 0;
                    }
                    long j9 = i16;
                    this.currentBitrate = j9;
                    this.mStartUpBitrate = j9;
                    this.mStartupSwitchCSModel = GearStrategy.getGlobalConfig().getIntValue(44);
                    this.mStartupModel = GearStrategy.getGlobalConfig().getIntValue(46);
                    if (i16 > 0) {
                        IVideoInfo videoInfoByBitrate2 = GearStrategy.getVideoInfoByBitrate(iVideoModel2, i16, EngineGlobalConfig.getInstance().getEnableUseRealBitrate());
                        if (videoInfoByBitrate2 != null) {
                            this.currentResolution = videoInfoByBitrate2.getResolution();
                            this.currentParams = TTVideoEngineHelper.paramsFromVideoInfo(videoInfoByBitrate2);
                        }
                        str10 = str11;
                        i = configInt2;
                    } else {
                        String logcatTag = logcatTag();
                        StringBuilder sb2 = new StringBuilder();
                        str10 = str11;
                        sb2.append("[GearStrategy] gear strategy videoBitrate <=0 findBestResolution mBestResolutionType=");
                        i = configInt2;
                        sb2.append(i);
                        TTVideoEngineLog.i(logcatTag, sb2.toString());
                        this.mLogger.setIntOption(104, i18);
                        this.currentResolution = TTVideoEngine.findBestResolution(iVideoModel2, this.currentResolution, i, this.mSpeedShiftConfig);
                    }
                    if (i17 > 0 && i17 != i16 && (videoInfoByBitrate = GearStrategy.getVideoInfoByBitrate(iVideoModel2, i17, EngineGlobalConfig.getInstance().getEnableUseRealBitrate())) != null) {
                        this.mResolutionBeforeDowngrade = videoInfoByBitrate.getResolution();
                        this.mQualityDescBeforeDowngrade = videoInfoByBitrate.getValueStr(32);
                    }
                    this.mUserExpectedBitrate = i19;
                    this.mDowngradeBitrate = i14;
                    if (this.mSRStrategy.getSRStrategyMode() == 0) {
                        if (1 == this.mStartupDowngradeType) {
                            this.mUseSRTexture = true;
                            this.mTextureSrOpen = 1;
                            this.mSRNotUseReason = 0;
                            SRStrategyConfig config2 = this.mSRStrategy.getConfig();
                            if (config2 != null && (value = config2.getValue(1, null)) != null) {
                                setEffect((Bundle) value);
                            }
                        } else {
                            this.mUseSRTexture = false;
                            this.mTextureSrOpen = 0;
                            this.mSRNotUseReason = this.mSRStrategy.getSRNotUseReason();
                        }
                    }
                    this.mSRStrategy.setStrategyInfo("srs", Integer.valueOf(isSRSatisfied2 ? 1 : 0));
                    long currentTimeMillis4 = System.currentTimeMillis();
                    this.mGearStrategyEvent.put("vbitrate", Integer.valueOf(i16));
                    this.mGearStrategyEvent.put("vbitrateo", Integer.valueOf(i17));
                    this.mGearStrategyEvent.put("abitrate", Integer.valueOf(i21));
                    this.mGearStrategyEvent.put(com.bytedance.ies.android.loki.ability.method.b.f17368a, Integer.valueOf(this.mStartupDowngradeType));
                    this.mGearStrategyEvent.put("error", Integer.valueOf(i18));
                    this.mGearStrategyEvent.put("stype", Integer.valueOf(i15));
                    this.mGearStrategyEvent.put("smodule", Integer.valueOf(i20));
                    if (!TextUtils.isEmpty(str12)) {
                        this.mGearStrategyEvent.put("extra", str12);
                    }
                    this.mGearStrategyEvent.put("begin", Long.valueOf(j));
                    this.mGearStrategyEvent.put("end", Long.valueOf(currentTimeMillis4));
                    TTVideoEngineLog.i(logcatTag(), "[GearStrategy] gear strategy startup mGearStrategyEnabled=" + i3 + " videoBitrate=" + i16 + " videoBitrateOrigin=" + i17 + " audioBitrate=" + i21 + " downgrade=" + this.mStartupDowngradeType + " strategyType=" + i15 + " strategyModule=" + i20 + " selectErrorCode=" + i18);
                } else {
                    i = configInt2;
                    if (this.mEnableABR > 0) {
                        if (this.mABRModule == null && isSupportSeamlessSwitch(this.mVideoModel)) {
                            this.mABRModule = _initABRModule(iVideoModel);
                        }
                        if (this.mABRModule != null && this.mEnableABR > 0 && getConfigInt(503, this.mABRSwitchMode) == 0) {
                            setMediaBuffer2Abr(this.mABRModule, this.mVideoModel);
                            this.mABRModule.a(26, this.mPlayStartTimestamp);
                            this.mAbrVer = this.mABRModule.a();
                            ABRResult b4 = this.mABRModule.b(getConfigInt(573, this.mABROnceType), 1);
                            if (this.mABRModule.b(79, 0L) > 0) {
                                HashMap hashMap6 = new HashMap();
                                hashMap6.put("cap_adaptive_bitrate", Arrays.asList("origin_audio_review_status", "item_category_0"));
                                this.mLogger.addLabelUsage(hashMap6);
                            }
                            if (this.mABRModule.b(80, 0L) > 0) {
                                HashMap hashMap7 = new HashMap();
                                hashMap7.put("per_adaptive_bitrate", Arrays.asList("score", "enter_full_screen"));
                                this.mLogger.addLabelUsage(hashMap7);
                            }
                            this.mMaxCacheBitrate = this.mABRModule.b(15, -1L);
                            this.mAbrStartupBitrateBeforeFitScreen = this.mABRModule.b(44, -1L);
                            this.mAbrStartUpSpeed = this.mABRModule.b(16, -1.0f);
                            this.mAbrStartUpPredictSpeed = this.mABRModule.b(17, -1.0f);
                            this.mAbrStartUpAverageSpeed = this.mABRModule.b(18, -1.0f);
                            str = str10;
                            this.mAbrSrInfo = this.mABRModule.b(74, str);
                            this.mAbrStartupInfo = this.mABRModule.b(77, str);
                            this.mStartupSwitchCSModel = c.c();
                            this.mStartupModel = c.e();
                            if (b4 != null && (a2 = b4.a(0)) != null) {
                                long j10 = a2.f34313a;
                                this.mStartUpBitrate = j10;
                                this.currentBitrate = j10;
                                this.mPredictStartBitrate = j10;
                                TTVideoEngineLog.d(logcatTag(), "[ABR] predict start bitrate:" + j10 + " bps");
                                IVideoInfo infoFromBitrate = TTVideoEngineHelper.infoFromBitrate(iVideoModel2, j10);
                                Map<Integer, String> paramsFromVideoInfo = TTVideoEngineHelper.paramsFromVideoInfo(infoFromBitrate);
                                if (infoFromBitrate != null) {
                                    this.currentResolution = infoFromBitrate.getResolution();
                                    this.currentParams = paramsFromVideoInfo;
                                }
                            }
                        }
                    } else {
                        str = str10;
                        this.currentResolution = TTVideoEngine.findBestResolution(iVideoModel2, this.currentResolution, i, this.mSpeedShiftConfig);
                    }
                }
            }
            str = str10;
        }
        TTVideoEngineLog.i(logcatTag(), "find best resolution type: " + i + " resolution: " + _resolutionToString(this.currentResolution) + " abr standalong:" + this.mStandAlongAbrStartUp);
        Map<Integer, String> map2 = this.currentParams;
        if (map2 != null && map2.containsKey(32)) {
            TTVideoEngineLog.i(logcatTag(), "find quality:" + this.currentParams.get(32));
        }
        String[] codecs = iVideoModel.getCodecs();
        if (codecs != null || codecs.length > 0) {
            this.mCodecType = "h264";
            int length = codecs.length;
            int i25 = 0;
            while (true) {
                if (i25 >= length) {
                    break;
                }
                String str15 = codecs[i25];
                if (!TextUtils.isEmpty(str15) && str15.equals("bytevc2")) {
                    if (this.mConfigCenterVersion > 0) {
                        this.mEngineConfig.setStringOption(1000, "bytevc2");
                    } else {
                        this.mCodecType = "bytevc2";
                    }
                } else {
                    if (!TextUtils.isEmpty(str15) && str15.equals("bytevc1")) {
                        if (this.mConfigCenterVersion > 0) {
                            this.mEngineConfig.setStringOption(1000, "bytevc1");
                        } else {
                            this.mCodecType = "bytevc1";
                        }
                    }
                    i25++;
                }
            }
        }
        String[] allVideoURLs = iVideoModel2.allVideoURLs(this.currentResolution, this.currentParams);
        Resolution[] allResolutions = Resolution.getAllResolutions();
        if (this.mEnableTmpLog == 1) {
            showLongLog("brian show all urls:" + Arrays.toString(allVideoURLs));
        }
        VideoInfo videoInfo6 = iVideoModel2.getVideoInfo(this.currentResolution, this.currentParams);
        if (videoInfo6 != null) {
            SRStrategyConfig sRStrategyConfig2 = new SRStrategyConfig();
            sRStrategyConfig2.setCurrentWidth(videoInfo6.getValueInt(1)).setCurrentHeight(videoInfo6.getValueInt(2));
            this.mSRStrategy.updateConfig(sRStrategyConfig2);
        }
        if (this.mLogger != null) {
            this.mSRStrategy.setStrategyInfo("sfr", Integer.valueOf(this.mSRNotUseReason));
            this.mSRStrategy.setStrategyInfo("sut", Integer.valueOf(this.mUseSRTexture ? 1 : 0));
            this.mSRStrategy.setStrategyInfo("so", Integer.valueOf(this.mTextureSrOpen));
            SRStrategy sRStrategy = this.mSRStrategy;
            sRStrategy.setStrategyInfo("sm", Integer.valueOf(sRStrategy.getSRStrategyMode()));
            JSONArray mediaInfoJson = GearStrategy.getMediaInfoJson(iVideoModel2, getConfigInt(584, this.mQuickGetFileCache ? 1 : 0));
            if (mediaInfoJson != null) {
                this.mGearStrategyEvent.put("minfo", mediaInfoJson);
            }
            this.mLogger.setSRPreloadInfo(GearStrategy.getPreloadInfo(iVideoModel2.getVideoRefStr(2), this.mStartUpBitrate));
        }
        TTVideoEngineLog.i(logcatTag(), "[SRLog] got video info mUseSRTexture=" + this.mUseSRTexture + " mTextureSrOpen=" + this.mTextureSrOpen + " mSRNotUseReason=" + this.mSRNotUseReason + " config=" + this.mSRStrategy.configString());
        if (videoInfo6 != null && this.mStartUpBitrate < 0) {
            this.mStartUpBitrate = videoInfo6.getValueInt(3);
        }
        if (TextUtils.isEmpty(this.mStartUpResolution)) {
            if (!TextUtils.isEmpty(null)) {
                this.mStartUpResolution = null;
            } else {
                this.mStartUpResolution = _resolutionToString(this.currentResolution);
            }
        }
        if (_isUrlExpired(videoInfo6, iVideoModel2)) {
            videoInfo6 = null;
            strArr = null;
        } else {
            strArr = allVideoURLs;
        }
        if (allResolutions.length > 0) {
            int length2 = allResolutions.length - 1;
            int i26 = 0;
            while (true) {
                if (i26 >= allResolutions.length) {
                    break;
                }
                if (allResolutions[i26].getIndex() == this.currentResolution.getIndex()) {
                    length2 = i26;
                    break;
                }
                i26++;
            }
            int i27 = length2;
            z = false;
            do {
                if (strArr == null || strArr.length == 0) {
                    Resolution resolution4 = allResolutions[i27];
                    String[] allVideoURLs2 = iVideoModel2.allVideoURLs(resolution4, null);
                    if (allVideoURLs2 == null || allVideoURLs2.length == 0) {
                        strArr = allVideoURLs2;
                    } else {
                        videoInfo6 = iVideoModel2.getVideoInfo(resolution4, (Map<Integer, String>) null);
                        if (_isUrlExpired(videoInfo6, iVideoModel2)) {
                            videoInfo6 = null;
                            z = true;
                            strArr = null;
                        } else {
                            this.currentResolution = resolution4;
                            strArr = allVideoURLs2;
                        }
                    }
                    i4 = 1;
                    i27 = ((i27 + allResolutions.length) - 1) % allResolutions.length;
                }
                i4 = 1;
                break;
            } while (i27 != length2);
        } else {
            i4 = 1;
            z = false;
        }
        if (this.mEnableTmpLog == i4) {
            StringBuilder sb3 = new StringBuilder();
            sb3.append("currentResolution:");
            sb3.append(_resolutionToString(this.currentResolution));
            sb3.append(", quality_desc:");
            Map<Integer, String> map3 = this.currentParams;
            if (map3 != null) {
                str9 = map3.get(32);
            } else {
                str9 = -1;
            }
            sb3.append(str9);
            sb3.append(", tmpInfo resolution:");
            sb3.append(videoInfo6 != null ? _resolutionToString(videoInfo6.getResolution()) : "null");
            showLongLog(sb3.toString());
        }
        this.currentVideoInfo = videoInfo6;
        StrategyManager.instance().setVideoInfo(this, this.currentVideoInfo);
        this.mLogger.configResolution(_resolutionToString(this.currentResolution), str);
        this.mBarrageMaskUrl = iVideoModel2.getVideoRefStr(221);
        this.mMaskFileHash = iVideoModel2.getVideoRefStr(241);
        this.mMaskFileSize = iVideoModel2.getVideoRefLong(243);
        this.mMaskHeaderLen = iVideoModel2.getVideoRefInt(242);
        String videoRefStr = iVideoModel2.getVideoRefStr(235);
        this.mAIBarrageUrl = videoRefStr;
        if (TextUtils.isEmpty(videoRefStr) && (videoInfo3 = this.currentVideoInfo) != null) {
            this.mAIBarrageUrl = videoInfo3.getValueStr(43);
        }
        if (this.mABRModule != null && this.mEnableABR > 0 && isSupportSeamlessSwitch(this.mVideoModel) && this.mIsStartPlayAutomatically && this.mIsPreDecodeAutoPause) {
            this.mABRModule.c(TTVideoEngine.sABRAlgorithmType, getConfigInt(500, this.mABRTimerIntervalMilliseconds));
            this.mLogger.setIsEnableABR(1);
        } else {
            this.mLogger.setIsEnableABR(0);
        }
        this.mLogger.setIsMultiDimensionsOut(getConfigInt(525, this.mABRSpeedPredictOutType));
        this.mLogger.setSpeedPredictorAlgoType(TTVideoEngine.sNetSpeedAbrPredictType);
        this.mLogger.setIntOption(91, this.mStandAlongAbrStartUp);
        this.mLogger.setIntOption(127, i3);
        _sendUrlInfoMsg();
        VideoInfo videoInfo7 = this.currentVideoInfo;
        if (videoInfo7 != null) {
            this.mCurrentQuality = videoInfo7.getValueStr(18);
            this.mCurrentQualityDesc = this.currentVideoInfo.getValueStr(32);
            this.currentResolution = this.currentVideoInfo.getResolution();
            this.mCurrentQualityType = this.currentVideoInfo.getValueInt(41);
            if (this.mResolutionBeforeDowngrade == null) {
                this.mResolutionBeforeDowngrade = this.currentResolution;
                this.mQualityDescBeforeDowngrade = this.mCurrentQualityDesc;
            }
            this.mLogger.setCurrentQualityDesc(this.mCurrentQualityDesc);
            if (this.mConfigCenterVersion > 0) {
                i13 = 1;
                z2 = this.mEngineConfig.getIntOption(33) == 1;
            } else {
                i13 = 1;
                z2 = this.mBashEnabled;
            }
            if (z2 && isSupportBash(iVideoModel)) {
                strArr = this.currentVideoInfo.getValueStrArr(16);
                if (this.mEnableTmpLog == i13) {
                    showLongLog("enable bash show urls:" + Arrays.toString(strArr));
                }
            }
        }
        String[] strArr4 = strArr;
        int intValue = this.urlIndexMap.get(this.currentResolution).intValue();
        if (strArr4 == null || strArr4.length == 0) {
            str3 = str2;
            if (z) {
                error = new Error(str3, -9959);
            } else {
                error = new Error(str3, -9997);
            }
        } else if (strArr4.length <= intValue) {
            str3 = str2;
            error = new Error(str3, -9996);
        } else {
            str3 = str2;
            error = TextUtils.isEmpty(strArr4[intValue]) ? new Error(str3, -9967) : null;
        }
        if (error != null) {
            receivedError(error);
            return;
        }
        int i28 = getConfigInt(403, this.mIsUseServerDns ? 1 : 0) == 1 ? 1 : 0;
        if (getConfigInt(160, this.mDataLoaderEnable) <= 0 || !DataLoaderHelper.getDataLoader().isRunning()) {
            i5 = intValue;
            str4 = str3;
            strArr2 = strArr4;
            r7 = 0;
            i6 = 3;
            i7 = i2;
            i8 = 2;
        } else {
            int i29 = i2;
            i8 = 2;
            if (i29 != 2) {
                _resetUsingDataLoaderField();
                String _generatePlayUrl = _generatePlayUrl(strArr4[intValue], null);
                if (this.mEnableTmpLog == 1) {
                    showLongLog("brian show _generatePlayUrl:" + _generatePlayUrl);
                }
                if (TextUtils.isEmpty(_generatePlayUrl)) {
                    receivedError(new Error(str3, -9967));
                    return;
                }
                if (i28 != 0) {
                    DataLoaderHelper.getDataLoader().updateDnsInfo(iVideoModel.getDnsInfo(), iVideoModel2.getVideoRefLong(216));
                }
                ArrayList<VideoInfo> arrayList2 = new ArrayList();
                String str16 = "mem://bash";
                if (iVideoModel2.hasFormat(IVideoModel.Format.DASH)) {
                    if (_generatePlayUrl.startsWith("mem://bash") && iVideoModel.hasData()) {
                        arrayList2.addAll(iVideoModel.getVideoInfoList());
                    }
                } else if (iVideoModel2.hasFormat(IVideoModel.Format.HLS) && _generatePlayUrl.startsWith("mem://hls") && iVideoModel.hasData()) {
                    arrayList2.addAll(iVideoModel.getVideoInfoList());
                } else if (_generatePlayUrl.startsWith("mem://bash") && iVideoModel.hasData()) {
                    arrayList2.addAll(iVideoModel.getVideoInfoList());
                } else {
                    arrayList2.add(this.currentVideoInfo);
                }
                ArrayList arrayList3 = new ArrayList();
                String str17 = null;
                for (VideoInfo videoInfo8 : arrayList2) {
                    if (this.mShouldStop) {
                        TTVideoEngineLog.w(logcatTag(), "_doParseIPAddress should stop");
                        return;
                    }
                    if (videoInfo8 != null) {
                        String createMDLExtraInfo = MDLExtraInfoHelper.createMDLExtraInfo(videoInfo8);
                        String valueStr2 = videoInfo8.getValueStr(5);
                        String videoRefStr2 = iVideoModel2.getVideoRefStr(2);
                        String[] strArr5 = strArr4;
                        String valueStr3 = videoInfo8.getValueStr(15);
                        CacheFilePathListener cacheFilePathListener = this.mCacheFilePathListener;
                        if (cacheFilePathListener != null) {
                            str5 = cacheFilePathListener.cacheFilePath(videoRefStr2, videoInfo8);
                            i10 = 16;
                        } else {
                            i10 = 16;
                            str5 = null;
                        }
                        String[] valueStrArr = videoInfo8.getValueStrArr(i10);
                        if (valueStrArr == null || valueStrArr.length <= 0) {
                            str6 = _generatePlayUrl;
                            i11 = i29;
                            i12 = intValue;
                            str7 = str3;
                            strArr3 = strArr5;
                            arrayList = arrayList3;
                            str8 = str16;
                        } else {
                            VideoInfo copyInfo = videoInfo8.copyInfo();
                            String[] addMdlFlag = addMdlFlag((String[]) valueStrArr.clone(), videoRefStr2);
                            if (this.mRetryEnableHttps) {
                                for (int i30 = 0; i30 < addMdlFlag.length; i30++) {
                                    addMdlFlag[i30] = TTHelper.buildHttpsUrl(addMdlFlag[i30]);
                                }
                            }
                            String str18 = str16;
                            ArrayList arrayList4 = arrayList3;
                            String str19 = _generatePlayUrl;
                            String str20 = str5;
                            i12 = intValue;
                            i11 = i29;
                            str7 = str3;
                            strArr3 = strArr5;
                            String _mdlUrl = _mdlUrl(valueStr3, videoRefStr2, getConfigInt(161, this.mLimitMDLCacheSize), addMdlFlag, this.currentResolution, valueStr2, videoInfo8, str20, createMDLExtraInfo, 0L, null);
                            if (!this.mFileHashs.contains(valueStr3)) {
                                this.mFileHashs.add(valueStr3);
                            }
                            if (TextUtils.isEmpty(_mdlUrl)) {
                                videoInfo2 = copyInfo;
                                str8 = str18;
                                str6 = str19;
                                _mdlUrl = str17;
                            } else {
                                videoInfo2 = copyInfo;
                                videoInfo2.setValue(16, new String[]{_mdlUrl, _mdlUrl});
                                str8 = str18;
                                str6 = str19;
                                if (str6.startsWith(str8) || str6.startsWith("mem://hls")) {
                                    if (videoInfo8.getMediatype() == VideoRef.TYPE_VIDEO) {
                                        if (this.mEnableTmpLog == 1) {
                                            showLongLog("dashVideoUrlMap put res:" + videoInfo8.getResolution() + ", url:" + _mdlUrl);
                                        }
                                        this.dashVideoUrlMap.put(videoInfo8.getResolution(), _mdlUrl);
                                    } else if (videoInfo8.getMediatype() == VideoRef.TYPE_AUDIO) {
                                        this.dashAudioUrlMap.put(Integer.valueOf(videoInfo8.getValueInt(3)), _mdlUrl);
                                        _mdlUrl = str6;
                                    }
                                    _mdlUrl = str6;
                                } else {
                                    arrayList = arrayList4;
                                    arrayList.add(videoInfo2);
                                    str17 = _mdlUrl;
                                }
                            }
                            arrayList = arrayList4;
                            arrayList.add(videoInfo2);
                            str17 = _mdlUrl;
                        }
                        iVideoModel2 = iVideoModel;
                        _generatePlayUrl = str6;
                        str16 = str8;
                        arrayList3 = arrayList;
                        intValue = i12;
                        i29 = i11;
                        strArr4 = strArr3;
                        str3 = str7;
                    }
                }
                String str21 = _generatePlayUrl;
                int i31 = i29;
                i5 = intValue;
                str4 = str3;
                String[] strArr6 = strArr4;
                r7 = 0;
                i6 = 3;
                ArrayList arrayList5 = arrayList3;
                String str22 = str16;
                if ((str21.startsWith(str22) || str21.startsWith("mem://hls")) && arrayList5.size() > 0) {
                    strArr2 = strArr6;
                    str17 = _generatePlayUrl(strArr2[i5], null, arrayList5);
                } else {
                    strArr2 = strArr6;
                }
                String str23 = str17;
                if (!TextUtils.isEmpty(str23)) {
                    if (this.mEnableTmpLog == 1) {
                        showLongLog("show proxyUrl:" + str23);
                    }
                    this.mURLInfo.setHostURL(str23);
                    this.mLogger.setProxyUrl(str23.startsWith(str22) ? this.dashVideoUrlMap.get(this.currentResolution) : str23);
                    Map<String, String> map4 = this.mHeaders;
                    map4.remove("Host");
                    _playInternal(str23, map4);
                    return;
                }
                i7 = i31;
                if (this.mPlayerType != i6 || this.mPlayerType == 4) {
                    for (i9 = 0; i9 < strArr2.length; i9++) {
                        strArr2[i9] = TTHelper.buildHttpUrl(strArr2[i9]);
                    }
                }
                String logcatTag2 = logcatTag();
                StringBuilder sb4 = new StringBuilder();
                sb4.append("current resolution:");
                sb4.append(_resolutionToString(this.currentResolution));
                sb4.append(", urls:");
                sb4.append(TextUtils.join(",", strArr2));
                sb4.append(", index:");
                int i32 = i5;
                sb4.append(i32);
                TTVideoEngineLog.i(logcatTag2, sb4.toString());
                if (getConfigInt(r7, this.mPlayerCache) == 0 && (videoInfo = this.currentVideoInfo) != null) {
                    this.mPlayerCache = videoInfo.getValueInt(13);
                    this.mEngineConfig.setIntOption(r7, this.currentVideoInfo.getValueInt(13));
                }
                this.mURLInfo.setHostURL(strArr2[i32]);
                if (this.mURLInfo.hostURL != null) {
                    receivedError(new Error(str4, -9967, "mURLInfo.hostURL is empty"));
                    return;
                }
                this.mURLs = strArr2;
                this.urlIPMap.put(this.mURLInfo.hostURL, new IpInfo("", "", getConfigInt(18, this.mUseDNSCache ? 1 : 0), i28, i32 == 0 ? "main" : "backup"));
                _updateVU();
                if (i7 == 2 && this.mPlayerType == 2 && this.mIntertrustDrmHelper != null) {
                    int processToken = this.mIntertrustDrmHelper.processToken(AppInfo.mAppID, this.mVideoID, this.currentVideoInfo.getValueStr(36));
                    if (processToken == -1001) {
                        receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9937));
                        return;
                    } else {
                        if (processToken == -1) {
                            receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9934));
                            return;
                        }
                        return;
                    }
                }
                if (_usePlayerDNS(r7)) {
                    _playInternal(this.mURLInfo.hostURL, this.mHeaders);
                    return;
                } else {
                    _parseDNS(this.mURLInfo.hostURL);
                    return;
                }
            }
            i5 = intValue;
            str4 = str3;
            strArr2 = strArr4;
            r7 = 0;
            i6 = 3;
            i7 = i29;
        }
        if (i7 != i8) {
            if (getConfigInt(160, this.mDataLoaderEnable) == 0) {
                this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.OptionNotSet.ordinal());
            } else {
                this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.StateError.ordinal());
                loggerSetMdlInitializeState();
            }
        }
        if (this.mPlayerType != i6) {
        }
        while (i9 < strArr2.length) {
        }
        String logcatTag22 = logcatTag();
        StringBuilder sb42 = new StringBuilder();
        sb42.append("current resolution:");
        sb42.append(_resolutionToString(this.currentResolution));
        sb42.append(", urls:");
        sb42.append(TextUtils.join(",", strArr2));
        sb42.append(", index:");
        int i322 = i5;
        sb42.append(i322);
        TTVideoEngineLog.i(logcatTag22, sb42.toString());
        if (getConfigInt(r7, this.mPlayerCache) == 0) {
            this.mPlayerCache = videoInfo.getValueInt(13);
            this.mEngineConfig.setIntOption(r7, this.currentVideoInfo.getValueInt(13));
        }
        this.mURLInfo.setHostURL(strArr2[i322]);
        if (this.mURLInfo.hostURL != null) {
        }
    }

    @Override
    public void setMediaPlayerOptions() {
        super.setMediaPlayerOptions();
        this.mMediaPlayer.setIntOption(823, this.mEnableFlushSeek);
        this.mMediaPlayer.setIntOption(619, this.mCurrentSubId);
        this.mMediaPlayer.setIntOption(828, this.mEnableOptSubLoadTime);
        this.mMediaPlayer.setIntOption(1601, this.mEnableSubtitleSenseBuffering);
        this.mMediaPlayer.setIntOption(1602, this.mEnableSubtitleLazyLoading);
        this.mMediaPlayer.setIntOption(1800, this.mMaskDelayLoading);
        this.mMediaPlayer.setIntOption(1900, this.mEnablexHEAACSupport);
        this.mMediaPlayer.setIntOption(1901, this.mDecodeAACThroughFDKAAC);
        this.mMediaPlayer.setIntOption(1902, this.mEnableAudioSeekingNoAccurate);
        this.mMediaPlayer.setIntOption(870, this.mThreadSafeRefSwitcher);
        this.mMediaPlayer.setIntOption(853, this.mOpenSubRetryTimes);
        this.mMediaPlayer.setIntOption(829, this.mEnableOptSubSearch);
        this.mMediaPlayer.setIntOption(854, this.mEnableRecreateSubIfDetached);
        this.mMediaPlayer.setIntOption(185, this.mSoloPlayEnable);
        this.mMediaPlayer.setIntOption(201, this.mIsDisableShortSeek);
        this.mMediaPlayer.setIntOption(95, this.mMovPreferNearestSample);
        this.mMediaPlayer.setIntOption(96, this.mSkipFfmpegFindStreamInfo);
        this.mMediaPlayer.setIntOption(133, this.mDisableAccurateStart);
        this.mMediaPlayer.setIntOption(81, this.mBufferTimeout);
        this.mMediaPlayer.setIntOption(9, this.mNetworkTimeout * 1000000);
        this.mMediaPlayer.setIntOption(197, this.mOriginalRetry);
        this.mMediaPlayer.setIntOption(253, this.mAccurateLayout);
        if (this.mEGLNeedWorkAround == 0) {
            this.mMediaPlayer.setIntOption(183, this.mEGLNeedWorkAround);
        }
        this.mMediaPlayer.setIntOption(827, this.mOpenVoiceEarly);
        this.mMediaPlayer.setIntOption(67, this.mDecoderType);
        this.mMediaPlayer.setIntOption(86, this.mBufferDataMiliSeconds);
        this.mMediaPlayer.setIntOption(110, this.mMaxBufferDataMilliSeconds);
        this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_USE_PLAYER_SPADE, this.mUnsupportedSampleRatesInBinary);
        this.mMediaPlayer.setIntOption(159, this.mFrameDropNum);
        this.mMediaPlayer.setIntOption(195, this.mLoopReferVideo);
        this.mMediaPlayer.setIntOption(79, this.mTestNetSpeed);
        this.mMediaPlayer.setIntOption(66, this.mTestNetSpeedDiff);
        if (this.mPlayerCache != 0 && this.mCacheControlEnabled) {
            this.mMediaPlayer.setIntOption(24, this.mPlayerCache);
        }
        this.mMediaPlayer.setIntOption(83, this.mTestAction);
        this.mMediaPlayer.setIntOption(37, this.mEnhancementType);
        this.mMediaPlayer.setIntOption(38, this.mScaleType);
        this.mMediaPlayer.setIntOption(36, this.mLayoutType);
        int renderType = EngineGlobalConfig.getInstance().getRenderType();
        if (renderType != -1) {
            this.mMediaPlayer.setIntOption(56, renderType);
            TTVideoEngineLog.i(logcatTag(), "set renderType from static context, renderType:" + renderType);
        } else {
            this.mMediaPlayer.setIntOption(56, this.mRenderType);
        }
        this.mMediaPlayer.setIntOption(301, this.mExposeSignal);
        this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, this.mNotifyBufferingDirectly);
        this.mMediaPlayer.setIntOption(247, this.mDisablePlayerTimeOut);
        this.mMediaPlayer.setIntOption(248, this.mEnableSeekInterrupt);
        this.mMediaPlayer.setIntOption(134, this.mMaxFps);
        this.mMediaPlayer.setIntOption(1010, this.mEnableDynamicFrameDropping);
        this.mMediaPlayer.setIntOption(1011, this.mFrameDroppingMultiple);
        this.mMediaPlayer.setIntOption(1012, this.mFrameDroppingCheckPeriod);
        this.mMediaPlayer.setIntOption(1014, this.mFrameDroppingCheckCount);
        this.mMediaPlayer.setIntOption(50302, this.mHWMaxFps);
        this.mMediaPlayer.setIntOption(50303, this.mHWEnableDynamicFrameDropping);
        this.mMediaPlayer.setIntOption(50304, this.mHWFrameDroppingMultiple);
        this.mMediaPlayer.setIntOption(50305, this.mHWFrameDroppingCheckPeriod);
        this.mMediaPlayer.setIntOption(50306, this.mHWFrameDroppingCheckCount);
        this.mMediaPlayer.setIntOption(1055, this.mEnableHWDropFrameWhenVOIsInDropState);
        this.mMediaPlayer.setIntOption(1056, this.mEnableHWDropFrameWhenAVOutSyncing);
        if (this.mCodecFramesDrop != -1) {
            this.mMediaPlayer.setIntOption(1057, this.mCodecFramesDrop);
        }
        this.mMediaPlayer.setIntOption(192, this.mKsyFrameWait);
        this.mMediaPlayer.setIntOption(358, this.mSpeedXDrop);
        this.mMediaPlayer.setIntOption(278, this.mStopSourceAsync);
        this.mMediaPlayer.setIntOption(276, this.mPostPrepare);
        this.mMediaPlayer.setIntOption(263, this.mDelayBufferingUpdate);
        this.mMediaPlayer.setIntOption(199, this.mSkipAudioGraph);
        this.mMediaPlayer.setIntOption(b.f2360b, this.mEglVersion);
        this.mMediaPlayer.setIntOption(285, this.mCodecFrcLevel);
        this.mMediaPlayer.setIntOption(286, this.mPrepareCacheMs);
        this.mMediaPlayer.setIntOption(292, this.mEnableCacheTimeStamp);
        this.mMediaPlayer.setIntOption(293, this.mKeepFormatThreadAlive);
        this.mMediaPlayer.setIntOption(297, this.mSkipBufferTimeout);
        this.mMediaPlayer.setIntOption(647, this.mPosUpdateInterval);
        _configNativeRenderRotationAdapt();
        this.mMediaPlayer.setIntOption(565, this.mNativeRenderRotationAdapt);
        this.mMediaPlayer.setIntOption(664, this.mIgnoreAudioRenderEOSDelayMs);
        this.mMediaPlayer.setIntOption(666, this.mEnableMp4Check);
        this.mMediaPlayer.setIntOption(1004, this.mEnableDeinterlace);
        this.mMediaPlayer.setLongOption(668, this.mPrecisePausePts);
        if (this.mMaxCodecNumsInPool != -1) {
            this.mMediaPlayer.setIntOption(1041, this.mMaxCodecNumsInPool);
        }
        if (this.mHardwareDecodeEnablePlayer2 == 1) {
            this.mMediaPlayer.setIntOption(254, this.mNeedAdaptiveWorkaround);
            this.mMediaPlayer.setIntOption(400, this.mUseCodecPool);
            this.mMediaPlayer.setIntOption(90, this.mMediaCodecSyncMode);
            this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY, this.mUseQcomLowLatency);
            this.mMediaPlayer.setIntOption(216, this.mMediaCodecSkipNonRef);
            if (this.mUseQcomVpp == 1) {
                this.mMediaPlayer.setIntOption(212, this.mUseQcomVpp);
                this.mMediaPlayer.setIntOption(213, this.mQcomVppLevel);
            }
            if (this.mEnableOppoControl == 1) {
                this.mMediaPlayer.setIntOption(184, 1);
            }
            this.mMediaPlayer.setIntOption(279, this.mDisableHWDecSeamless);
            if (this.mEnableVideoCodecPixelAlign == 1) {
                this.mMediaPlayer.setIntOption(280, this.mEnableVideoCodecPixelAlign);
            }
            this.mMediaPlayer.setIntOption(401, this.mDisableMcReuse);
        }
        this.mMediaPlayer.setIntOption(1744, this.mAudioTrackContentType);
        if (this.mEnableSharp == 1) {
            this.mMediaPlayer.setIntOption(189, 1);
        }
        if (this.mTimeBarPercentage == 1) {
            this.mMediaPlayer.setIntOption(312, 1);
        }
        if (EngineGlobalConfig.getInstance().getALogWriteAddr() > 0) {
            this.mMediaPlayer.setLongOption(231, EngineGlobalConfig.getInstance().getALogWriteAddr());
        }
        this.mMediaPlayer.setIntOption(223, this.mOutputLog);
        if (EngineGlobalConfig.getInstance().getOutputLogLevelPercise() >= 0) {
            this.mMediaPlayer.setIntOption(1501, EngineGlobalConfig.getInstance().getOutputLogLevelPercise());
            TTVideoEngineLog.d(logcatTag(), "set media Player percise loglever:" + EngineGlobalConfig.getInstance().getOutputLogLevelPercise());
        } else {
            this.mMediaPlayer.setIntOption(984, EngineGlobalConfig.getInstance().getOutputLogLevel());
            TTVideoEngineLog.d(logcatTag(), "set media Player loglever:" + EngineGlobalConfig.getInstance().getOutputLogLevel());
        }
        if (this.mAudioProcessor != null) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(this.mAudioProcessor);
        }
        for (Map.Entry<Integer, TraitObject> entry : this.mTraitObjManager.getAll().entrySet()) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setTraitObject(entry.getKey().intValue(), entry.getValue());
        }
        this.mMediaPlayer.setIntOption(48, this.mVoiceType);
        if (this.mHardwareDropNonRef > 0) {
            this.mMediaPlayer.setIntOption(252, this.mHardwareDropNonRef);
        }
        this.mMediaPlayer.setIntOption(88, this.mMediaCodecRender);
        this.mMediaPlayer.setIntOption(97, this.mUseMediacodecAudio);
        this.mMediaPlayer.setIntOption(536, this.mFindStreamInfoProbeSize);
        this.mMediaPlayer.setIntOption(537, this.mFindStreamInfoProbDuration);
        this.mMediaPlayer.setIntOption(538, this.mNetworkReconnectCount);
        this.mMediaPlayer.setIntOption(539, this.mDummyAudioSleep);
        this.mMediaPlayer.setIntOption(5003, this.mDisablePlayerStayAwake);
        _configNativeYV12Render();
        this.mMediaPlayer.setIntOption(542, this.mEnableNativeYV12Render);
        this.mMediaPlayer.setIntOption(550, this.mForceCloseCodec);
        this.mMediaPlayer.setIntOption(551, this.mFilePlayNoBuffering);
        this.mMediaPlayer.setIntOption(552, this.mNoBufferUpdate);
        this.mMediaPlayer.setIntOption(556, this.mEnableDebugUINotify);
        this.mMediaPlayer.setIntOption(654, this.mGetMasterClockByPts);
        this.mMediaPlayer.setIntOption(348, this.mAlwaysDoAVSync);
        this.mMediaPlayer.setIntOption(557, this.mClipHEAACV2FirstPtsPacket);
        this.mMediaPlayer.setIntOption(558, this.mEnableVideoTimestampMonotonic);
        this.mMediaPlayer.setIntOption(559, this.mFeedPacketUntilEmpty);
        this.mMediaPlayer.setIntOption(257, this.mEnableFallbackSWDec);
        this.mMediaPlayer.setIntOption(560, this.mEnableDemuxNonBlockRead);
        this.mMediaPlayer.setIntOption(952, this.mMediacodecStopTimeout);
        this.mMediaPlayer.setIntOption(561, this.mEnableThreadPriority);
        this.mMediaPlayer.setIntOption(562, this.mThreadPriorityValue);
        this.mMediaPlayer.setIntOption(322, this.mRenderStallThreshold);
        this.mMediaPlayer.setIntOption(761, this.mEnableOptInaccurateStart);
        this.mMediaPlayer.setIntOption(762, this.mEnableOptSeekClk);
        this.mMediaPlayer.setIntOption(563, this.mEnableAudioTrackSmoothClock);
        this.mMediaPlayer.setIntOption(564, this.mDisableSpiltVoiceWrite);
        this.mMediaPlayer.setIntOption(566, this.mIgnoreDirectlyBuffering);
        this.mMediaPlayer.setIntOption(149, this.mEnableOutletDropLimit ? 1 : 0);
        this.mMediaPlayer.setIntOption(164, this.mEnableMediaCodecRealtime);
        this.mMediaPlayer.setIntOption(571, this.mEnablePreRenderBufferingUpdate);
        this.mMediaPlayer.setIntOption(572, this.mPreRenderBufferingUpdatePercentage);
        this.mMediaPlayer.setIntOption(573, this.mEnableHEAACV2PtsMSCorrection);
        this.mMediaPlayer.setIntOption(574, this.mEnableVC1BlockList);
        this.mMediaPlayer.setIntOption(575, this.mEnableHChipAdaptiveWorkAround);
        this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_PRE_RENDER_BUFFERING_UPDATE_PRECENTAGE, this.mEnableMChipSkipAdaptiveWorkAround);
        int enableCPPBYTEVC1CodecOpt = EngineGlobalConfig.getInstance().getEnableCPPBYTEVC1CodecOpt();
        if (enableCPPBYTEVC1CodecOpt > 0) {
            this.mMediaPlayer.setIntOption(580, enableCPPBYTEVC1CodecOpt);
        } else {
            this.mMediaPlayer.setIntOption(580, this.mEnableCPPBYTEVC1CodecOpt);
        }
        this.mMediaPlayer.setIntOption(582, this.mReportFirstFrameFrameBufferOnly);
        this.mMediaPlayer.setIntOption(587, this.mEnbalePreDemux);
        this.mMediaPlayer.setIntOption(1050, this.mEnableFastStop);
        this.mMediaPlayer.setIntOption(1052, this.mEnableCodecRecycle);
        this.mMediaPlayer.setIntOption(480, this.mTlsLog);
        this.mMediaPlayer.setIntOption(672, this.mStopCloseIO);
        this.mMediaPlayer.setIntOption(591, this.mEnableCPPBYTEVC2CodecOpt);
        this.mMediaPlayer.setIntOption(673, this.mEnableAudioMemIntergration);
        this.mMediaPlayer.setIntOption(674, this.mEnableBufferingLowerCapacity);
        this.mMediaPlayer.setIntOption(675, this.mEnableDowngradeAsyncCodec);
        this.mMediaPlayer.setIntOption(676, this.mEnableMediaCodecSyncClose);
        this.mMediaPlayer.setIntOption(677, this.mEnableSeekBuffering);
        this.mMediaPlayer.setIntOption(592, this.mBytevc2NalsizeCheck);
        this.mMediaPlayer.setIntOption(593, this.mHardwareCodecerFlushClose);
        this.mMediaPlayer.setIntOption(594, this.mOptAudioRenderTimeReport);
        this.mMediaPlayer.setIntOption(595, this.mBT601CloseCodecAsync);
        this.mMediaPlayer.setIntOption(4001, this.mForbidFallbackNativeRender);
        this.mMediaPlayer.setIntOption(4002, this.mDecoderRenderContinueRetry);
        this.mMediaPlayer.setIntOption(4003, this.mDecoderRenderClearSurface);
        this.mMediaPlayer.setIntOption(4005, this.mEnableDecoderRenderVC2RenderLatency);
        this.mMediaPlayer.setIntOption(1071, this.mEnableOptimizeMp4Abr);
        this.mMediaPlayer.setIntOption(1072, this.mEnableMediaCodecFairMutex);
        this.mMediaPlayer.setIntOption(1074, this.mEnableRangeOptimize);
        this.mMediaPlayer.setIntOption(1075, this.mThreadName2CharSuffix);
        this.mMediaPlayer.setIntOption(1076, this.mEnableOptimizePrerender);
        this.mMediaPlayer.setIntOption(581, this.mVC2DecodecLowLatency);
        this.mMediaPlayer.setIntOption(4008, this.mVC2WppMode);
        this.mMediaPlayer.setIntOption(1079, this.mEnableAsyncDownload);
        this.mMediaPlayer.setIntOption(756, this.mEnablePreloadGear);
        this.mMediaPlayer.setIntOption(1094, this.mEnableAsyncProbe);
        this.mMediaPlayer.setIntOption(1096, this.mEnableOptimizeAsyncDownload);
        this.mMediaPlayer.setIntOption(598, this.mAudioPtsMSCorrectionExtension);
        this.mMediaPlayer.setIntOption(1084, this.mEnableCacheInfo);
        this.mMediaPlayer.setIntOption(1098, this.mEnableOptimizeRadioMode);
        this.mMediaPlayer.setIntOption(1086, this.mEnableOptimizeIO);
        this.mMediaPlayer.setIntOption(42005, this.mEnableOptimizeDashSeek);
        this.mMediaPlayer.setIntOption(42016, this.mAnRenderRefreshSurface);
        this.mMediaPlayer.setIntOption(4009, this.mLowerAudioMemCapacity);
        this.mMediaPlayer.setIntOption(4010, this.mVC2ThreadNum);
        this.mMediaPlayer.setIntOption(42001, this.mSetPlayerSurfaceWithLock);
        this.mMediaPlayer.setIntOption(42049, this.mEnableNotifyRenderException);
        if (this.mHardwareDecodeEnablePlayer2 <= 0) {
            this.mMediaPlayer.setIntOption(4007, this.mDecoderRenderVC2PreCreateRender);
        }
        if (this.mQueryWinEnable != -1) {
            this.mMediaPlayer.setIntOption(982, this.mQueryWinEnable);
        }
        if (this.mPreferNearestMaxPosOffset != -1) {
            this.mMediaPlayer.setIntOption(985, this.mPreferNearestMaxPosOffset);
        }
        if (this.mMediaCodecAsyncModeEnable != -1) {
            this.mMediaPlayer.setIntOption(1000, this.mMediaCodecAsyncModeEnable);
        }
        if (this.mHlsSubDemuxerProbeType != -1) {
            this.mMediaPlayer.setIntOption(1070, this.mHlsSubDemuxerProbeType);
        }
        if (this.mVideoModel != null) {
            MediaPlayer mediaPlayer = this.mMediaPlayer;
            int i = this.mAudioInfoId;
            if (i == -1) {
                i = this.mVideoModel.getVideoRefInt(230);
            }
            mediaPlayer.setIntOption(662, i);
        } else {
            this.mMediaPlayer.setIntOption(662, this.mAudioInfoId);
        }
        _setLoggerOptions();
        if (this.mSettingCodecName != -1) {
            this.mMediaPlayer.setIntOption(1003, this.mSettingCodecName);
            for (int i2 = 0; i2 < this.mPrivCodecName.size(); i2++) {
                this.mMediaPlayer.setStringOption(1002, this.mPrivCodecName.get(i2));
            }
        }
        if (this.mAVsyncRefined != -1) {
            this.mMediaPlayer.setIntOption(1005, this.mAVsyncRefined);
        }
        if (this.mOnlyPlayAudioForBothStream != -1) {
            this.mMediaPlayer.setIntOption(1020, this.mOnlyPlayAudioForBothStream);
        }
        if (this.mCodecAndSurfaceReuse != -1) {
            this.mMediaPlayer.setIntOption(1007, this.mCodecAndSurfaceReuse);
        }
        if (this.mMCMaxWidth != -1) {
            this.mMediaPlayer.setIntOption(1008, this.mMCMaxWidth);
        }
        if (this.mMCMaxHeight != -1) {
            this.mMediaPlayer.setIntOption(1009, this.mMCMaxHeight);
        }
        if (this.mIgnoreSurfaceCreated != -1) {
            this.mMediaPlayer.setIntOption(1036, this.mIgnoreSurfaceCreated);
        }
        if (this.mForbidBufferingNotFinished != -1) {
            this.mMediaPlayer.setIntOption(1035, this.mForbidBufferingNotFinished);
        }
        if (this.mIsPrepareDecodeOnly) {
            this.mMediaPlayer.setIntOption(1063, 1);
        }
        if (this.mAsyncManageResource != -1) {
            this.mMediaPlayer.setIntOption(1038, this.mAsyncManageResource);
        }
        if (this.mAudioUseDirectBuffer != -1) {
            this.mMediaPlayer.setIntOption(1039, this.mAudioUseDirectBuffer);
        }
        if (this.mCloseCodecPool != -1) {
            this.mMediaPlayer.setIntOption(1040, this.mCloseCodecPool);
        }
        if (this.mDummySurfaceForbid != -1) {
            this.mMediaPlayer.setIntOption(1034, this.mDummySurfaceForbid);
        }
        if (this.mCalibrationAudioPts != -1) {
            this.mMediaPlayer.setIntOption(1043, this.mCalibrationAudioPts);
        }
        if (this.mAudioPtsCalibrationType != -1) {
            this.mMediaPlayer.setIntOption(1311, this.mAudioPtsCalibrationType);
        }
        if (this.mSetSurfaceRetryCount != -1) {
            this.mMediaPlayer.setIntOption(1044, this.mSetSurfaceRetryCount);
        }
        if (this.mSetSurfaceRetryInterval != -1) {
            this.mMediaPlayer.setIntOption(1045, this.mSetSurfaceRetryInterval);
        }
        if (this.mChangeRecBufferSpeed != -1) {
            this.mMediaPlayer.setIntOption(1046, this.mChangeRecBufferSpeed);
        }
        if (this.mEnableVideoSecondFrame != -1) {
            this.mMediaPlayer.setIntOption(1049, this.mEnableVideoSecondFrame);
        }
        if (this.mGiveBackCodecEarly != -1) {
            this.mMediaPlayer.setIntOption(1047, this.mGiveBackCodecEarly);
        }
        if (this.mWaitingCodecMs != -1) {
            this.mMediaPlayer.setIntOption(1048, this.mWaitingCodecMs);
        }
        if (this.mAsyncSetWindow != -1) {
            this.mMediaPlayer.setIntOption(1316, this.mAsyncSetWindow);
        }
        if (this.mAutoDisconnectedCpu != -1) {
            this.mMediaPlayer.setIntOption(1310, this.mAutoDisconnectedCpu);
        }
        if (this.mEnableReportFirstAVSyncFrame == 1) {
            this.mMediaPlayer.setIntOption(475, this.mEnableReportFirstAVSyncFrame);
        }
        if (this.mQueryAdaptivePlayback != -1) {
            this.mMediaPlayer.setIntOption(1313, this.mQueryAdaptivePlayback);
        }
        if (this.mFlushWhenSetSurface != -1) {
            this.mMediaPlayer.setIntOption(1321, this.mFlushWhenSetSurface);
        }
        if (this.mEnableMediaCodecDeathCheck != -1) {
            this.mMediaPlayer.setIntOption(1326, this.mEnableMediaCodecDeathCheck);
        }
        if (this.mMediaCodecDeathCheckInterval != -1) {
            this.mMediaPlayer.setIntOption(1327, this.mMediaCodecDeathCheckInterval);
        }
        if (this.mMediaCodecDeathTimeout != -1) {
            this.mMediaPlayer.setIntOption(1328, this.mMediaCodecDeathTimeout);
        }
        if (this.mCodecPoolSupportDynamicExtend != -1) {
            this.mMediaPlayer.setIntOption(1329, this.mCodecPoolSupportDynamicExtend);
        }
        if (this.mDynamicExtendCodecNums != -1) {
            this.mMediaPlayer.setIntOption(1330, this.mDynamicExtendCodecNums);
        }
        if (this.mEnableOptimizeHWDec2SWDec != -1) {
            this.mMediaPlayer.setIntOption(1332, this.mEnableOptimizeHWDec2SWDec);
        }
        if (this.mCreateAudioTrackEarly != -1) {
            this.mMediaPlayer.setIntOption(1325, this.mCreateAudioTrackEarly);
        }
        if (this.mEnableMediaCodecPipeline != -1) {
            this.mMediaPlayer.setIntOption(1333, this.mEnableMediaCodecPipeline);
        }
        if (this.mFrameNumsInMediaCodec != -1) {
            this.mMediaPlayer.setIntOption(1334, this.mFrameNumsInMediaCodec);
        }
        if (this.mEnableMCRenderHandleSAR != -1) {
            this.mMediaPlayer.setIntOption(1336, this.mEnableMCRenderHandleSAR);
        }
        if (this.mRecBufferThresh != -1) {
            this.mMediaPlayer.setIntOption(1312, this.mRecBufferThresh);
        }
        if (this.mRecBufferType != -1) {
            this.mMediaPlayer.setIntOption(1341, this.mRecBufferType);
        }
        if (this.mUserExitTimeMs != -1) {
            this.mMediaPlayer.setIntOption(1340, this.mUserExitTimeMs);
        }
        if (this.mAudioGraphRefactor != -1) {
            this.mMediaPlayer.setIntOption(1337, this.mAudioGraphRefactor);
        }
        if (this.mAudioDecoderGraphMerged != -1) {
            this.mMediaPlayer.setIntOption(1338, this.mAudioDecoderGraphMerged);
        }
        if (this.mCodecPoolVersion != -1) {
            this.mMediaPlayer.setIntOption(1344, this.mCodecPoolVersion);
        }
        if (this.mDiscardCodecStrategy1 != -1) {
            this.mMediaPlayer.setIntOption(1345, this.mDiscardCodecStrategy1);
        }
        if (this.mDiscardCodecStrategy2 != -1) {
            this.mMediaPlayer.setIntOption(1346, this.mDiscardCodecStrategy2);
        }
        if (this.mCodecHistoryLength != -1) {
            this.mMediaPlayer.setIntOption(1347, this.mCodecHistoryLength);
        }
        if (this.mCodecMaxUsedCount != -1) {
            this.mMediaPlayer.setIntOption(1348, this.mCodecMaxUsedCount);
        }
        if (this.mEnableFallbackInMaxInstanceErr != -1) {
            this.mMediaPlayer.setIntOption(1355, this.mEnableFallbackInMaxInstanceErr);
        }
        if (this.mEnableStartPlaySync != -1) {
            this.mMediaPlayer.setIntOption(1317, this.mEnableStartPlaySync);
        }
        int i3 = this.mOverlayMode;
        if ((i3 == 2 || i3 == 4) && this.mTextureSurface != null) {
            this.mNoAVSync = 1;
            this.mEnableVideoFrameMetaCallback = 1;
            this.mMediaPlayer.setIntOption(820, this.mNoAVSync);
            if (this.mOverlayMode == 4) {
                this.mIsMute = true;
            }
        }
        this.mMediaPlayer.setIntOption(333, this.mEnableVideoFrameMetaCallback);
        if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setFrameMetadataListener(new MyFrameMetadataListener());
        }
        this.mOptionHolder.apply(this.mMediaPlayer);
    }

    public static class DeleteBeforeDirFileRunnable implements Runnable {
        private Context context;

        @Override
        public void run() {
            TTHelper.deleteBeforeDirFiles(this.context);
        }

        public DeleteBeforeDirFileRunnable(Context context) {
            this.context = context;
        }
    }

    public static class RecursionDeleteFileRunnable implements Runnable {
        private File mNeedDeleteFile;

        @Override
        public void run() {
            TTHelper.recursionDeleteFile(this.mNeedDeleteFile);
        }

        public RecursionDeleteFileRunnable(File file) {
            this.mNeedDeleteFile = file;
        }
    }

    public class TTVideoEngineLooperThread2 {
        private boolean isLastHandlerThreadNull;
        private List<Condition> mCondList;
        private TTVideoEngineImpl mEngine;
        public Lock mEngineMsgLock;
        Parcel mEngineMsgRetValue;
        public Lock mMainMsgLock;
        Parcel mMainMsgRetValue;
        private HandlerThread mMessageThread;
        private Handler mEngineMsgHandler = null;
        private Handler mMainLooperHandler = null;
        private boolean mIsHandlingMainMsg = false;
        boolean mInjectedMsgThread = false;
        boolean mInjectedMsgNotAllowDestroy = false;
        private String lastHandlerThreadStr = "";
        private String lastCallbackLooperStr = "";

        public boolean isStarted() {
            if (this.mEngineMsgHandler != null) {
                return true;
            }
            return false;
        }

        public class RunnableMsgHandler implements Runnable {
            Message msg;
            WeakReference<Handler> msgHandler;

            @Override
            public void run() {
                Handler handler;
                WeakReference<Handler> weakReference = this.msgHandler;
                if (weakReference != null && (handler = weakReference.get()) != null) {
                    handler.handleMessage(this.msg);
                }
            }

            RunnableMsgHandler(Handler handler, Message message) {
                this.msgHandler = new WeakReference<>(handler);
                this.msg = message;
            }
        }

        boolean checkSendMainLooper() {
            Looper mainLooper;
            if (this.mEngineMsgHandler == null) {
                return false;
            }
            Handler handler = this.mMainLooperHandler;
            if (handler != null && handler.getLooper() != null && this.mMainLooperHandler.getLooper().getThread() != null && !this.mMainLooperHandler.getLooper().getThread().isAlive()) {
                TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "main looper thread is not alive, return false");
                return false;
            }
            if (Looper.myLooper() != null) {
                mainLooper = Looper.myLooper();
            } else {
                mainLooper = Looper.getMainLooper();
            }
            Handler handler2 = this.mMainLooperHandler;
            if (handler2 != null && handler2.getLooper() != mainLooper) {
                return true;
            }
            if (this.mMainLooperHandler != null) {
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "mainHandler looper:" + this.mMainLooperHandler.getLooper());
            }
            return false;
        }

        void closeEngineLooperThread() {
            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), " closeEngineLooperThread, handlerThread:" + this.mMessageThread + " ---TTVideoEnginePool");
            Lock lock = this.mEngineMsgLock;
            if (lock != null) {
                lock.lock();
                List<Condition> list = this.mCondList;
                if (list != null && !list.isEmpty()) {
                    for (int i = 0; i < this.mCondList.size(); i++) {
                        this.mCondList.get(i).signalAll();
                    }
                    this.mCondList.clear();
                }
                Handler handler = this.mEngineMsgHandler;
                if (handler != null) {
                    handler.removeCallbacksAndMessages(null);
                    Looper looper = this.mEngineMsgHandler.getLooper();
                    if (!this.mInjectedMsgThread || !this.mInjectedMsgNotAllowDestroy) {
                        looper.quit();
                    }
                    this.mEngineMsgHandler = null;
                }
                this.mEngineMsgLock.unlock();
            }
        }

        void postEngineMessage(int i) {
            postEngineMessage(i, 0, 0, null);
        }

        void runOnLooperThread(Runnable runnable) {
            Handler handler;
            if (checkEngineLooperThread(false)) {
                if (this.mEngine.mState != 5 && (handler = this.mEngineMsgHandler) != null) {
                    handler.post(runnable);
                    return;
                }
                return;
            }
            runnable.run();
        }

        boolean checkEngineLooperThread(boolean z) {
            if (this.mIsHandlingMainMsg && z) {
                TTVideoEngineLog.i(TTVideoEngineImpl.this.logcatTag(), "mIsHandlingMainMsg return false, thread:" + Looper.myLooper().getThread());
                return false;
            }
            Lock lock = this.mEngineMsgLock;
            if (lock != null) {
                lock.lock();
                if (this.mEngineMsgHandler != null && Looper.myLooper() != this.mEngineMsgHandler.getLooper()) {
                    this.mEngineMsgLock.unlock();
                    return true;
                }
                this.mEngineMsgLock.unlock();
            }
            return false;
        }

        public class MyMainLooperHandler extends Handler {
            private WeakReference<TTVideoEngineImpl> mEngineRef;

            @Override
            public void handleMessage(Message message) {
                Map map;
                Condition condition;
                Object obj;
                TTVideoEngineImpl tTVideoEngineImpl = this.mEngineRef.get();
                if (tTVideoEngineImpl == null) {
                    TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "engine is null, return.");
                    return;
                }
                String str = null;
                if (message.obj != null) {
                    map = (Map) message.obj;
                    if (map.containsKey("msgCond")) {
                        condition = (Condition) map.get("msgCond");
                    } else {
                        condition = null;
                    }
                    if (map.containsKey("paramObj")) {
                        obj = map.get("paramObj");
                    } else {
                        obj = null;
                    }
                } else {
                    map = null;
                    condition = null;
                    obj = null;
                }
                int i = message.what;
                if (i != 600) {
                    boolean z = false;
                    switch (i) {
                        case 400:
                            tTVideoEngineImpl.mListenerCompact.onPlaybackStateChanged(tTVideoEngineImpl.mEngineWrapper, message.arg1);
                            break;
                        case 401:
                            int i2 = message.arg1;
                            if (message.arg2 == 1) {
                                z = true;
                            }
                            if (z || i2 != 3) {
                                tTVideoEngineImpl.mListenerCompact.onLoadStateChanged(tTVideoEngineImpl.mEngineWrapper, i2);
                                break;
                            }
                            break;
                        case 402:
                            tTVideoEngineImpl.mListenerCompact.onVideoSizeChanged(tTVideoEngineImpl.mEngineWrapper, message.arg1, message.arg2);
                            break;
                        case 403:
                            tTVideoEngineImpl.mListenerCompact.onBufferingUpdate(tTVideoEngineImpl.mEngineWrapper, message.arg1);
                            break;
                        case 404:
                            tTVideoEngineImpl.mListenerCompact.onPrepare(tTVideoEngineImpl.mEngineWrapper);
                            break;
                        case 405:
                            tTVideoEngineImpl.mListenerCompact.onPrepared(tTVideoEngineImpl.mEngineWrapper);
                            break;
                        case 406:
                            if (obj instanceof String) {
                                String str2 = (String) obj;
                                if (!str2.equals(tTVideoEngineImpl.mTraceId)) {
                                    TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "MSG_NOTIFY_RENDER_START engine:" + tTVideoEngineImpl + ", traceId not same, should be:" + str2 + ", now:" + tTVideoEngineImpl.mTraceId);
                                    break;
                                } else {
                                    tTVideoEngineImpl.mListenerCompact.onRenderStart(tTVideoEngineImpl.mEngineWrapper);
                                    break;
                                }
                            }
                            break;
                        case 407:
                            tTVideoEngineImpl.mListenerCompact.onStreamChanged(tTVideoEngineImpl.mEngineWrapper, message.arg1);
                            break;
                        case 408:
                            tTVideoEngineImpl.mListenerCompact.onCompletion(tTVideoEngineImpl.mEngineWrapper);
                            break;
                        case 409:
                            tTVideoEngineImpl.mListenerCompact.onError((Error) obj);
                            break;
                        case 410:
                            tTVideoEngineImpl.mListenerCompact.onVideoStatusException(message.arg1);
                            break;
                        case TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL:
                            VideoModel videoModel = (VideoModel) obj;
                            if (tTVideoEngineImpl.mVideoInfoListener != null) {
                                boolean onFetchedVideoInfo = tTVideoEngineImpl.mVideoInfoListener.onFetchedVideoInfo(videoModel);
                                TTVideoEngineLooperThread2.this.mMainMsgRetValue.setDataPosition(0);
                                TTVideoEngineLooperThread2.this.mMainMsgRetValue.writeInt(onFetchedVideoInfo ? 1 : 0);
                                break;
                            }
                            break;
                        case TTVideoEngineInterface.PLAYER_OPTION_USE_AJ_MEDIACODEC:
                            VideoEngineInfoListener videoEngineInfoListener = tTVideoEngineImpl.mVideoEngineInfoListener;
                            if (videoEngineInfoListener != null) {
                                videoEngineInfoListener.onVideoEngineInfos((VideoEngineInfos) obj);
                                break;
                            }
                            break;
                        case TTVideoEngineInterface.PLAYER_OPTION_ENABEL_HARDWARE_DECODE_AUDIO:
                            Error error = (Error) obj;
                            if (map != null && map.containsKey("paramObj1")) {
                                str = (String) map.get("paramObj1");
                            }
                            tTVideoEngineImpl.mListenerCompact.onVideoURLRouteFailed(error, str);
                            break;
                        case TTVideoEngineInterface.PLAYER_OPTION_DEFAULT_RENDER_TYPE:
                            if (message.arg1 == 1) {
                                z = true;
                            }
                            if (tTVideoEngineImpl.mSeekCompletionListener != null) {
                                tTVideoEngineImpl.mSeekCompletionListener.onCompletion(z);
                                tTVideoEngineImpl.mSeekCompletionListener = null;
                                break;
                            }
                            break;
                        case 415:
                            if (obj instanceof Map) {
                                Map map2 = (Map) obj;
                                int intValue = ((Integer) map2.get("bufferStartAction")).intValue();
                                String str3 = (String) map2.get("traceid");
                                if (str3 != tTVideoEngineImpl.mTraceId) {
                                    TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "MSG_NOTIFY_BUFFER_START engine:" + tTVideoEngineImpl + ", traceId not same, should be:" + str3 + ", now:" + tTVideoEngineImpl.mTraceId);
                                    break;
                                } else {
                                    tTVideoEngineImpl.mListenerCompact.onBufferStart(message.arg1, message.arg2, intValue);
                                    break;
                                }
                            }
                            break;
                        case 416:
                            tTVideoEngineImpl.mListenerCompact.onBufferEnd(message.arg1);
                            break;
                        case 417:
                            tTVideoEngineImpl.mListenerCompact.onVideoStreamBitrateChanged((Resolution) obj, message.arg1);
                            break;
                        case TTVideoEngineInterface.PLAYER_OPTION_FORBID_P2P_WHEN_SEEK:
                            tTVideoEngineImpl.mListenerCompact.onSARChanged(message.arg1, message.arg2);
                            break;
                        case 419:
                            tTVideoEngineImpl.mListenerCompact.onReadyForDisplay(tTVideoEngineImpl.mEngineWrapper);
                            break;
                        case 420:
                            tTVideoEngineImpl.mListenerCompact.onAVBadInterlaced((Map) obj);
                            break;
                        case 421:
                            Map map3 = (Map) obj;
                            tTVideoEngineImpl.mListenerCompact.onFrameAboutToBeRendered(tTVideoEngineImpl.mEngineWrapper, ((Integer) map3.get("type")).intValue(), ((Long) map3.get("pts")).longValue(), ((Long) map3.get("wallClockTime")).longValue(), (HashMap) map3.get("frameData"));
                            break;
                        case 422:
                            if (obj instanceof String) {
                                String str4 = (String) obj;
                                if (!str4.equals(tTVideoEngineImpl.mTraceId)) {
                                    TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "MSG_NOTIFY_VIDEO_SECOND_FRAME engine:" + tTVideoEngineImpl + ", traceId not same, should be:" + str4 + ", now:" + tTVideoEngineImpl.mTraceId);
                                    break;
                                } else {
                                    tTVideoEngineImpl.mListenerCompact.onVideoSecondFrame(tTVideoEngineImpl.mEngineWrapper);
                                    break;
                                }
                            }
                            break;
                        case 423:
                            tTVideoEngineImpl.mLogger.showedFirstAVSyncVideoFrame(((Long) obj).longValue());
                            tTVideoEngineImpl.mListenerCompact.onFirstAVSyncFrame(TTVideoEngineImpl.this.mEngineWrapper);
                            break;
                        case 424:
                            tTVideoEngineImpl.mListenerCompact.onRefreshSurface(TTVideoEngineImpl.this.mEngineWrapper);
                            break;
                        case 425:
                            ListenerCompact listenerCompact = tTVideoEngineImpl.mListenerCompact;
                            if (listenerCompact != null) {
                                listenerCompact.onCurrentPlaybackTimeUpdate(TTVideoEngineImpl.this.mEngineWrapper, message.arg1);
                                break;
                            }
                            break;
                        default:
                            TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "unknown message: " + message.what);
                            break;
                    }
                } else {
                    tTVideoEngineImpl.mListenerCompact.onABRPredictBitrate(message.arg1, message.arg2);
                }
                TTVideoEngineLooperThread2 tTVideoEngineLooperThread2 = TTVideoEngineLooperThread2.this;
                tTVideoEngineLooperThread2.notifyMsgComplete(tTVideoEngineLooperThread2.mMainMsgLock, condition);
            }

            public MyMainLooperHandler(TTVideoEngineImpl tTVideoEngineImpl, Looper looper) {
                super(looper);
                this.mEngineRef = null;
                this.mEngineRef = new WeakReference<>(tTVideoEngineImpl);
            }
        }

        public class MessageHandler extends Handler {
            private WeakReference<TTVideoEngineImpl> mEngineRef;

            @Override
            public void handleMessage(Message message) {
                Map map;
                Object obj;
                Condition condition;
                String str;
                String str2;
                Condition condition2;
                TTVideoEngineImpl tTVideoEngineImpl = this.mEngineRef.get();
                if (tTVideoEngineImpl == null) {
                    TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "engine is null, return.");
                    return;
                }
                Map<Integer, String> map2 = null;
                String str3 = null;
                r2 = null;
                String str4 = null;
                r2 = null;
                String str5 = null;
                map2 = null;
                if (message.obj != null) {
                    map = (Map) message.obj;
                    if (map.containsKey("msgCond")) {
                        condition2 = (Condition) map.get("msgCond");
                    } else {
                        condition2 = null;
                    }
                    if (map.containsKey("paramObj")) {
                        obj = map.get("paramObj");
                    } else {
                        obj = null;
                    }
                    condition = condition2;
                } else {
                    map = null;
                    obj = null;
                    condition = null;
                }
                int i = message.what;
                if (i != 111) {
                    if (i != 300) {
                        if (i != 301) {
                            boolean z = true;
                            switch (i) {
                                case 1:
                                    tTVideoEngineImpl._doPlay();
                                    break;
                                case 2:
                                    tTVideoEngineImpl._doPause();
                                    break;
                                case 3:
                                    tTVideoEngineImpl._doStop();
                                    break;
                                case 4:
                                    tTVideoEngineImpl._doRelease();
                                    break;
                                case 5:
                                    tTVideoEngineImpl._doReleaseAsync();
                                    break;
                                case 6:
                                    if (message.arg1 != 1) {
                                        z = false;
                                    }
                                    tTVideoEngineImpl._doSetLooping(z);
                                    break;
                                case 7:
                                    tTVideoEngineImpl._seekTo(message.arg1, false);
                                    break;
                                case 8:
                                    if (obj != null) {
                                        Resolution resolution = (Resolution) obj;
                                        if (map != null && map.containsKey("paramObj1")) {
                                            map2 = (Map) map.get("paramObj1");
                                        }
                                        tTVideoEngineImpl._switchToResolution(resolution, map2);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_configResolution invalid param");
                                        break;
                                    }
                                    break;
                                case 9:
                                    if (obj != null) {
                                        float floatValue = ((Float) obj).floatValue();
                                        if (map != null && map.containsKey("paramObj1")) {
                                            tTVideoEngineImpl.setPlayerVolume(floatValue, ((Float) map.get("paramObj1")).floatValue());
                                            break;
                                        } else {
                                            tTVideoEngineImpl.setPlayerVolume(floatValue, floatValue);
                                            break;
                                        }
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_setPlayerVolume invalid param");
                                        break;
                                    }
                                    break;
                                case 10:
                                    if (message.arg1 != 1) {
                                        z = false;
                                    }
                                    tTVideoEngineImpl._setPlayerMute(z);
                                    break;
                                case 11:
                                    tTVideoEngineImpl._pauseByInterruption();
                                    break;
                                case 12:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetDataSource((FileDescriptor) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetDataSource invalid param");
                                        break;
                                    }
                                case 13:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetDataSource((IMediaDataSource) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetDataSource invalid param");
                                        break;
                                    }
                                case 14:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetVideoID((String) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetVideoID invalid param");
                                        break;
                                    }
                                case 15:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetPreloaderItem((TTAVPreloaderItem) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetVideoID invalid param");
                                        break;
                                    }
                                case 16:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetVideoModel((IVideoModel) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetVideoModel invalid param");
                                        break;
                                    }
                                case 17:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetPlayItem((TTVideoEnginePlayItem) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetPlayItem invalid param");
                                        break;
                                    }
                                case 18:
                                    if (obj != null) {
                                        tTVideoEngineImpl._doSetLocalURL((String) obj);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetLocalURL invalid param");
                                        break;
                                    }
                                case 19:
                                    if (obj != null) {
                                        String str6 = (String) obj;
                                        if (map != null && map.containsKey("paramObj1")) {
                                            tTVideoEngineImpl._doSetDirectURL(str6, (String) map.get("paramObj1"));
                                            break;
                                        } else {
                                            tTVideoEngineImpl._doSetDirectURL(str6, new String[]{str6});
                                            break;
                                        }
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetDirectURL invalid param");
                                        break;
                                    }
                                case 20:
                                    if (obj != null) {
                                        String[] strArr = (String[]) obj;
                                        if (map != null) {
                                            if (map.containsKey("paramObj1")) {
                                                str = (String) map.get("paramObj1");
                                            } else {
                                                str = null;
                                            }
                                            if (map.containsKey("paramObj2")) {
                                                str2 = (String) map.get("paramObj2");
                                            } else {
                                                str2 = null;
                                            }
                                        } else {
                                            str = null;
                                            str2 = null;
                                        }
                                        tTVideoEngineImpl._doSetDirectUrlUseDataLoader(strArr, str, str2, 0L, null);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "setDirectUrlUseDataLoader invalid param");
                                        break;
                                    }
                                case 21:
                                    if (obj != null) {
                                        String str7 = (String) obj;
                                        if (map != null && map.containsKey("paramObj1")) {
                                            str5 = (String) map.get("paramObj1");
                                        }
                                        tTVideoEngineImpl.setDirectUrlUseDataLoaderByFilePath(new String[]{str7}, str5);
                                        break;
                                    } else {
                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "setDirectUrlUseDataLoader invalid param");
                                        break;
                                    }
                                    break;
                                case 22:
                                    tTVideoEngineImpl._doPrepare();
                                    break;
                                case 23:
                                    tTVideoEngineImpl._doStart();
                                    break;
                                case 24:
                                    tTVideoEngineImpl._doHeartBeatThings();
                                    break;
                                default:
                                    switch (i) {
                                        case ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW:
                                            if (obj != null) {
                                                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper setStrategySource");
                                                tTVideoEngineImpl.doSetStrategySource((StrategySource) obj);
                                                break;
                                            } else {
                                                TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "setStrategySource invalid param");
                                                break;
                                            }
                                        case ConstantsAPI.COMMAND_JOINT_PAY:
                                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper forceDraw");
                                            tTVideoEngineImpl.doForceDraw();
                                            break;
                                        case 28:
                                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper setRotation " + message.arg1);
                                            tTVideoEngineImpl.doSetRotation(message.arg1);
                                            break;
                                        case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
                                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper setMirrorHorizontal " + message.arg1);
                                            if (message.arg1 <= 0) {
                                                z = false;
                                            }
                                            tTVideoEngineImpl.doSetMirrorHorizontal(z);
                                            break;
                                        case 30:
                                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper setMirrorVertical " + message.arg1);
                                            if (message.arg1 <= 0) {
                                                z = false;
                                            }
                                            tTVideoEngineImpl.doSetMirrorVertical(z);
                                            break;
                                        case 31:
                                            if (obj != null) {
                                                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "looper setPlayAuthToken");
                                                tTVideoEngineImpl.doSetPlayAuthToken((String) obj);
                                                break;
                                            } else {
                                                TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "doSetPlayAuthToken invalid param");
                                                break;
                                            }
                                        case 32:
                                            if (obj != null) {
                                                DirectUrlItem directUrlItem = (DirectUrlItem) obj;
                                                tTVideoEngineImpl._doSetDirectUrlUseDataLoader(directUrlItem.allUrls(), directUrlItem.fileKey(), directUrlItem.vid(), directUrlItem.cdnExpiredTime(), directUrlItem.urlExpireTimes());
                                                break;
                                            } else {
                                                TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "setDirectUrlUseDataLoader invalid param");
                                                break;
                                            }
                                        case 33:
                                            tTVideoEngineImpl._doResetByPool();
                                            break;
                                        case 34:
                                            tTVideoEngineImpl._createPlayerAsync();
                                            break;
                                        case 35:
                                            tTVideoEngineImpl._doClearTextureRef();
                                            break;
                                        default:
                                            switch (i) {
                                                case 50:
                                                    if (message.arg1 != 1) {
                                                        z = false;
                                                    }
                                                    tTVideoEngineImpl._doSetAsyncInit(z, message.arg2);
                                                    break;
                                                case IVideoEventLogger.LOGGER_OPTION_ENABLE_PLAYER_DEGRADE:
                                                    if (obj != null) {
                                                        tTVideoEngineImpl._setUnSupportSampleRates((int[]) obj);
                                                        break;
                                                    } else {
                                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_setUnSupportSampleRates invalid param");
                                                        break;
                                                    }
                                                case IVideoEventLogger.LOGGER_OPTION_IS_DEGRADE_RELEASE:
                                                    tTVideoEngineImpl._doSetTestSpeedEnable(message.arg1);
                                                    break;
                                                case ITTVideoEngineInternal.PLAYER_OPTION_GET_WATCHED_DUTATION:
                                                    if (obj != null) {
                                                        tTVideoEngineImpl._doSetPlaybackParams((PlaybackParams) obj);
                                                        break;
                                                    } else {
                                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetPlaybackParams invalid param");
                                                        break;
                                                    }
                                                case 54:
                                                    tTVideoEngineImpl.lambda$_setSurfaceSync$4$TTVideoEngineImpl((Surface) obj);
                                                    break;
                                                case 55:
                                                    SurfaceHolder surfaceHolder = (SurfaceHolder) obj;
                                                    if (message.arg1 != 1) {
                                                        z = false;
                                                    }
                                                    tTVideoEngineImpl._doSetSurfaceHolder(surfaceHolder, z);
                                                    break;
                                                case 56:
                                                    tTVideoEngineImpl._doSetPlayerSurface((Surface) obj, message.arg1);
                                                    break;
                                                case 57:
                                                    String str8 = (String) obj;
                                                    if (map != null && map.containsKey("paramObj1")) {
                                                        str4 = (String) map.get("paramObj1");
                                                    }
                                                    tTVideoEngineImpl._doSetCustomHeader(str8, str4);
                                                    break;
                                                default:
                                                    switch (i) {
                                                        case IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK:
                                                            tTVideoEngineImpl._doSetIntOption(message.arg1, message.arg2);
                                                            break;
                                                        case 102:
                                                            if (obj != null) {
                                                                tTVideoEngineImpl._doSetLongOption(message.arg1, ((Long) obj).longValue());
                                                                break;
                                                            } else {
                                                                TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetLongOption invalid param for key:" + message.arg1);
                                                                break;
                                                            }
                                                        case 103:
                                                            int _doGetIntOption = tTVideoEngineImpl._doGetIntOption(message.arg1);
                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(_doGetIntOption);
                                                            break;
                                                        case 104:
                                                            long _doGetLongOption = tTVideoEngineImpl._doGetLongOption(message.arg1);
                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeLong(_doGetLongOption);
                                                            break;
                                                        default:
                                                            switch (i) {
                                                                case 106:
                                                                    float _doGetFloatOption = tTVideoEngineImpl._doGetFloatOption(message.arg1);
                                                                    TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                    TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeFloat(_doGetFloatOption);
                                                                    break;
                                                                case 107:
                                                                    String _doGetStringOption = tTVideoEngineImpl._doGetStringOption(message.arg1);
                                                                    TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                    TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeString(_doGetStringOption);
                                                                    break;
                                                                case 108:
                                                                    if (obj != null) {
                                                                        tTVideoEngineImpl._doSetStringOption(message.arg1, (String) obj);
                                                                        break;
                                                                    } else {
                                                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetStrungOption invalid param for key:" + message.arg1);
                                                                        break;
                                                                    }
                                                                case 109:
                                                                    if (obj != null) {
                                                                        tTVideoEngineImpl._doSetObjectOption(message.arg1, obj);
                                                                        break;
                                                                    } else {
                                                                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doSetObjectOption invalid param for key:" + message.arg1);
                                                                        break;
                                                                    }
                                                                default:
                                                                    switch (i) {
                                                                        case 150:
                                                                            boolean _doIsSystemPlayer = tTVideoEngineImpl._doIsSystemPlayer();
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(_doIsSystemPlayer ? 1 : 0);
                                                                            break;
                                                                        case 151:
                                                                            int _doGetCurrentPlaybackTime = tTVideoEngineImpl._doGetCurrentPlaybackTime();
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(_doGetCurrentPlaybackTime);
                                                                            break;
                                                                        case 152:
                                                                            int videoWidth = tTVideoEngineImpl.getVideoWidth();
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(videoWidth);
                                                                            break;
                                                                        case 153:
                                                                            int videoHeight = tTVideoEngineImpl.getVideoHeight();
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(videoHeight);
                                                                            break;
                                                                        case 154:
                                                                            JSONObject _doGetPlayErrorInfo = tTVideoEngineImpl._doGetPlayErrorInfo();
                                                                            if (_doGetPlayErrorInfo != null) {
                                                                                str3 = _doGetPlayErrorInfo.toString();
                                                                            }
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeValue(str3);
                                                                            break;
                                                                        case 155:
                                                                            boolean _doIsMute = tTVideoEngineImpl._doIsMute();
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.setDataPosition(0);
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(_doIsMute ? 1 : 0);
                                                                            break;
                                                                        case 156:
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(tTVideoEngineImpl._doSupportByteVC1Playback() ? 1 : 0);
                                                                            break;
                                                                        case 157:
                                                                            TTVideoEngineLooperThread2.this.mEngineMsgRetValue.writeInt(tTVideoEngineImpl._doSupportByteVC2Playback() ? 1 : 0);
                                                                            break;
                                                                        default:
                                                                            TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "unknown message: " + message.what);
                                                                            break;
                                                                    }
                                                            }
                                                    }
                                            }
                                    }
                            }
                        } else if (obj != null) {
                            tTVideoEngineImpl._doParseIPAddress((IVideoModel) obj);
                        } else {
                            TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doParseDNSComplete no model");
                        }
                    } else if (obj != null) {
                        tTVideoEngineImpl._doParseDNSComplete((String) obj);
                    } else {
                        TTVideoEngineLog.w(TTVideoEngineImpl.this.logcatTag(), "_doParseDNSComplete invalid param");
                    }
                } else {
                    TTVideoEngineImpl.this._doSetTraitObject(message.arg1, (TraitObject) obj);
                }
                TTVideoEngineLooperThread2 tTVideoEngineLooperThread2 = TTVideoEngineLooperThread2.this;
                tTVideoEngineLooperThread2.notifyMsgComplete(tTVideoEngineLooperThread2.mEngineMsgLock, condition);
            }

            public MessageHandler(TTVideoEngineImpl tTVideoEngineImpl) {
                this.mEngineRef = null;
                this.mEngineRef = new WeakReference<>(tTVideoEngineImpl);
            }

            public MessageHandler(TTVideoEngineImpl tTVideoEngineImpl, Looper looper) {
                super(looper);
                this.mEngineRef = null;
                this.mEngineRef = new WeakReference<>(tTVideoEngineImpl);
            }
        }

        void notifyMsgComplete(Lock lock, Condition condition) {
            if (condition != null) {
                lock.lock();
                condition.signal();
                lock.unlock();
            }
        }

        void postEngineMessage(int i, int i2) {
            postEngineMessage(i, i2, 0, null);
        }

        void postEngineMessageDelay(int i, int i2) {
            postEngineMessageDelay(i, 0, 0, null, null, i2);
        }

        public void refreshAsyncPara(HandlerThread handlerThread, Looper looper) {
            if (isAsyncParaChanged(handlerThread, looper)) {
                closeEngineLooperThread();
                start(handlerThread, looper);
            }
        }

        boolean sendEngineMessage(int i, long j) {
            return sendEngineMessage(i, j, 0, 0, null);
        }

        public void setIntValue(int i, int i2) {
            boolean z;
            if (i == 0) {
                if (i2 != 0) {
                    z = true;
                } else {
                    z = false;
                }
                this.mInjectedMsgNotAllowDestroy = z;
            }
        }

        TTVideoEngineLooperThread2(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mEngine = tTVideoEngineImpl;
        }

        private boolean isAsyncParaChanged(HandlerThread handlerThread, Looper looper) {
            boolean z;
            String str;
            String str2 = "isAsyncParaChanged(" + handlerThread + "," + looper + ") , ";
            if (looper == null) {
                if (Looper.myLooper() == null) {
                    looper = Looper.getMainLooper();
                } else {
                    looper = Looper.myLooper();
                }
            }
            boolean z2 = true;
            if (this.mMainLooperHandler.getLooper() != looper) {
                z = true;
            } else {
                z = false;
            }
            if (handlerThread == null ? this.isLastHandlerThreadNull : this.mMessageThread == handlerThread) {
                z2 = z;
            }
            String str3 = "last time AsyncPara:" + this.lastHandlerThreadStr + "," + this.lastCallbackLooperStr;
            if (z2) {
                str = ",AsyncPara have changed!";
            } else {
                str = ",AsyncPara is same as last time!";
            }
            TTVideoEngineLog.i(TTVideoEngineImpl.this.logcatTag(), str2 + str3 + str + " ---TTVideoEnginePool");
            return z2;
        }

        public void start(HandlerThread handlerThread, Looper looper) {
            TTVideoEngineLog.i(TTVideoEngineImpl.this.logcatTag(), "start, handlerThread:" + handlerThread);
            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), " start, handlerThread:" + handlerThread + " ---TTVideoEnginePool");
            StringBuilder sb = new StringBuilder();
            sb.append(handlerThread);
            sb.append("");
            this.lastHandlerThreadStr = sb.toString();
            this.lastCallbackLooperStr = looper + "";
            this.mEngineMsgLock = new ReentrantLock();
            this.mCondList = new ArrayList();
            this.mEngineMsgRetValue = Parcel.obtain();
            if (handlerThread != null) {
                this.mMessageThread = handlerThread;
                this.mInjectedMsgThread = true;
                this.isLastHandlerThreadNull = false;
            } else {
                this.mMessageThread = new HandlerThread("engineMsgLooper");
                this.isLastHandlerThreadNull = true;
            }
            if (this.mMessageThread.getLooper() == null) {
                this.mMessageThread.start();
            }
            this.mEngineMsgHandler = new MessageHandler(this.mEngine, this.mMessageThread.getLooper());
            this.mMainMsgLock = new ReentrantLock();
            this.mMainMsgRetValue = Parcel.obtain();
            if (looper == null) {
                if (Looper.myLooper() == null) {
                    looper = Looper.getMainLooper();
                } else {
                    looper = Looper.myLooper();
                }
            }
            this.mMainLooperHandler = new MyMainLooperHandler(this.mEngine, looper);
            TTVideoEngineLog.i(TTVideoEngineImpl.this.logcatTag(), "enable engine looper thread");
        }

        void postEngineMessage(int i, int i2, int i3) {
            postEngineMessage(i, i2, i3, null);
        }

        boolean sendEngineMessage(int i, long j, int i2) {
            return sendEngineMessage(i, j, i2, 0, null);
        }

        void postMainLooperMessage(int i, int i2, int i3, Object obj) {
            postMainLooperMessage(i, i2, i3, obj, null);
        }

        void postEngineMessage(int i, int i2, int i3, Object obj) {
            postEngineMessage(i, i2, i3, obj, null);
        }

        boolean sendEngineMessage(int i, long j, int i2, int i3) {
            return sendEngineMessage(i, j, i2, i3, null);
        }

        void sendMainLooperMessage(int i, int i2, int i3, Object obj) {
            if (this.mMainLooperHandler != null) {
                HashMap hashMap = new HashMap();
                Condition newCondition = this.mMainMsgLock.newCondition();
                Message obtainMessage = this.mMainLooperHandler.obtainMessage(i, i2, i3);
                hashMap.put("paramObj", obj);
                hashMap.put("msgCond", newCondition);
                try {
                    try {
                        this.mMainMsgLock.lock();
                        this.mIsHandlingMainMsg = true;
                        obtainMessage.obj = hashMap;
                        obtainMessage.sendToTarget();
                        newCondition.await();
                        this.mIsHandlingMainMsg = false;
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                } finally {
                    this.mMainMsgLock.unlock();
                }
            }
        }

        void postMainLooperMessage(int i, int i2, int i3, Object obj, Object obj2) {
            if (this.mMainLooperHandler != null) {
                HashMap hashMap = new HashMap();
                hashMap.put("paramObj", obj);
                if (obj2 != null) {
                    hashMap.put("paramObj1", obj2);
                }
                Message obtainMessage = this.mMainLooperHandler.obtainMessage(i, i2, i3);
                obtainMessage.obj = hashMap;
                obtainMessage.sendToTarget();
            }
        }

        void postEngineMessage(int i, int i2, int i3, Object obj, Object obj2) {
            postEngineMessage(i, i2, i3, obj, obj2, null);
        }

        boolean sendEngineMessage(int i, long j, int i2, int i3, Object obj) {
            return sendEngineMessage(i, j, i2, i3, obj, null);
        }

        void postEngineMessageDelay(int i, int i2, int i3, Object obj, Object obj2, int i4) {
            Handler handler;
            if (this.mEngine.mState != 5 && (handler = this.mEngineMsgHandler) != null) {
                HashMap hashMap = new HashMap();
                hashMap.put("paramObj", obj);
                if (obj2 != null) {
                    hashMap.put("paramObj1", obj2);
                }
                Message obtainMessage = handler.obtainMessage(i, i2, i3);
                obtainMessage.obj = hashMap;
                handler.postDelayed(new RunnableMsgHandler(handler, obtainMessage), i4);
            }
        }

        void postEngineMessage(int i, int i2, int i3, Object obj, Object obj2, Object obj3) {
            Handler handler;
            if (this.mEngine.mState != 5 && (handler = this.mEngineMsgHandler) != null) {
                HashMap hashMap = new HashMap();
                hashMap.put("paramObj", obj);
                if (obj2 != null) {
                    hashMap.put("paramObj1", obj2);
                }
                if (obj3 != null) {
                    hashMap.put("paramObj2", obj3);
                }
                Message obtainMessage = handler.obtainMessage(i, i2, i3);
                obtainMessage.obj = hashMap;
                obtainMessage.sendToTarget();
            }
        }

        boolean sendEngineMessage(int i, long j, int i2, int i3, Object obj, Object obj2) {
            return sendEngineMessage(i, j, i2, i3, obj, obj2, false);
        }

        boolean sendEngineMessage(int i, long j, int i2, int i3, Object obj, Object obj2, boolean z) {
            boolean z2 = false;
            if (this.mEngine.mState == 5) {
                return false;
            }
            Handler handler = this.mEngineMsgHandler;
            if (handler != null && this.mEngineMsgLock != null) {
                HashMap hashMap = new HashMap();
                Condition newCondition = this.mEngineMsgLock.newCondition();
                Message obtainMessage = handler.obtainMessage(i, i2, i3);
                hashMap.put("paramObj", obj);
                hashMap.put("msgCond", newCondition);
                if (obj2 != null) {
                    hashMap.put("paramObj1", obj2);
                }
                boolean z3 = true;
                try {
                    try {
                        this.mEngineMsgLock.lock();
                        if (this.mEngine.mState == 5) {
                            return false;
                        }
                        this.mCondList.add(newCondition);
                        obtainMessage.obj = hashMap;
                        if (z) {
                            handler.sendMessageAtFrontOfQueue(obtainMessage);
                        } else {
                            obtainMessage.sendToTarget();
                        }
                        if (j > 0) {
                            boolean await = newCondition.await(j, TimeUnit.MILLISECONDS);
                            if (!await) {
                                try {
                                    if (handler.hasMessages(i)) {
                                        TTVideoEngineLog.i(TTVideoEngineImpl.this.logcatTag(), "handle message " + i + " timeout " + j);
                                        handler.removeMessages(i);
                                        z3 = false;
                                    }
                                } catch (InterruptedException e) {
                                    e = e;
                                    z3 = await;
                                    e.printStackTrace();
                                }
                            }
                        } else {
                            newCondition.await();
                        }
                    } catch (InterruptedException e2) {
                        e = e2;
                    }
                } finally {
                    int i4 = this.mEngine.mState;
                    this.mCondList.remove(newCondition);
                    this.mEngineMsgLock.unlock();
                }
            }
            return z2;
        }
    }

    boolean _doIsMute() {
        return super.isMute();
    }

    @Override
    public int getAudioLatencytime() {
        return getAudioLatencyTime();
    }

    @Override
    public List<String> getCacheKeys() {
        return new ArrayList(this.mUsingDataLoaderPlayTaskKeys);
    }

    @Override
    public StrategySource getStrategySource() {
        return this.mCodecStrategyAdapter.getStrategySource();
    }

    @Override
    public EventLoggerSource getVideoEngineDataSource() {
        return new MyLoggerDataSource(this);
    }

    @Override
    public boolean isReportLogEnable() {
        return this.mLogger.isUploadLogEnabled();
    }

    @Override
    public boolean isSupportHDR() {
        return InfoWrapper.isHDREnable();
    }

    @Override
    public boolean isSupportSR() {
        return InfoWrapper.isSREnable();
    }

    @Override
    public boolean isSystemPlayer() {
        return _doIsSystemPlayer();
    }

    public void lambda$_fetchVideoInfo$6$TTVideoEngineImpl() {
        _parseIPAddress(this.mVideoModel);
    }

    @Override
    public String logcatTag() {
        return this.mEngineWrapper.logcatTag();
    }

    public static class MyPlayStateSupplier implements IPlayStateSupplier {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;
        private int mSidxVideoWindowSize = -1;
        private int mSidxAudioWindowSize = -1;

        @Override
        public Queue<j> getTimelineNetworkSpeed() {
            return null;
        }

        @Override
        public int getCurrentDownloadAudioBitrate() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return -1;
            }
            return tTVideoEngineImpl.mABRCurrentDownloadedAudioBitrate;
        }

        @Override
        public int getNetworkState() {
            return TTNetWorkListener.getInstance().getCurrentAccessType();
        }

        @Override
        public int getCurrentDownloadAudioSegmentIndex() {
            MediaPlayer mediaPlayer;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return -1;
            }
            return mediaPlayer.getIntOption(519, -1);
        }

        @Override
        public int getCurrentDownloadVideoBitrate() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mMediaPlayer == null) {
                return -1;
            }
            return tTVideoEngineImpl.mMediaPlayer.getIntOption(601, -1);
        }

        @Override
        public int getCurrentDownloadVideoSegmentIndex() {
            MediaPlayer mediaPlayer;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return -1;
            }
            return mediaPlayer.getIntOption(520, -1);
        }

        @Override
        public int getCurrentPlaybackTime() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mMediaPlayer == null) {
                return -1;
            }
            return tTVideoEngineImpl.mMediaPlayer.getCurrentPosition();
        }

        @Override
        public int getMaxCacheAudioTime() {
            MediaPlayer mediaPlayer;
            int intOption;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null || (intOption = mediaPlayer.getIntOption(24, -1)) <= 0) {
                return 30000;
            }
            return intOption * 1000;
        }

        @Override
        public int getMaxCacheVideoTime() {
            MediaPlayer mediaPlayer;
            int intOption;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null || (intOption = mediaPlayer.getIntOption(24, -1)) <= 0) {
                return 30000;
            }
            return intOption * 1000;
        }

        @Override
        public float getPlaySpeed() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mPlaybackParams == null) {
                return 1.0f;
            }
            return tTVideoEngineImpl.mPlaybackParams.getSpeed();
        }

        @Override
        public int getPlayerAudioCacheTime() {
            MediaPlayer mediaPlayer;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return -1;
            }
            return (int) mediaPlayer.getLongOption(73, -1L);
        }

        @Override
        public int getPlayerVideoCacheTime() {
            MediaPlayer mediaPlayer;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return -1;
            }
            return (int) mediaPlayer.getLongOption(72, -1L);
        }

        @Override
        public float getDownloadSpeed() {
            Map<String, String> b2;
            if (StrategyCenter.sNetAbrSpeedPredictor != null && (b2 = StrategyCenter.sNetAbrSpeedPredictor.b(VideoRef.TYPE_VIDEO)) != null && b2.get("download_speed") != null) {
                return Float.parseFloat(b2.get("download_speed"));
            }
            return -1.0f;
        }

        @Override
        public int getLoaderType() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mMediaPlayer == null) {
                return -1;
            }
            try {
                return Integer.parseInt(tTVideoEngineImpl.mMediaPlayer.getStringOption(200));
            } catch (Exception e) {
                TTVideoEngineLog.d(e);
                return -1;
            }
        }

        @Override
        public float getNetworkSpeed() {
            if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                float a2 = StrategyCenter.sNetAbrSpeedPredictor.a(0);
                TTVideoEngineLog.d(TTVideoEngineInternal.logcatTag(this.mVideoEngineRef.get()), "[ABR] get network speed:" + a2);
                return a2;
            }
            return -1.0f;
        }

        @Override
        public float getSpeedConfidence() {
            if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                float e = StrategyCenter.sNetAbrSpeedPredictor.e();
                TTVideoEngineLog.d(TTVideoEngineInternal.logcatTag(this.mVideoEngineRef.get()), "[ABR] get network confidence:" + e);
                return e;
            }
            return -1.0f;
        }

        @Override
        public Map<String, m> getAudioBufferInfo() {
            List<VideoInfo> videoInfoList;
            HashMap hashMap = new HashMap();
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoModel != null && (videoInfoList = tTVideoEngineImpl.mVideoModel.getVideoInfoList()) != null && videoInfoList.size() != 0) {
                for (VideoInfo videoInfo : videoInfoList) {
                    if (videoInfo != null && videoInfo.getMediatype() == VideoRef.TYPE_AUDIO) {
                        com.bytedance.vcloud.abrmodule.b bVar = new com.bytedance.vcloud.abrmodule.b();
                        String valueStr = videoInfo.getValueStr(15);
                        bVar.f34304a = valueStr;
                        bVar.f34306c = TTVideoEngine.getCacheFileSize(valueStr);
                        if (videoInfo.getBitrateFitterInfo() != null) {
                            bVar.d = r4.getHeaderSize();
                        }
                        hashMap.put("" + videoInfo.getValueInt(3), bVar);
                    }
                }
            }
            return hashMap;
        }

        @Override
        public Map<String, m> getVideoBufferInfo() {
            List<VideoInfo> videoInfoList;
            HashMap hashMap = new HashMap();
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoModel != null && (videoInfoList = tTVideoEngineImpl.mVideoModel.getVideoInfoList()) != null && videoInfoList.size() != 0) {
                for (VideoInfo videoInfo : videoInfoList) {
                    if (videoInfo != null && videoInfo.getMediatype() == VideoRef.TYPE_VIDEO) {
                        com.bytedance.vcloud.abrmodule.b bVar = new com.bytedance.vcloud.abrmodule.b();
                        String valueStr = videoInfo.getValueStr(15);
                        bVar.f34304a = valueStr;
                        bVar.f34306c = TTVideoEngine.getCacheFileSize(valueStr);
                        if (videoInfo.getBitrateFitterInfo() != null) {
                            bVar.d = r4.getHeaderSize();
                        }
                        hashMap.put("" + videoInfo.getValueInt(3), bVar);
                    }
                }
            }
            return hashMap;
        }

        public MyPlayStateSupplier(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public List<? extends n> getSegmentInfoList(int i, int i2) {
            MediaPlayer mediaPlayer;
            Object objectOption;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return null;
            }
            ArrayList arrayList = new ArrayList();
            if (i != this.mSidxVideoWindowSize) {
                this.mSidxVideoWindowSize = i;
                mediaPlayer.setIntOption(522, i);
            }
            if (i2 != this.mSidxAudioWindowSize) {
                this.mSidxAudioWindowSize = i2;
                mediaPlayer.setIntOption(523, i2);
            }
            if ((mediaPlayer instanceof MediaPlayerWrapper) && (objectOption = ((MediaPlayerWrapper) mediaPlayer).getObjectOption(521)) != null) {
                for (Object obj : (Object[]) objectOption) {
                    arrayList.add(new SegmentInfo(obj));
                }
            }
            return arrayList;
        }

        @Override
        public float getAverageDownloadSpeed(int i, int i2, boolean z) {
            if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                return StrategyCenter.sNetAbrSpeedPredictor.a(i, i2, z);
            }
            return -1.0f;
        }
    }

    public class URLInfo {
        public String hostURL;
        public String ipURL;
        public boolean isIp;

        public String getCurrentURL() {
            if (this.isIp) {
                return this.ipURL;
            }
            return this.hostURL;
        }

        public void reset() {
            this.hostURL = null;
            this.ipURL = null;
            this.isIp = false;
        }

        public void setHostURL(String str) {
            this.hostURL = str;
            this.isIp = false;
        }

        public void setIpURL(String str) {
            this.ipURL = str;
            this.isIp = true;
        }

        private URLInfo() {
            this.isIp = false;
        }

        URLInfo(TTVideoEngineImpl tTVideoEngineImpl, AnonymousClass1 anonymousClass1) {
            this();
        }
    }

    private void _dataLoaderAddEngineRef() {
        DataLoaderHelper.getDataLoader()._addEngine(this.mEngineWrapper, this.mUsingDataLoaderPlayRawKey);
    }

    private int _getPlayerTime() {
        if (this.mMediaPlayer == null) {
            return 0;
        }
        return this.mMediaPlayer.getCurrentPosition();
    }

    void _doClearTextureRef() {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setSurface(null);
        }
        releaseTextureRenderRef();
    }

    void _doStart() {
        this.mShouldPlay = true;
        this.mShouldStop = false;
        this.mUserStopped = false;
        this.mAccumulatedErrorCount = 0;
        _play(true);
        this.mIsPlayComplete = false;
    }

    @Override
    public synchronized void createPlayer() {
        if (this.mAsyncPlayer == null) {
            this.mAsyncPlayer = createMediaPlayer();
        }
    }

    @Override
    public int getAudioLatencyTime() {
        if (this.mMediaPlayer == null) {
            return 0;
        }
        return this.mMediaPlayer.getIntOption(567, 0);
    }

    @Override
    public String getCurrentPlayPath() {
        if (this.mIsLocal) {
            return this.mLocalURL;
        }
        return this.mURLInfo.hostURL;
    }

    @Override
    public TTVNetClient getNetClientSetByUser() {
        TTVNetClient tTVNetClient = this.mNetClient;
        if (tTVNetClient != null) {
            return tTVNetClient;
        }
        if (TTVideoEngineConfig.gNetClient != null) {
            return TTVideoEngineConfig.gNetClient;
        }
        return null;
    }

    @Override
    public String getPlayerSessionId() {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            return iVideoEventLogger.getStringOption(86);
        }
        return null;
    }

    @Override
    public MediaPlayer.TrackInfo[] getTrackInfo() {
        if (this.mMediaPlayer == null) {
            return null;
        }
        return this.mMediaPlayer.getTrackInfo();
    }

    @Override
    public VideoModel getVideoModel() {
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel instanceof VideoModel) {
            return (VideoModel) iVideoModel;
        }
        return null;
    }

    @Override
    public void saveEvent() {
        this.mLooperThread.runOnLooperThread(new Runnable() {
            @Override
            public final void run() {
                TTVideoEngineImpl.this.lambda$saveEvent$5$TTVideoEngineImpl();
            }
        });
    }

    @Override
    public Bitmap saveFrame() {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return null;
        }
        try {
            return videoSurface.saveFrame();
        } catch (Exception unused) {
            return null;
        }
    }

    @Override
    public String[] supportedQualityInfos() {
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            return iVideoModel.getSupportQualityInfos();
        }
        return null;
    }

    @Override
    public List<com.ss.ttvideoengine.model.SubInfo> supportedSubInfoList() {
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            return iVideoModel.getSubInfoList();
        }
        return null;
    }

    @Override
    public int[] supportedSubtitleLangs() {
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            return iVideoModel.getSupportSubtitleLangs();
        }
        return null;
    }

    public static class MyDNSCompletionListener implements DNSCompletionListener {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        @Override
        public void onCancelled() {
            TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(this.mVideoEngineRef.get()), "dns cancelled");
        }

        public MyDNSCompletionListener(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public void onRetry(Error error) {
            if (error != null) {
                return;
            }
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetcher should retry, error:" + error.toString());
            if (tTVideoEngineImpl == null) {
                return;
            }
            tTVideoEngineImpl.mLogger.firstDNSFailed(error);
        }

        @Override
        public void onCompletion(JSONObject jSONObject, Error error) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            if (tTVideoEngineImpl.mShouldStop) {
                TTVideoEngineLog.w(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "MyDNSCompletionListener should stop");
                return;
            }
            if (error != null) {
                TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "dns failed:" + error.toString());
                tTVideoEngineImpl.receivedError(error);
                return;
            }
            String str = null;
            if (jSONObject != null) {
                str = jSONObject.optString("ip");
                long optLong = jSONObject.optLong("time");
                String optString = jSONObject.optString("dns_type");
                if (tTVideoEngineImpl.mLogger != null) {
                    tTVideoEngineImpl.mLogger.setDNSEndTime(optLong);
                    tTVideoEngineImpl.mLogger.setStringOption(86, optString);
                }
            }
            if (TextUtils.isEmpty(str)) {
                tTVideoEngineImpl.receivedError(new Error("", -9997, "DNS result empty"));
                TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "dns parse empty");
            } else {
                tTVideoEngineImpl._parseDNSComplete(str);
            }
        }
    }

    public static class MyLoggerDataSource implements EventLoggerSource {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        @Override
        public ArrayList forebackSwitchList() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineGetInfoListener != null) {
                Object info = tTVideoEngineImpl.mVideoEngineGetInfoListener.getInfo(2);
                if (info instanceof ArrayList) {
                    return (ArrayList) info;
                }
            }
            return null;
        }

        @Override
        public String getMediaLoaderInfo() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.getConfigInt(160, tTVideoEngineImpl.mDataLoaderEnable) != 0) {
                return DataLoaderHelper.getDataLoader().getPlayLog(tTVideoEngineImpl.mTraceId);
            }
            int i = 0;
            if (tTVideoEngineImpl != null) {
                i = tTVideoEngineImpl.getConfigInt(160, tTVideoEngineImpl.mDataLoaderEnable);
            }
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "videoEngine is:" + tTVideoEngineImpl + ", dataloader enable:" + i);
            return null;
        }

        @Override
        public Map<String, Long> bytesInfo() {
            MediaPlayer mediaPlayer;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || (mediaPlayer = tTVideoEngineImpl.mMediaPlayer) == null) {
                return null;
            }
            HashMap hashMap = new HashMap();
            hashMap.put("vds", Long.valueOf(mediaPlayer.getLongOption(45, 0L)));
            hashMap.put("vps", Long.valueOf(mediaPlayer.getLongOption(46, 0L)));
            hashMap.put("download_speed", Long.valueOf(mediaPlayer.getLongOption(63, -1L)));
            hashMap.put("vlen", Long.valueOf(mediaPlayer.getLongOption(72, -1L)));
            hashMap.put("alen", Long.valueOf(mediaPlayer.getLongOption(73, -1L)));
            hashMap.put("vDecLen", Long.valueOf(mediaPlayer.getLongOption(602, -1L)));
            hashMap.put("aDecLen", Long.valueOf(mediaPlayer.getLongOption(603, -1L)));
            hashMap.put("vBaseLen", Long.valueOf(mediaPlayer.getLongOption(604, -1L)));
            hashMap.put("aBaseLen", Long.valueOf(mediaPlayer.getLongOption(605, -1L)));
            hashMap.put("avGap", Long.valueOf(mediaPlayer.getLongOption(606, -1L)));
            hashMap.put("single_vds", Long.valueOf(mediaPlayer.getLongOption(145, 0L)));
            hashMap.put("accu_vds", Long.valueOf(mediaPlayer.getLongOption(476, 0L)));
            return hashMap;
        }

        @Override
        public Map<String, String> versionInfo() {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return null;
            }
            HashMap hashMap = new HashMap();
            String value = TTPlayerConfiger.getValue(14, "");
            if (tTVideoEngineImpl.mPlayerType != 0 && tTVideoEngineImpl.mPlayerType != 1) {
                if (tTVideoEngineImpl.mPlayerType == 2) {
                    hashMap.put("sv", "5.6");
                    hashMap.put("pv", "1.0");
                    hashMap.put("pc", "0");
                    hashMap.put("sdk_version", "1.10.158.101-novel");
                } else if (tTVideoEngineImpl.mPlayerType == 5) {
                    hashMap.put("sv", "5.6");
                    hashMap.put("pv", "5.0");
                    hashMap.put("pc", "5");
                    hashMap.put("sdk_version", "1.10.158.101-novel");
                } else {
                    hashMap.put("sv", "5.6");
                    hashMap.put("pv", "4.0");
                    hashMap.put("pc", value);
                    hashMap.put("sdk_version", "1.10.158.101-novel");
                }
            } else {
                hashMap.put("sv", "5.6");
                if (tTVideoEngineImpl.mMediaPlayer != null) {
                    String stringOption = tTVideoEngineImpl.mMediaPlayer.getStringOption(1095);
                    TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "playerLibName:" + stringOption);
                    if ("ttmplayerbeta" == stringOption) {
                        hashMap.put("pv", "3.0-beta");
                    } else {
                        hashMap.put("pv", "3.0");
                    }
                } else {
                    hashMap.put("pv", "3.0");
                }
                hashMap.put("pc", value);
                hashMap.put("sdk_version", "1.10.158.101-novel");
            }
            hashMap.put("trv", r.a(24));
            try {
                hashMap.put("ffv", (String) a.a("com.ss.ttffmpeg.FFmpegLibLoaderWrapper").getMethod("getFFmpegVersion", new Class[0]).invoke(null, new Object[0]));
            } catch (Throwable th) {
                TTVideoEngineLog.w(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "get ffmpeg version error: " + th.toString());
            }
            return hashMap;
        }

        public MyLoggerDataSource(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public Map<String, Object> getLogValueMap(int i) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || i != 155 || tTVideoEngineImpl.mVideoEngineGetInfoListener == null) {
                return null;
            }
            return tTVideoEngineImpl.mVideoEngineGetInfoListener.getInfoMap(4);
        }

        @Override
        public float getLogValueFloat(int i) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mMediaPlayer == null) {
                return -1.0f;
            }
            if (i != 82) {
                if (i != 83) {
                    return -1.0f;
                }
                return tTVideoEngineImpl.mMediaPlayer.getFloatOption(150, -1.0f);
            }
            return tTVideoEngineImpl.mMediaPlayer.getFloatOption(151, -1.0f);
        }

        @Override
        public int getLogValueInt(int i) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return -1;
            }
            switch (i) {
                case 21:
                    return tTVideoEngineImpl.mPlaybackState;
                case 22:
                    return tTVideoEngineImpl.mLoadState;
                case 23:
                    return tTVideoEngineImpl.mState;
                case 24:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    if (tTVideoEngineImpl.mVideoCodecType < 0) {
                        tTVideoEngineImpl.mVideoCodecType = tTVideoEngineImpl.mMediaPlayer.getIntOption(157, -1);
                    }
                    return tTVideoEngineImpl.mVideoCodecType;
                case 25:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    if (tTVideoEngineImpl.mAudioCodecType < 0) {
                        tTVideoEngineImpl.mAudioCodecType = tTVideoEngineImpl.mMediaPlayer.getIntOption(158, -1);
                    }
                    return tTVideoEngineImpl.mAudioCodecType;
                case ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW:
                    return (int) tTVideoEngineImpl.getVolume();
                case ConstantsAPI.COMMAND_JOINT_PAY:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    if (tTVideoEngineImpl.mMediaPlayer.isMute()) {
                        return 1;
                    }
                    return 0;
                case 30:
                    return tTVideoEngineImpl.mPlayAPIVersion;
                case 34:
                    return tTVideoEngineImpl.getConfigInt(203, tTVideoEngineImpl.mMovPreferNearestSample);
                case 35:
                    return tTVideoEngineImpl.mNetworkTimeout;
                case 36:
                    return tTVideoEngineImpl.getConfigInt(198, tTVideoEngineImpl.mIsDisableShortSeek);
                case MotionEventCompat.AXIS_GENERIC_11:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(221, -1);
                case MotionEventCompat.AXIS_GENERIC_12:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(222, -1);
                case MotionEventCompat.AXIS_GENERIC_13:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(245, -1);
                case 49:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(44, -1);
                case 61:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(53, -1);
                case 63:
                    if (tTVideoEngineImpl.mVideoCodecProfile != -1) {
                        return tTVideoEngineImpl.mVideoCodecProfile;
                    }
                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                        tTVideoEngineImpl.mVideoCodecProfile = tTVideoEngineImpl.mMediaPlayer.getIntOption(403, -1);
                    }
                    return tTVideoEngineImpl.mVideoCodecProfile;
                case 64:
                    if (tTVideoEngineImpl.mAudioCodecProfile != -1) {
                        return tTVideoEngineImpl.mAudioCodecProfile;
                    }
                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                        tTVideoEngineImpl.mAudioCodecProfile = tTVideoEngineImpl.mMediaPlayer.getIntOption(402, -1);
                    }
                    return tTVideoEngineImpl.mAudioCodecProfile;
                case 67:
                    if (tTVideoEngineImpl.mCurPosition > 0) {
                        return tTVideoEngineImpl.mCurPosition;
                    }
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getCurrentPosition();
                case 69:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(601, -1);
                case 77:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(540, -1);
                case 79:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(826, -1);
                case 81:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(643, -1);
                case 84:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(186, -1);
                case 85:
                    return EngineGlobalConfig.getInstance().getDnsCustomType();
                case 87:
                    if (tTVideoEngineImpl.mSurface == null) {
                        return 1;
                    }
                    return 0;
                case 88:
                    return tTVideoEngineImpl.mRadioModeEnable;
                case 89:
                    HeadsetStateMonitor headsetStateMonitor = tTVideoEngineImpl.mHeadsetMonitor;
                    if (headsetStateMonitor == null) {
                        return -1;
                    }
                    return headsetStateMonitor.isWiredConnected() ? 1 : 0;
                case 90:
                    HeadsetStateMonitor headsetStateMonitor2 = tTVideoEngineImpl.mHeadsetMonitor;
                    if (headsetStateMonitor2 == null) {
                        return -1;
                    }
                    return headsetStateMonitor2.isWirelessConnected() ? 1 : 0;
                case 94:
                    if (tTVideoEngineImpl.mVideoEngineGetInfoListener == null) {
                        return -1;
                    }
                    Object info = tTVideoEngineImpl.mVideoEngineGetInfoListener.getInfo(1);
                    if (!(info instanceof Integer)) {
                        return -1;
                    }
                    return ((Integer) info).intValue();
                case 97:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(181, -1);
                case 100:
                    return tTVideoEngineImpl.mTextureRenderError;
                case IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK:
                    return tTVideoEngineImpl.isplaybackUsedSR() ? 1 : 0;
                case 103:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(24, -1);
                case 109:
                    i iVar = tTVideoEngineImpl.mABRModule;
                    if (iVar == null) {
                        return -1;
                    }
                    return (int) iVar.b(53, -1L);
                case 113:
                    int i2 = tTVideoEngineImpl.mSetValidSurfaceTimeout;
                    tTVideoEngineImpl.mSetValidSurfaceTimeout = 0;
                    return i2;
                case 114:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(469, -1);
                case 121:
                    return TTVideoEngine.sEnableGloablMuteFeature;
                case 122:
                    return TTVideoEngine.sGlobalMute;
                case 142:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(754, -1);
                case 145:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return 0;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(758, 0);
                case MediaPlayer.MEDIA_PLAYER_OPTION_ABR_STREAM_INFO:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(1339, -1);
                case 148:
                    return TTVideoEngine.sEnableEncryptBuryData;
                case 154:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(1354, -1);
                case 156:
                    if (tTVideoEngineImpl.mMediaPlayer == null) {
                        return -1;
                    }
                    return tTVideoEngineImpl.mMediaPlayer.getIntOption(849, -1);
                default:
                    return -1;
            }
        }

        @Override
        public long getLogValueLong(int i) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return -1L;
            }
            if (i != 95) {
                MediaPlayer mediaPlayer = tTVideoEngineImpl.mMediaPlayer;
                if (mediaPlayer == null) {
                    return -1L;
                }
                if (i != 91) {
                    if (i != 92) {
                        if (i != 137) {
                            if (i != 138) {
                                if (i != 140) {
                                    if (i != 141) {
                                        int i2 = -1;
                                        switch (i) {
                                            case 7:
                                                return mediaPlayer.getLongOption(68, -1L);
                                            case 10:
                                                return mediaPlayer.getLongOption(69, -1L);
                                            case 11:
                                                return mediaPlayer.getLongOption(70, -1L);
                                            case 12:
                                                return mediaPlayer.getLongOption(75, -1L);
                                            case 13:
                                                return mediaPlayer.getLongOption(76, -1L);
                                            case 14:
                                                return mediaPlayer.getLongOption(77, -1L);
                                            case 15:
                                                return mediaPlayer.getLongOption(78, -1L);
                                            case 16:
                                                return mediaPlayer.getLongOption(156, -1L);
                                            case 17:
                                                return mediaPlayer.getLongOption(155, -1L);
                                            case 18:
                                                return mediaPlayer.getLongOption(163, -1L);
                                            case 19:
                                                return mediaPlayer.getLongOption(162, -1L);
                                            case MotionEventCompat.AXIS_GENERIC_14:
                                                return mediaPlayer.getLongOption(152, -1L);
                                            case 66:
                                                return mediaPlayer.getLongOption(517, -1L);
                                            case 68:
                                                return mediaPlayer.getLongOption(72, -1L);
                                            case 75:
                                                return mediaPlayer.getLongOption(171, -1L);
                                            case 96:
                                                return mediaPlayer.getLongOption(526, -1L);
                                            case 112:
                                                return tTVideoEngineImpl.mLastSetSurfaceNullTime;
                                            case 144:
                                                if (tTVideoEngineImpl.getConfigInt(742, tTVideoEngineImpl.mEnableGetPlayerReqOffset) != 0) {
                                                    i2 = -2;
                                                }
                                                return mediaPlayer.getLongOption(757, i2);
                                            case 149:
                                                if (tTVideoEngineImpl.getConfigInt(742, tTVideoEngineImpl.mEnableGetPlayerReqOffset) != 0) {
                                                    i2 = -3;
                                                }
                                                return mediaPlayer.getLongOption(757, i2);
                                            case 150:
                                                return mediaPlayer.getLongOption(759, -1L);
                                            case 152:
                                                return mediaPlayer.getLongOption(1352, -1L);
                                            case 153:
                                                return mediaPlayer.getLongOption(1353, -1L);
                                            default:
                                                switch (i) {
                                                    case 38:
                                                        return mediaPlayer.getLongOption(307, -1L);
                                                    case 39:
                                                        return mediaPlayer.getLongOption(308, -1L);
                                                    case MotionEventCompat.AXIS_GENERIC_9:
                                                        return tTVideoEngineImpl.mPlayTime;
                                                    case 41:
                                                        return tTVideoEngineImpl.mVVTime;
                                                    default:
                                                        switch (i) {
                                                            case IVideoEventLogger.LOGGER_OPTION_ENABLE_PLAYER_DEGRADE:
                                                                return mediaPlayer.getLongOption(267, -1L);
                                                            case IVideoEventLogger.LOGGER_OPTION_IS_DEGRADE_RELEASE:
                                                                return mediaPlayer.getLongOption(268, -1L);
                                                            case ITTVideoEngineInternal.PLAYER_OPTION_GET_WATCHED_DUTATION:
                                                                return mediaPlayer.getLongOption(269, -1L);
                                                            case 54:
                                                                return mediaPlayer.getLongOption(606, -1L);
                                                            default:
                                                                switch (i) {
                                                                    case 56:
                                                                        return mediaPlayer.getLongOption(45, -1L);
                                                                    case 57:
                                                                        return mediaPlayer.getLongOption(607, -1L);
                                                                    case 58:
                                                                        return mediaPlayer.getLongOption(608, -1L);
                                                                    default:
                                                                        switch (i) {
                                                                            case 70:
                                                                                return mediaPlayer.getLongOption(636, -1L);
                                                                            case 71:
                                                                                return mediaPlayer.getLongOption(637, -1L);
                                                                            case 72:
                                                                                return mediaPlayer.getLongOption(638, -1L);
                                                                            case 73:
                                                                                return mediaPlayer.getLongOption(639, -1L);
                                                                            default:
                                                                                switch (i) {
                                                                                    case 104:
                                                                                        return mediaPlayer.getLongOption(73, -1L);
                                                                                    case IVideoLayerCommand.VIDEO_HOST_CMD_NOFITY_FULLSCREEN:
                                                                                        return mediaPlayer.getLongOption(72, -1L);
                                                                                    case 106:
                                                                                        return mediaPlayer.getLongOption(579, tTVideoEngineImpl.currentBitrate);
                                                                                    case 107:
                                                                                        return mediaPlayer.getLongOption(577, tTVideoEngineImpl.currentBitrate);
                                                                                    case 108:
                                                                                        return mediaPlayer.getLongOption(578, tTVideoEngineImpl.currentBitrate);
                                                                                    default:
                                                                                        switch (i) {
                                                                                            case 115:
                                                                                                return mediaPlayer.getLongOption(583, -1L);
                                                                                            case 116:
                                                                                                return mediaPlayer.getLongOption(588, -1L);
                                                                                            case 117:
                                                                                                return mediaPlayer.getLongOption(584, -1L);
                                                                                            case 118:
                                                                                                return mediaPlayer.getLongOption(589, -1L);
                                                                                            case 119:
                                                                                                return mediaPlayer.getLongOption(585, -1L);
                                                                                            case 120:
                                                                                                return mediaPlayer.getLongOption(590, -1L);
                                                                                            default:
                                                                                                return -1L;
                                                                                        }
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                }
                                        }
                                    }
                                    return mediaPlayer.getLongOption(753, -1L);
                                }
                                return mediaPlayer.getLongOption(752, -1L);
                            }
                            return mediaPlayer.getLongOption(856, -1L);
                        }
                        return mediaPlayer.getLongOption(1801, -1L);
                    }
                    return tTVideoEngineImpl.mLastSwitchResolutionTime;
                }
                return tTVideoEngineImpl.mLastSwitchRadioModeTime;
            }
            if (tTVideoEngineImpl.mVideoEngineGetInfoListener == null) {
                return -1L;
            }
            Object info = tTVideoEngineImpl.mVideoEngineGetInfoListener.getInfo(3);
            if (!(info instanceof Long)) {
                return -1L;
            }
            return ((Long) info).longValue();
        }

        @Override
        public String getLogValueStr(int i) {
            String str;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            String str2 = "";
            if (tTVideoEngineImpl == null) {
                return "";
            }
            String str3 = "unknown_codec";
            if (i != 0) {
                if (i != 1) {
                    if (i != 2) {
                        if (i != 3) {
                            if (i != 4) {
                                if (i != 5) {
                                    if (i != 110) {
                                        if (i != 111) {
                                            switch (i) {
                                                case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
                                                    return tTVideoEngineImpl.mAuthorization;
                                                case 37:
                                                    return DataLoaderHelper.getDataLoader().getStringValue(6);
                                                case 46:
                                                    if (tTVideoEngineImpl.mLogger == null) {
                                                        return "";
                                                    }
                                                    return tTVideoEngineImpl.mLogger.getExtraInfo();
                                                case 55:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(609);
                                                    }
                                                case 65:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(516);
                                                    }
                                                case 76:
                                                    if (tTVideoEngineImpl.currentVideoInfo == null) {
                                                        return "";
                                                    }
                                                    return tTVideoEngineImpl.currentVideoInfo.getValueStr(7);
                                                case 78:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(825);
                                                    }
                                                case 80:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(824);
                                                    }
                                                case 102:
                                                    return tTVideoEngineImpl.mAbrVer;
                                                case 139:
                                                    if (tTVideoEngineImpl.getConfigInt(1402, tTVideoEngineImpl.mEnableReportPreloadTraceId ? 1 : 0) != 1) {
                                                        return null;
                                                    }
                                                    String str4 = tTVideoEngineImpl.mVideoID;
                                                    String str5 = tTVideoEngineImpl.mMDLGroupId;
                                                    DataLoaderHelper dataLoader = DataLoaderHelper.getDataLoader();
                                                    if (TextUtils.isEmpty(str5)) {
                                                        str = str4;
                                                    } else {
                                                        str = str5;
                                                    }
                                                    String preloadTraceId = dataLoader.getPreloadTraceId(str);
                                                    TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "get preloadTraceId = " + preloadTraceId + ", groupId = " + str5 + ", videoID = " + str4 + ", engine = " + tTVideoEngineImpl);
                                                    if (!TextUtils.isEmpty(preloadTraceId)) {
                                                        DataLoaderHelper.getDataLoader().resetPreloadTraceId(str4);
                                                        TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "reset preloadTraceId = " + preloadTraceId);
                                                    }
                                                    return preloadTraceId;
                                                case 143:
                                                    if (tTVideoEngineImpl.getConfigInt(1215, tTVideoEngineImpl.mEnablePreloadGear) != 1 || tTVideoEngineImpl.mMediaPlayer == null) {
                                                        return "";
                                                    }
                                                    return tTVideoEngineImpl.mMediaPlayer.getStringOption(755);
                                                case 146:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        String stringOption = tTVideoEngineImpl.mMediaPlayer.getStringOption(TTVideoEngineInterface.PLAYER_OPTION_DISABLE_EVENTV3_ASYNC);
                                                        if (!TextUtils.isEmpty(stringOption)) {
                                                            str3 = stringOption;
                                                        }
                                                        TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "audio codec: " + str3);
                                                        return str3;
                                                    }
                                                case 151:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(481);
                                                    }
                                                case 157:
                                                    if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(848);
                                                    }
                                                default:
                                                    switch (i) {
                                                        case 31:
                                                            try {
                                                                return Build.BOARD;
                                                            } catch (Exception e) {
                                                                TTVideoEngineLog.d(e);
                                                                return "";
                                                            }
                                                        case 32:
                                                            try {
                                                                return Build.HARDWARE;
                                                            } catch (Exception e2) {
                                                                TTVideoEngineLog.d(e2);
                                                                return "";
                                                            }
                                                        case 33:
                                                            if (tTVideoEngineImpl.mMediaPlayer != null) {
                                                                return tTVideoEngineImpl.mMediaPlayer.getStringOption(200);
                                                            }
                                                        default:
                                                            return "";
                                                    }
                                            }
                                        } else {
                                            if (TTVideoEngineImpl.mChipBoardName == null) {
                                                try {
                                                    BufferedReader bufferedReader = new BufferedReader(new FileReader("proc/cpuinfo"));
                                                    String readLine = bufferedReader.readLine();
                                                    while (true) {
                                                        if (readLine == null) {
                                                            break;
                                                        }
                                                        if (readLine.contains("Hardware")) {
                                                            String[] split = readLine.split(":");
                                                            if (split.length > 1) {
                                                                str2 = split[1];
                                                            }
                                                        } else {
                                                            readLine = bufferedReader.readLine();
                                                        }
                                                    }
                                                    TTVideoEngineImpl.mChipBoardName = str2.trim();
                                                } catch (Exception e3) {
                                                    TTVideoEngineLog.d(e3);
                                                }
                                            }
                                            return TTVideoEngineImpl.mChipBoardName;
                                        }
                                    } else if (tTVideoEngineImpl.mMediaPlayer != null) {
                                        return tTVideoEngineImpl.mMediaPlayer.getStringOption(467);
                                    }
                                } else if (tTVideoEngineImpl.mMediaPlayer != null) {
                                    return tTVideoEngineImpl.mMediaPlayer.getStringOption(71);
                                }
                            } else {
                                if (tTVideoEngineImpl.getNetClientSetByUser() == null) {
                                    return "own";
                                }
                                return "user";
                            }
                        } else {
                            return tTVideoEngineImpl.mAPIString;
                        }
                    } else {
                        MediaPlayer mediaPlayer = tTVideoEngineImpl.mMediaPlayer;
                        if (mediaPlayer != null) {
                            return mediaPlayer.getStringOption(5002);
                        }
                    }
                } else if (tTVideoEngineImpl.mMediaPlayer != null) {
                    int intOption = tTVideoEngineImpl.mMediaPlayer.getIntOption(139, -1);
                    if (intOption != 0) {
                        if (intOption == 1) {
                            return "nativewindow";
                        }
                    } else {
                        return "opengl";
                    }
                }
            } else if (tTVideoEngineImpl.mMediaPlayer != null) {
                String stringOption2 = tTVideoEngineImpl.mMediaPlayer.getStringOption(478);
                int intOption2 = tTVideoEngineImpl.mMediaPlayer.getIntOption(141, -1);
                if (intOption2 == 1) {
                    stringOption2 = "bytevc1";
                } else if (intOption2 == 33) {
                    stringOption2 = "bytevc2";
                }
                if (!tTVideoEngineImpl.isInHousePlayer() && intOption2 == 0) {
                    stringOption2 = "h264";
                }
                if (!TextUtils.isEmpty(stringOption2)) {
                    str3 = stringOption2;
                }
                TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "video codec: " + str3);
                return str3;
            }
            return "";
        }

        @Override
        public void onInfo(int i, Map map) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            switch (i) {
                case 0:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
                        videoEngineInfos.setKey("bufferStartInfos");
                        videoEngineInfos.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos, false);
                        return;
                    }
                    return;
                case 1:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos2 = new VideoEngineInfos();
                        videoEngineInfos2.setKey("bufferEndInfos");
                        videoEngineInfos2.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos2, false);
                        return;
                    }
                    return;
                case 2:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        JSONObject jSONObject = new JSONObject(map);
                        VideoEngineInfos videoEngineInfos3 = new VideoEngineInfos();
                        videoEngineInfos3.setKey("firstframe_split");
                        videoEngineInfos3.setObject(jSONObject);
                        videoEngineInfos3.setGroupID(tTVideoEngineImpl.mGroupID);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos3, true);
                        return;
                    }
                    return;
                case 3:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos4 = new VideoEngineInfos();
                        videoEngineInfos4.setKey("outsyncStartInfos");
                        videoEngineInfos4.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos4, false);
                        return;
                    }
                    return;
                case 4:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos5 = new VideoEngineInfos();
                        videoEngineInfos5.setKey("outsyncEndInfos");
                        videoEngineInfos5.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos5, false);
                        return;
                    }
                    return;
                case 5:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos6 = new VideoEngineInfos();
                        videoEngineInfos6.setKey("noRenderStartInfos");
                        videoEngineInfos6.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos6, false);
                        return;
                    }
                    return;
                case 6:
                    if (tTVideoEngineImpl != null && tTVideoEngineImpl.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos7 = new VideoEngineInfos();
                        videoEngineInfos7.setKey("noRenderEndInfos");
                        videoEngineInfos7.setObject(map);
                        tTVideoEngineImpl.notifyEngineInfo(videoEngineInfos7, false);
                        return;
                    }
                    return;
                default:
                    return;
            }
        }
    }

    private boolean _checkRefreshSurface() {
        if (this.mMediaPlayer == null || this.mMediaPlayer.getIntOption(1320, 0) != 1) {
            return false;
        }
        return true;
    }

    private void _clearSurface() {
        Surface surface;
        if (getConfigInt(520, this.mClearShutDown ? 1 : 0) == 0) {
            return;
        }
        if (this.mSurfaceHolder != null) {
            surface = this.mSurfaceHolder.getSurface();
        } else {
            surface = this.mSurface;
        }
        clearSurface(surface, false);
    }

    private void _initUsingHandle() {
        if (this.mHandler != null) {
            return;
        }
        this.mHandler = new Handler(TTHelper.getLooper()) {
            @Override
            public void handleMessage(Message message) {
                String str;
                String str2;
                super.handleMessage(message);
                if (message.what == 10) {
                    String str3 = (String) message.obj;
                    long j = message.arg1;
                    int i = message.arg2;
                    String str4 = TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.get(UGCMonitor.TYPE_VIDEO);
                    String str5 = TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.get("audio");
                    if (TTVideoEngineImpl.this.mState == 5) {
                        return;
                    }
                    if (!TextUtils.isEmpty(str5) && str5.equals(str3)) {
                        if (TTVideoEngineImpl.this.mLogger != null) {
                            TTVideoEngineImpl.this.mLogger.setDashAudioCacheSize(j);
                            TTVideoEngineImpl.this.mLogger.setIntOption(183, i);
                        }
                    } else if (!TextUtils.isEmpty(str4) && str4.equals(str3) && TTVideoEngineImpl.this.mLogger != null) {
                        TTVideoEngineImpl.this.mLogger.setDashVideoCacheSize(j);
                        TTVideoEngineImpl.this.mLogger.setIntOption(182, i);
                    }
                    String str6 = "";
                    if (TTVideoEngineImpl.this.mUsingDataLoaderPlayFilePaths != null && TTVideoEngineImpl.this.mUsingDataLoaderPlayFilePaths.contains(str3)) {
                        TTVideoEngineImpl.this.mVideoPreloadSize += j;
                        if (TTVideoEngineImpl.this.mLogger != null) {
                            TTVideoEngineImpl.this.mLogger.setVideoCacheSize(TTVideoEngineImpl.this.mVideoPreloadSize);
                            TTVideoEngineImpl.this.mLogger.setIntOption(181, i);
                        }
                        String logcatTag = TTVideoEngineImpl.this.logcatTag();
                        StringBuilder sb = new StringBuilder();
                        sb.append("using mdl cache, key :");
                        sb.append(str3);
                        sb.append(" size = ");
                        sb.append(j);
                        sb.append(" vid = ");
                        if (TextUtils.isEmpty(TTVideoEngineImpl.this.mVideoID)) {
                            str2 = "";
                        } else {
                            str2 = TTVideoEngineImpl.this.mVideoID;
                        }
                        sb.append(str2);
                        sb.append(" groupid = ");
                        if (!TextUtils.isEmpty(TTVideoEngineImpl.this.mMDLGroupId)) {
                            str6 = TTVideoEngineImpl.this.mMDLGroupId;
                        }
                        sb.append(str6);
                        sb.append(" miss reason = ");
                        sb.append(i);
                        TTVideoEngineLog.i(logcatTag, sb.toString());
                        if ((TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.size() < 2 || TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.containsValue(str3)) && TTVideoEngineImpl.this.mVideoEngineInfoListener != null) {
                            VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
                            videoEngineInfos.setKey("mdlfilepathhitcachesize");
                            videoEngineInfos.mUsingMDLPlayFilePath = str3;
                            videoEngineInfos.mHitCacheSize = j;
                            TTVideoEngineImpl.this.notifyEngineInfo(videoEngineInfos, true);
                            return;
                        }
                        return;
                    }
                    if (TTVideoEngineImpl.this.mUsingDataLoaderPlayTaskKeys != null && TTVideoEngineImpl.this.mUsingDataLoaderPlayTaskKeys.contains(str3)) {
                        TTVideoEngineImpl.this.mVideoPreloadSize += j;
                        if (TTVideoEngineImpl.this.mLogger != null) {
                            TTVideoEngineImpl.this.mLogger.setVideoCacheSize(TTVideoEngineImpl.this.mVideoPreloadSize);
                        }
                        String logcatTag2 = TTVideoEngineImpl.this.logcatTag();
                        StringBuilder sb2 = new StringBuilder();
                        sb2.append("using mdl cache, key :");
                        sb2.append(str3);
                        sb2.append(" size = ");
                        sb2.append(j);
                        sb2.append(" vid = ");
                        if (TextUtils.isEmpty(TTVideoEngineImpl.this.mVideoID)) {
                            str = "";
                        } else {
                            str = TTVideoEngineImpl.this.mVideoID;
                        }
                        sb2.append(str);
                        sb2.append(" groupid = ");
                        if (!TextUtils.isEmpty(TTVideoEngineImpl.this.mMDLGroupId)) {
                            str6 = TTVideoEngineImpl.this.mMDLGroupId;
                        }
                        sb2.append(str6);
                        sb2.append(" miss reason = ");
                        sb2.append(i);
                        TTVideoEngineLog.i(logcatTag2, sb2.toString());
                        if ((TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.size() < 2 || TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.containsValue(str3)) && TTVideoEngineImpl.this.mVideoEngineInfoListener != null) {
                            VideoEngineInfos videoEngineInfos2 = new VideoEngineInfos();
                            videoEngineInfos2.setKey("mdlhitcachesize");
                            videoEngineInfos2.mUsingMDLPlayTaskKey = str3;
                            videoEngineInfos2.mHitCacheSize = j;
                            TTVideoEngineImpl.this.notifyEngineInfo(videoEngineInfos2, true);
                            return;
                        }
                        return;
                    }
                    return;
                }
                if (message.what == 33) {
                    TTVideoEngineImpl.this._doResetByPool();
                }
            }

            AnonymousClass7(Looper looper) {
                super(looper);
            }
        };
    }

    private void _resetUrlIndexMap() {
        for (Resolution resolution : Resolution.getAllResolutions()) {
            this.urlIndexMap.put(resolution, 0);
            this.dashVideoUrlMap.put(resolution, "");
        }
    }

    private void _resetUsingDataLoaderField() {
        this.mUsingDataLoaderPlayTaskKeys.clear();
        this.mUsingDataLoaderPlayFilePaths.clear();
        this.mUsingDataLoaderPlayRawKey = null;
        this.mMediaInfoMap.clear();
    }

    private void fetchSmartUrlInfo() {
        this.mState = 1;
        this.mIsFetchingInfo = true;
        TTVideoEngineLog.d(logcatTag(), "start to fetch smart url info.");
        _resetUrlIndexMap();
        CodecStrategyAdapter codecStrategyAdapter = this.mCodecStrategyAdapter;
        if (codecStrategyAdapter != null) {
            codecStrategyAdapter.fetchSmartUrlInfo(new SmartUrlInfoCallback(this));
        }
    }

    private int getBufferStartAction() {
        if (this.mSeeking && this.mResolutionSwitching) {
            if (this.mSeekingStartTime <= this.mResolutionSwitchingStartTime) {
                return 2;
            }
            return 1;
        }
        if (this.mSeeking) {
            return 1;
        }
        if (this.mResolutionSwitching) {
            return 2;
        }
        return 0;
    }

    private String getFilePath() {
        if (this.mIsLocal || this.mIsPlayItem || this.mIsPreloaderItem || !this.mIsDirectURL) {
            return null;
        }
        return this.mFileKey;
    }

    private boolean isPcdnNeedPlayInfo() {
        if (EngineGlobalConfig.getInstance().getPcdnAuto() == 1) {
            if (this.mEnableSetPlayInfoToP2P != 1) {
                return false;
            }
            return true;
        }
        if (this.mP2PCDNType <= 0) {
            return false;
        }
        return true;
    }

    private boolean isPlayerSupportSeekMode() {
        if (!isPlayerType(0) && !isPlayerType(1) && !isPlayerType(3) && !isPlayerType(4)) {
            return false;
        }
        return true;
    }

    private boolean shouldStartTextureRenderCheck() {
        if (this.mTextureSurface != null && this.mRadioModeEnable != 1 && this.mEnableTextureRenderNoRenderCheck == 1 && !this.mSeeking && !this.mSeamSwitchingResolution && this.mLoadState == 1 && this.mPlaybackState == 1) {
            return true;
        }
        return false;
    }

    public void _createPlayerAsync() {
        TTVideoEngineLog.i("TTVideoEngine", "create player async");
        if (this.mAsyncPlayer == null) {
            this.mAsyncPlayer = createMediaPlayer();
        }
    }

    int _doGetCurrentPlaybackTime() {
        int i;
        if (!this.mSeamSwitchingResolution && (this.mSeekMode != 0 || !this.mSeeking)) {
            i = _getPlayerTime();
        } else {
            i = this.mLastPlaybackTime;
        }
        _updateCurrentInfoToMDL(i);
        return i;
    }

    boolean _doIsSystemPlayer() {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer == null) {
            if (this.mPlayerType != 2 && this.mPlayerType != 5) {
                return false;
            }
            return true;
        }
        if (!mediaPlayer.isOSPlayer() && mediaPlayer.getPlayerType() != 5) {
            return false;
        }
        return true;
    }

    @Override
    public void createPlayerAsync() {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(34);
        } else {
            _createPlayerAsync();
        }
    }

    @Override
    public void forceDraw() {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(27);
        } else {
            doForceDraw();
        }
    }

    @Override
    public int getCurrentPlaybackTimeAsync() {
        if (this.mPlayerType != 2 && this.mPlayerType != 5 && getConfigInt(602, this.mPosUpdateInterval) > 0) {
            return this.mCurPosition;
        }
        return getCurrentPlaybackTime();
    }

    @Override
    public float getMaxVolume() {
        int i;
        if (this.mContext == null) {
            return 0.0f;
        }
        AudioManager audioManager = (AudioManager) this.mContext.getSystemService("audio");
        int i2 = 0;
        if (audioManager != null) {
            i = audioManager.getStreamMaxVolume(3);
        } else {
            i = 0;
        }
        if (i >= 0) {
            i2 = i;
        }
        return i2;
    }

    @Override
    protected void notifyCompletion() {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(408, 0, 0, null);
        } else {
            this.mListenerCompact.onCompletion(this.mEngineWrapper);
        }
    }

    @Override
    protected void notifyPrepare() {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(404, 0, 0, null);
        } else {
            this.mListenerCompact.onPrepare(this.mEngineWrapper);
        }
    }

    @Override
    protected void notifyPrepared() {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(405, 0, 0, null);
        } else {
            this.mListenerCompact.onPrepared(this.mEngineWrapper);
        }
    }

    @Override
    protected void notifyReadyForDisplay() {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(419, 0, 0, null);
        } else {
            this.mListenerCompact.onReadyForDisplay(this.mEngineWrapper);
        }
    }

    @Override
    protected void notifyRenderStart() {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(406, 0, 0, this.mTraceId);
        } else {
            this.mListenerCompact.onRenderStart(this.mEngineWrapper);
        }
    }

    @Override
    public void pauseByInterruption() {
        TTVideoEngineLog.i(logcatTag(), "pause by interruption");
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(11);
        } else {
            _pauseByInterruption();
        }
    }

    @Override
    public Resolution[] supportedResolutionTypes() {
        TTAVPreloaderItem tTAVPreloaderItem;
        if (this.mIsPreloaderItem && (tTAVPreloaderItem = this.mPreloaderItem) != null) {
            return tTAVPreloaderItem.supportResolutions();
        }
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            return iVideoModel.getSupportResolutions();
        }
        return new Resolution[0];
    }

    public static class MyReleaseRunnable implements Runnable {
        private i mABRModule;
        private WeakReference<TTVideoEngineImpl> mEngineRef;
        private MediaPlayer mPlayer;

        @Override
        public void run() {
            if (this.mPlayer != null) {
                try {
                    TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(this.mEngineRef.get()), "MyReleaseRunnable release");
                    this.mPlayer.release();
                    this.mPlayer = null;
                    i iVar = this.mABRModule;
                    if (iVar != null) {
                        iVar.d();
                        this.mABRModule = null;
                    }
                } catch (Exception e) {
                    TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(this.mEngineRef.get()), e.toString());
                }
            }
        }

        public MyReleaseRunnable(TTVideoEngineImpl tTVideoEngineImpl, MediaPlayer mediaPlayer, i iVar) {
            this.mEngineRef = new WeakReference<>(tTVideoEngineImpl);
            this.mPlayer = mediaPlayer;
            this.mABRModule = iVar;
        }
    }

    private void _configNativeRenderRotationAdapt() {
        int vodInt = SettingsHelper.helper().getVodInt("native_render_rotation_adapt", getConfigInt(566, this.mNativeRenderRotationAdapt));
        if (this.mConfigCenterVersion > 0) {
            this.mEngineConfig.setIntOption(566, vodInt);
        } else {
            this.mNativeRenderRotationAdapt = vodInt;
        }
        TTVideoEngineLog.i(logcatTag(), "native render rotation adapt: " + vodInt);
    }

    private void _configNativeYV12Render() {
        int vodInt = SettingsHelper.helper().getVodInt("native_yv12_render", getConfigInt(543, this.mEnableNativeYV12Render));
        if (this.mConfigCenterVersion > 0) {
            this.mEngineConfig.setIntOption(543, vodInt);
        } else {
            this.mEnableNativeYV12Render = vodInt;
        }
        TTVideoEngineLog.i(logcatTag(), "enabled native YV12: " + vodInt);
    }

    private void _dataLoaderRemoveEngineRef() {
        DataLoaderHelper.getDataLoader()._removeEngine(this.mEngineWrapper, this.mUsingDataLoaderPlayRawKey);
        if (this.mUsingDataLoaderPlayTaskKeys != null) {
            for (int i = 0; i < this.mUsingDataLoaderPlayTaskKeys.size(); i++) {
                DataLoaderHelper.getDataLoader()._removePlayTask(this.mUsingDataLoaderPlayTaskKeys.get(i));
            }
        }
        _resetUsingDataLoaderField();
        this.mBashDashDefaultMDLKeys.clear();
    }

    private void _doRecordSurface() {
        if (this.mSurfaceRecord != null) {
            Map<Surface, Boolean> map = mSurfaceHashMap;
            if (map.size() >= 15) {
                map.clear();
            }
            if (getIntOption(1071) == 1) {
                map.put(this.mSurfaceRecord, true);
            } else {
                map.put(this.mSurfaceRecord, false);
            }
        }
    }

    private void _firstAVSyncFrame() {
        TTVideoEngineLog.i(logcatTag(), "player callback first av sync frame");
        long currentTimeMillis = System.currentTimeMillis();
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(423, 0, 0, Long.valueOf(currentTimeMillis));
        } else {
            this.mLogger.showedFirstAVSyncVideoFrame(currentTimeMillis);
            this.mListenerCompact.onFirstAVSyncFrame(this.mEngineWrapper);
        }
    }

    private void _formaterStart() {
        if (getConfigInt(664, this.mEnableDebugUINotify) != 0 && this.mPlayerEventListener != null && this.mMediaPlayer != null) {
            this.mPlayerEventListener.onMediaOpened(getVideoFormatInfo(), this.mMediaPlayer.getLongOption(621, 0L), this.mMediaPlayer.getLongOption(625, 0L));
        }
    }

    private Map _getCommentInfo() {
        if (this.mMediaPlayer == null) {
            return null;
        }
        String stringOption = this.mMediaPlayer.getStringOption(47);
        HashMap hashMap = new HashMap();
        if (stringOption != null) {
            for (String str : stringOption.replaceAll(" ", "").split(",")) {
                String[] split = str.split(":");
                if (split.length == 2) {
                    hashMap.put(split[0], split[1]);
                }
            }
        }
        return hashMap;
    }

    private void _logRenderStartTime() {
        if (!this.mHasFirstFrameShown && this.mLogger != null) {
            this.mVVTime = System.currentTimeMillis();
            this.mRenderStartTime = SystemClock.elapsedRealtime();
            TTVideoEngineLog.i(logcatTag(), "mRenderStartTime:" + this.mRenderStartTime + ", curT:" + this.mVVTime);
            this.mLogger.showedOneFrame();
        }
    }

    private void _pause() {
        TTVideoEngineLog.i(logcatTag(), "_pause");
        if (!this.mPrepared) {
            this.mPausedBeforePrepared = true;
            updatePlaybackState(2);
            return;
        }
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null) {
            TTVideoEngineLog.d(logcatTag(), "player will pause");
            mediaPlayer.pause();
            updatePlaybackState(2);
            _updateTextureState(2);
        }
        i iVar = this.mABRModule;
        if (iVar != null) {
            iVar.c();
            this.mLogger.setIsEnableABR(0);
        }
    }

    private void _refreshSurface() {
        TTVideoEngineLog.i(logcatTag(), "refresh surface");
        if (this.mRefreshSurfaceDone) {
            return;
        }
        this.mRefreshSurfaceDone = true;
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            TTVideoEngineLooperThread2 tTVideoEngineLooperThread2 = this.mLooperThread;
            if (tTVideoEngineLooperThread2 != null && tTVideoEngineLooperThread2.checkSendMainLooper()) {
                this.mLooperThread.postMainLooperMessage(424, 0, 0, null);
                return;
            }
            ListenerCompact listenerCompact = this.mListenerCompact;
            if (listenerCompact != null) {
                listenerCompact.onRefreshSurface(this.mEngineWrapper);
                return;
            }
            return;
        }
        this.mRefreshTextureSurface = true;
        videoSurface.setIntOption(133, 1);
    }

    private void _secondFrame() {
        TTVideoEngineLog.i(logcatTag(), "player callback the second frame");
        if (getConfigInt(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME, this.mFirstFrameOpenTexture) == 0 && this.mTextureSurface == null) {
            if (this.mLooperThread.checkSendMainLooper()) {
                this.mLooperThread.postMainLooperMessage(422, 0, 0, this.mTraceId);
            } else {
                this.mListenerCompact.onVideoSecondFrame(this.mEngineWrapper);
            }
        }
    }

    private void _setExtraSurface() {
        if (this.mTextureSurface != null) {
            while (this.mExtraSurfaceQueue.peek() != null) {
                Pair<Surface, Integer> poll = this.mExtraSurfaceQueue.poll();
                this.mTextureSurface.setExtraRenderSurface((Surface) poll.first, ((Integer) poll.second).intValue());
            }
        }
    }

    private void _settingThirdPartyProtocol() {
        if (this.mFFmpegProtocol != null && isInHousePlayer()) {
            String stringOption = this.mMediaPlayer.getStringOption(1027);
            String protocolName = this.mFFmpegProtocol.getProtocolName();
            if (stringOption != null && !stringOption.equals(protocolName)) {
                this.mMediaPlayer.setLongOption(1026, this.mFFmpegProtocol.getURLProtocol());
            }
            this.mMediaPlayer.setLongOption(1028, this.mFFmpegProtocol.getAVDictionary());
        }
    }

    private void _tryNextURL() {
        Integer num;
        Map<Resolution, Integer> map = this.urlIndexMap;
        if (map != null && (num = map.get(this.currentResolution)) != null) {
            this.urlIndexMap.put(this.currentResolution, Integer.valueOf(num.intValue() + 1));
            _parseIPAddress(this.mVideoModel);
        }
    }

    private void _videoRenderStartNotify() {
        PlayerEventSimpleListener playerEventSimpleListener;
        if (getConfigInt(664, this.mEnableDebugUINotify) != 0 && this.mMediaPlayer != null && (playerEventSimpleListener = this.mPlayerEventListener) != null) {
            playerEventSimpleListener.onVideoRenderOpened(this.mMediaPlayer.getIntOption(139, -1), this.mMediaPlayer.getLongOption(155, -1L), this.mMediaPlayer.getLongOption(162, -1L));
        }
    }

    private int clearMdlCache() {
        for (String str : this.mFileHashs) {
            TTVideoEngineLog.i(logcatTag(), "clear mdl cache by filekey: " + str);
            TTVideoEngine.forceRemoveCacheFile(str);
        }
        return 0;
    }

    private boolean deleteCacheFile() {
        String filePath = getFilePath();
        if (filePath == null || filePath.length() == 0) {
            return true;
        }
        File file = new File(filePath);
        try {
            if (file.isFile()) {
                if (file.delete()) {
                    return true;
                }
                return false;
            }
            return false;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return false;
        }
    }

    private void fallbackOSPlayer() {
        if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() != 0) {
            this.mMediaPlayer.releaseAsync();
            this.mMediaPlayer = null;
        }
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer != null && mediaPlayer.getPlayerType() != 0) {
            this.mAsyncPlayer.releaseAsync();
            this.mAsyncPlayer = null;
        }
        TTVideoEngineLog.d(logcatTag(), "license invalid fallback to os player");
        this.mPlayerType = 2;
    }

    private String getDefaultCacheFileDirPath() {
        String appFilesPath = TTHelper.getAppFilesPath(this.mContext);
        if (appFilesPath != null) {
            return appFilesPath + File.separator + "mediattmp";
        }
        return null;
    }

    private void loggerSetMdlInitializeState() {
        int mdlInitializeState = DataLoaderHelper.getDataLoader().getMdlInitializeState();
        if (mdlInitializeState == IVideoEventLogger.MdlInitializeState.InitializeError.ordinal()) {
            this.mLogger.setStringOption(176, DataLoaderHelper.getDataLoader().getMdlInitializeErrorString());
        }
        this.mLogger.setIntOption(175, mdlInitializeState);
    }

    private void mdlFetcherRemove() {
        FetcherMaker.remove(this.mVideoID);
        try {
            FetcherMakerNew.removeListener(this.mMDLFetcherListener);
        } catch (Throwable th) {
            TTVideoEngineLog.i(logcatTag(), "fetcherMakerNew exception " + th);
        }
        this.mMDLFetcherListener = null;
    }

    private void mdlFetcherStore() {
        FetcherMaker.store(this.mVideoID, this.mKeyseed, this.mFallbackAPI, this.mVideoModelVersion);
        if (this.mMDLFetcherListener == null) {
            this.mMDLFetcherListener = new EngineMDLFetcherListener(this.mEngineWrapper);
        }
        try {
            FetcherMakerNew.storeListener(this.mMDLFetcherListener);
        } catch (Throwable th) {
            TTVideoEngineLog.i(logcatTag(), "fetcherMakerNew exception " + th);
        }
    }

    private String produceUserAgentString() {
        String str;
        int i = AppInfo.mAppID;
        String traceID = this.mLogger.getTraceID();
        if (TextUtils.isEmpty(traceID)) {
            traceID = "null";
        }
        String str2 = VideoEventBase.appSessionId;
        if (TextUtils.isEmpty(this.mTag)) {
            str = "default";
        } else {
            str = this.mTag;
        }
        return String.format("appId:%d,os:Android,traceId:%s,appSessionId:%s,tag:%s", Integer.valueOf(i), traceID, str2, str);
    }

    private void resetTexture() {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return;
        }
        videoSurface.setIntOption(29, 0);
        this.mTextureSurface.setIntOption(31, 0);
        this.mTextureSurface.setIntOption(30, 0);
        setTextureLayoutMode(this.mLayoutType);
        if (this.mRotation != 0 || this.mIsMirrorVertical || this.mIsMirrorHorizontal) {
            this.mTextureSurface.setIntOption(25, 1);
        }
    }

    private void setSurfaceDimensionsToTextureRender() {
        VideoSurface videoSurface = this.mTextureSurface;
        SurfaceHolder surfaceHolder = this.mSurfaceHolder;
        if (surfaceHolder != null && videoSurface != null) {
            Rect surfaceFrame = surfaceHolder.getSurfaceFrame();
            if (surfaceFrame != null) {
                TTVideoEngineLog.i("TTVideoEngine", "setSurfaceDimensionsToTextureRender vs:" + videoSurface);
            }
            videoSurface.setSurfaceDimensions(surfaceFrame.right - surfaceFrame.left, surfaceFrame.bottom - surfaceFrame.top);
        }
    }

    public void TTVideoEngineImpl___doPrepare$___twin___() {
        this.mIsStartPlayAutomatically = false;
        this.mShouldPlay = false;
        this.mShouldStop = false;
        this.mUserStopped = false;
        this.mAccumulatedErrorCount = 0;
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            iVideoModel.setUpResolution(this.mResolutionMap);
        }
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setLoggerTimes(65);
        }
        _play(false);
        this.mIsPlayComplete = false;
    }

    JSONObject _doGetPlayErrorInfo() {
        String str;
        try {
            if (this.mMediaPlayer != null && this.mMediaPlayer.getIntOption(5000, 0) != 0) {
                JSONObject jSONObject = new JSONObject();
                String stringOption = this.mMediaPlayer.getStringOption(5001);
                if (this.mMediaPlayer.getIntOption(26, 1) == 1) {
                    str = "breakpad crash";
                } else {
                    str = "simple crash";
                }
                jSONObject.put(str, stringOption);
                return jSONObject;
            }
        } catch (Throwable unused) {
        }
        return null;
    }

    void _doHeartBeatThings() {
        _syncPlayInfoToMdl();
        if (getConfigInt(160, this.mDataLoaderEnable) > 0) {
            DataLoaderHelper.getDataLoader().updateCurrentNetStatus();
        }
        this.mLooperThread.postEngineMessageDelay(24, getConfigInt(657, this.mHeartBeatInterval));
    }

    void _doMetrics() {
        int configInt;
        if ((!TTVideoEngine.sColdStartOptimize || this.mIsColdStart != 1) && (configInt = getConfigInt(1218, this.mMetrcisAbility)) > 0) {
            PlayerMetrics playerMetrics = PlayerMetrics.getInstance();
            playerMetrics.setMetricsAbilityOption(configInt);
            playerMetrics.setMetricsIntervalOption(getConfigInt(1219, this.mMetrcisInterVal));
            playerMetrics.startMetric(this.mContext);
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.addFeature("metrics", 1);
            }
        }
    }

    void _doPause() {
        this.mShouldPlay = false;
        this.mLogger.pause();
        _pause();
        this.mPauseStartT = SystemClock.elapsedRealtime();
        if (this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(33, 0);
        }
    }

    void _doRefreshCpu() {
        if ((!TTVideoEngine.sColdStartOptimize || this.mIsColdStart != 1) && getConfigInt(1218, this.mMetrcisAbility) > 0) {
            PlayerMetrics playerMetrics = PlayerMetrics.getInstance();
            playerMetrics.setMetricsAbilityOption(getConfigInt(1218, this.mMetrcisAbility));
            playerMetrics.setMetricsIntervalOption(getConfigInt(1219, this.mMetrcisInterVal));
            if (this.mMediaPlayer != null) {
                playerMetrics.beginCpuRefresh(this.mMediaPlayer.getStringOption(1804));
                playerMetrics.refreshWhenBegin();
            }
        }
    }

    void _doRelease() {
        EngineThreadPool.addExecuteTask(new VideoInfoCollector.myVideoCollectorUnregister(this.mSerial));
        this.mShouldPlay = false;
        _stop(false, 1);
        releaseTextureRenderRef();
        if (this.mMediaPlayer != null) {
            try {
                this.mMediaPlayer.release();
            } catch (Exception unused) {
            } catch (Throwable th) {
                this.mMediaPlayer = null;
                throw th;
            }
            this.mMediaPlayer = null;
            _clearSurface();
        }
        i iVar = this.mABRModule;
        if (iVar != null) {
            iVar.d();
            this.mABRModule = null;
        }
        _doReleaseCommon();
    }

    void _pauseByInterruption() {
        TTVideoEngineLog.i(logcatTag(), "_pause ");
        if (!this.mPrepared) {
            this.mPausedBeforePrepared = true;
            return;
        }
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null) {
            TTVideoEngineLog.i(logcatTag(), "player will pause by interruption");
            mediaPlayer.pause();
            this.mPlaybackState = 2;
        }
    }

    @Override
    public void clearTextureRef() {
        TTVideoEngineLog.i("TTVideoEngine", "clearTextureRef," + this);
        if (getConfigInt(1414, this.mEnableClearTextureRefAsync) == 1 && this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(35);
        } else {
            _doClearTextureRef();
        }
    }

    public void doForceDraw() {
        TTVideoEngineLog.d(logcatTag(), "forceDraw " + this.mTextureSurface);
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(25, 1);
        }
    }

    @Override
    public Surface getSurface() {
        TTVideoEngineLog.i(logcatTag(), "getSurface:" + this.mSurface + ", this:" + this);
        return this.mSurface;
    }

    @Override
    public boolean isMute() {
        boolean z = this.mIsMute;
        if (this.mState == 3 && (this.mShouldPlay || this.mPlaybackState == 2)) {
            if (this.mLooperThread.checkEngineLooperThread(true)) {
                this.mLooperThread.sendEngineMessage(155, -1L);
                this.mLooperThread.mEngineMsgRetValue.setDataPosition(0);
                if (this.mLooperThread.mEngineMsgRetValue.readInt() == 1) {
                    return true;
                }
                return false;
            }
            return _doIsMute();
        }
        return this.mIsMute;
    }

    @Override
    public boolean isplaybackUsedSR() {
        VideoSurface videoSurface = this.mTextureSurface;
        boolean z = false;
        if (videoSurface != null && videoSurface.getIntOption(6) == 1) {
            z = true;
        }
        TTVideoEngineLog.i(logcatTag(), "isplaybackUsedSR ,mPlayBackUsedSR = " + this.mPlayBackUsedSR + ", mTextureSrOpen = " + this.mTextureSrOpen + ", ret = " + z);
        return z;
    }

    public void lambda$saveEvent$5$TTVideoEngineImpl() {
        if (this.mState != 0 && this.mState != 4 && this.mState != 5) {
            _updateLogger();
            this.mLogger.addWatchedDuration(this.mPlayDuration.getPlayedDuration());
            this.mLogger.saveEvent();
        } else {
            TTVideoEngineLog.e(logcatTag(), "invalid state: " + this.mState);
        }
    }

    @Override
    public void notifyCacheEnd() {
        if (this.mVideoEngineInfoListener != null) {
            TTVideoEngineLog.i(logcatTag(), "notify cache end. source id: " + this.mUsingDataLoaderPlayRawKey);
            VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
            videoEngineInfos.setKey("mdlcacheend");
            notifyEngineInfo(videoEngineInfos, true);
        }
    }

    @Override
    public void pause() {
        TTVideoEngineLog.i(logcatTag(), "pause," + this);
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(2);
        } else {
            _doPause();
        }
    }

    @Override
    public void prepare() {
        TTVideoEngineLog.i(logcatTag(), "prepare," + this);
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(22);
        } else {
            _doPrepare();
        }
    }

    @Override
    public void resetByPoolSyncPart() {
        TTVideoEngineLog.i(logcatTag(), "resetByPoolSyncPart,this:" + this);
        setSurfaceSync(null);
        setSurfaceHolderSync(null);
        releaseTextureRenderRef();
    }

    @Override
    public void start() {
        TTVideoEngineLog.i(logcatTag(), "start");
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEnginePlay(this.mEngineWrapper);
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(23);
        } else {
            _doStart();
        }
    }

    @Override
    public boolean supportByteVC1Playback() {
        if (this.mLooperThread.checkEngineLooperThread(true)) {
            this.mLooperThread.sendEngineMessage(156, -1L);
            this.mLooperThread.mEngineMsgRetValue.setDataPosition(0);
            if (this.mLooperThread.mEngineMsgRetValue.readInt() == 1) {
                return true;
            }
            return false;
        }
        return _doSupportByteVC1Playback();
    }

    @Override
    public boolean supportByteVC2Playback() {
        if (this.mLooperThread.checkEngineLooperThread(true)) {
            this.mLooperThread.sendEngineMessage(157, -1L);
            this.mLooperThread.mEngineMsgRetValue.setDataPosition(0);
            if (this.mLooperThread.mEngineMsgRetValue.readInt() == 1) {
                return true;
            }
            return false;
        }
        return _doSupportByteVC2Playback();
    }

    private void _fetchSubInfo() {
        String _getSubApiString = _getSubApiString();
        if (getConfigInt(400, this.mIsUseBoe ? 1 : 0) == 1) {
            _getSubApiString = TTHelper.buildBoeUrl(_getSubApiString);
        }
        String BuildHttpsApi = TTVideoEngineUtils.BuildHttpsApi(_getSubApiString);
        TTVideoEngineLog.i(logcatTag(), "start to fetch sub info:" + BuildHttpsApi);
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setSubtitleRequestUrl(BuildHttpsApi);
        }
        SubInfoFetcher subInfoFetcher = new SubInfoFetcher(this.mContext, getNetClientSetByUser());
        this.mSubFetcher = subInfoFetcher;
        subInfoFetcher.setListener(new MySubFetcherListener(this));
        this.mSubFetcher.fetchInfo(BuildHttpsApi);
    }

    private void _logFirstFrame() {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (!this.mHasFirstFrameShown) {
            _updateLogTime();
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.showedFirstFrame();
            }
            this.mHasFirstFrameShown = true;
        } else if (mediaPlayer != null) {
            this.mVideoCodecID = mediaPlayer.getIntOption(141, -1);
            this.mAudioCodecProfile = mediaPlayer.getIntOption(402, -1);
            this.mVideoCodecProfile = mediaPlayer.getIntOption(403, -1);
        }
        if (mediaPlayer != null) {
            this.mVideoCodecType = mediaPlayer.getIntOption(157, -1);
            this.mAudioCodecType = mediaPlayer.getIntOption(158, -1);
            this.mAudioCodecID = mediaPlayer.getIntOption(140, -1);
            this.mBitrate = mediaPlayer.getLongOption(171, -1L);
            this.mContainerFPS = mediaPlayer.getFloatOption(151, 0.0f);
        }
    }

    private void _sendMdlCacheMsg() {
        ArrayList arrayList;
        VideoInfo videoInfo;
        if (getConfigInt(160, this.mDataLoaderEnable) > 0) {
            ArrayList arrayList2 = new ArrayList(this.mUsingDataLoaderPlayFilePaths);
            this.mVideoPreloadSize = 0L;
            if (this.mBashDashDefaultMDLKeys.size() == 2) {
                arrayList = new ArrayList(this.mBashDashDefaultMDLKeys.values());
            } else if (!this.mIsLocal && !this.mIsPlayItem && !this.mIsPreloaderItem && !this.mIsDirectURL && (videoInfo = this.currentVideoInfo) != null && !TextUtils.isEmpty(videoInfo.getValueStr(15))) {
                arrayList = new ArrayList();
                arrayList.add(this.currentVideoInfo.getValueStr(15));
            } else {
                arrayList = new ArrayList(this.mUsingDataLoaderPlayTaskKeys);
            }
            EngineThreadPool.addExecuteTask(new MDLCacheSizeRunnable(this, arrayList, arrayList2));
        }
    }

    private void _syncPlayInfoToMdl() {
        long max;
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null) {
            if (isPcdnNeedPlayInfo() || DataLoaderHelper.getDataLoader().isNeedPlayInfo()) {
                if (!this.mIsPlayComplete && !this.mErrorEnd) {
                    long longOption = mediaPlayer.getLongOption(73, -1L);
                    long longOption2 = mediaPlayer.getLongOption(72, -1L);
                    int intOption = mediaPlayer.getIntOption(62, 0);
                    int intOption2 = mediaPlayer.getIntOption(61, 0);
                    if (intOption == 1 && intOption2 == 1) {
                        max = Math.max(0L, Math.min(longOption, longOption2));
                    } else if (intOption2 == 1) {
                        max = Math.max(0L, longOption);
                    } else if (intOption == 1) {
                        max = Math.max(0L, longOption2);
                    } else {
                        return;
                    }
                    setPlayInfo(5, max);
                    return;
                }
                TTVideoEngineLog.d(logcatTag(), "_syncPlayInfoToMdl complete");
            }
        }
    }

    private boolean _validateVideo() {
        if (this.mPlayAPIVersion >= 2) {
            return true;
        }
        try {
            String videoRefStr = this.mVideoModel.getVideoRefStr(IVideoLayerCommand.VIDEO_HOST_CMD_NOFITY_FULLSCREEN);
            boolean z = false;
            if (!TextUtils.isEmpty(videoRefStr) && !"0".equals(videoRefStr) && !isOSPlayer()) {
                z = !this.mVideoID.equals(_getCommentInfo().get("vid"));
            }
            if (z) {
                this.mLogger.validateVideoMetaInfoFail(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9991, "header meta validate failed"));
            }
        } catch (NullPointerException unused) {
            TTVideoEngineLog.e(logcatTag(), "fetcher video model null");
        }
        return true;
    }

    private void createDefaultCacheFileDirectory() {
        if (mCreatCacheFileLock.tryLock()) {
            if (!mIsFirstOpenEngine) {
                mCreatCacheFileLock.unlock();
                return;
            }
            mIsFirstOpenEngine = false;
            String defaultCacheFileDirPath = getDefaultCacheFileDirPath();
            File file = new File(defaultCacheFileDirPath);
            if (file.exists()) {
                if (file.list() != null) {
                    File file2 = new File(defaultCacheFileDirPath + "tem");
                    file.renameTo(file2);
                    file.mkdirs();
                    EngineThreadPool.addExecuteTask(new RecursionDeleteFileRunnable(file2));
                }
            } else {
                file.mkdirs();
            }
            EngineThreadPool.addExecuteTask(new DeleteBeforeDirFileRunnable(this.mContext.getApplicationContext()));
            mCreatCacheFileLock.unlock();
        }
    }

    private void releaseTextureRenderRef() {
        if (this.mTextureRenderer == null) {
            return;
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            TTVideoEngineLog.i(logcatTag(), "release video surface : " + videoSurface);
            doOpenSR(0, -7880);
            videoSurface.release();
            this.mTextureSurface = null;
        }
        this.mTextureRenderer = null;
        this.mRenderHDR2SDR = 0;
        this.mEngineConfig.remove(652);
        this.mSyncUpdateSurface = 0;
        this.mTextureRenderError = 0;
        TTVideoEngineLog.i(logcatTag(), "mTextureRenderer become to null");
    }

    private void setSpeedTest() {
        if (this.mHaveSetSpeedTest) {
            return;
        }
        this.mTTSpeedListener = new TTTestSpeedListener(this.mEngineWrapper, StrategyCenter.sNetSpeedPredictor, StrategyCenter.sNetAbrSpeedPredictor);
        DataLoaderHelper.getDataLoader().setTestSpeedListener(this.mTTSpeedListener);
        this.mHaveSetSpeedTest = true;
        this.mLogger.setIntOption(17, TTVideoEngine.sTestSpeedSampleInterval);
        this.mLogger.setIntOption(18, TTVideoEngine.sIsReportTestSpeedInfo);
        this.mLogger.setIntOption(19, TTVideoEngine.sReportSpeedInfoMaxWindowSize);
        this.mLogger.setSpeedPredictorAlgoType(TTVideoEngine.sNetSpeedAbrPredictType);
    }

    public void TTVideoEngineImpl___doPlay$___twin___() {
        _initUsingHandle();
        boolean z = true;
        this.mShouldPlay = true;
        this.mShouldStop = false;
        this.mUserStopped = false;
        this.mAccumulatedErrorCount = 0;
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            iVideoModel.setUpResolution(this.mResolutionMap);
        }
        if (this.mHasComplete) {
            this.mLogger.setIntOption(14, 1);
            this.mHasComplete = false;
        }
        EngineInstanceHolder.getInstance().add(this.mEngineWrapper);
        if (!this.mIsStartPlayAutomatically && this.mPlayTime <= 0 && !this.mPrepared) {
            z = false;
        }
        _play(z);
        this.mIsPlayComplete = false;
    }

    public void TTVideoEngineImpl___doReleaseAsync$___twin___() {
        if (!isInHousePlayer()) {
            release();
            return;
        }
        EngineThreadPool.addExecuteTask(new VideoInfoCollector.myVideoCollectorUnregister(this.mSerial));
        this.mShouldPlay = false;
        _stop(false, 2);
        if (this.mMediaPlayer != null) {
            if (getConfigInt(951, this.mSurfaceHolderByKernel) != 0) {
                if (this.mSurfaceHolder != null) {
                    this.mMediaPlayer.setDisplay(null);
                }
                if (this.mSurface != null) {
                    setSurfaceHook(null);
                }
            } else if (this.mSurfaceHolder != null || this.mSurface != null) {
                setSurfaceHook(null);
            }
            releaseTextureRenderRef();
        }
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer != null) {
            mediaPlayer.release();
            this.mAsyncPlayer = null;
        }
        MediaPlayer mediaPlayer2 = this.mMediaPlayer;
        i iVar = this.mABRModule;
        this.mMediaPlayer = null;
        this.mABRModule = null;
        if (mediaPlayer2 != null) {
            EngineThreadPool.addExecuteTask(new MyReleaseRunnable(this, mediaPlayer2, iVar));
        }
        _doReleaseCommon();
    }

    public MediaPlayer TTVideoEngineImpl__createMediaPlayer$___twin___() {
        updateConfigParams(this.mConfigParams);
        MediaPlayer create = MediaPlayerWrapper.create(this.mContext, this.mPlayerDegradeMode, this.mConfigParams);
        if (create == null) {
            return null;
        }
        MediaPlayerWrapper mediaPlayerWrapper = (MediaPlayerWrapper) create;
        if (mediaPlayerWrapper.hasException() && this.mLogger != null) {
            this.mLogger.logPluginException(mediaPlayerWrapper.getExceptionStr() + ",customState:" + this.mClassLoaderState);
        }
        if (mediaPlayerWrapper.getPlayerClient() == null) {
            return null;
        }
        _setupMediaCodec(create);
        _tryRegisterMdlHandle(create);
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setPlayerCreatedT(System.currentTimeMillis());
        }
        this.mPlayerConfigExecutor.setMediaPlayer(create);
        TTVideoEngineLog.i(logcatTag(), "_playInternal MediaPlayerWrapper.create done videoId = " + this.mVideoID);
        return create;
    }

    void _doReleaseCommon() {
        TTVideoEngineMonitor tTVideoEngineMonitor = this.mEngineStateMonitor;
        if (tTVideoEngineMonitor != null) {
            tTVideoEngineMonitor.stopObserve(hashCode());
        }
        EngineInstanceHolder.getInstance().remove(this.mEngineWrapper);
        NetUtils.release(this.mContext);
        mdlFetcherRemove();
        if (this.mPlayDuration != null) {
            this.mPlayDuration.release();
        }
        this.mTraitObjManager.removeAll();
        this.mAudioProcessor = null;
        this.mPreloaderItem = null;
        this.mIsPreloaderItem = false;
        this.mFileKey = null;
        this.mMaskInfoInterface = null;
        this.mAIBarrageInfoInterface = null;
        this.mSubInfoInterface = null;
        this.mSubPathInfo = null;
        this.mHasSetAESrcPeak = false;
        this.mHasSetAESrcLoudness = false;
        this.mHasSetAEVolumeInfo = false;
        this.mSRNotUseReason = 0;
        this.mDisplayMode = null;
        _dataLoaderRemoveEngineRef();
        IntertrustDrmHelper intertrustDrmHelper = this.mIntertrustDrmHelper;
        if (intertrustDrmHelper != null) {
            intertrustDrmHelper.release();
            this.mIntertrustDrmHelper = null;
        }
        this.mState = 5;
        this.mLooperThread.closeEngineLooperThread();
    }

    void _doResetByPool() {
        TTVideoEngineLog.i(logcatTag(), "_doResetByPool, Engine:" + this.mEngineWrapper);
        _ShutdownOldSource();
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setIntOption(1302, 0);
        }
        TTVideoEngineLog.i(logcatTag(), "templog:resetWhenReuse");
        resetAllOptions();
        TTVideoEngineMonitor tTVideoEngineMonitor = this.mEngineStateMonitor;
        if (tTVideoEngineMonitor != null) {
            tTVideoEngineMonitor.stopObserve(hashCode());
        }
        TTVideoEnginePool.getInstance().resetFinish(this.mEngineWrapper);
    }

    @Override
    public MediaTrackInfoModel[] getMediaTrackInfos() {
        if (this.mMediaPlayer != null) {
            String stringOption = this.mMediaPlayer.getStringOption(473);
            if (!TextUtils.isEmpty(stringOption)) {
                MediaTrackInfoModel[] mediaTrackInfoModelArr = null;
                ArrayList arrayList = new ArrayList();
                try {
                    try {
                        JSONArray jSONArray = new JSONArray(stringOption);
                        for (int i = 0; i < jSONArray.length(); i++) {
                            JSONObject optJSONObject = jSONArray.optJSONObject(i);
                            JSONObject jSONObject = new JSONObject(optJSONObject.getString("media_track_info"));
                            jSONObject.put("index", optJSONObject.getInt("index"));
                            jSONObject.put("type", Integer.parseInt(jSONObject.getString("type")));
                            arrayList.add(new MediaTrackInfoModel(jSONObject));
                        }
                        mediaTrackInfoModelArr = new MediaTrackInfoModel[arrayList.size()];
                        arrayList.toArray(mediaTrackInfoModelArr);
                        return mediaTrackInfoModelArr;
                    } catch (JSONException e) {
                        e.printStackTrace();
                        return mediaTrackInfoModelArr;
                    }
                } catch (Throwable unused) {
                    return mediaTrackInfoModelArr;
                }
            }
        }
        return new MediaTrackInfoModel[0];
    }

    @Override
    public JSONObject getPlayErrorInfo() {
        if (this.mLooperThread.checkEngineLooperThread(true)) {
            this.mLooperThread.sendEngineMessage(154, -1L);
            this.mLooperThread.mEngineMsgRetValue.setDataPosition(0);
            String str = (String) this.mLooperThread.mEngineMsgRetValue.readValue(getClass().getClassLoader());
            if (!TextUtils.isEmpty(str)) {
                try {
                    return new JSONObject(str);
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
            return null;
        }
        return _doGetPlayErrorInfo();
    }

    @Override
    public void play() {
        TTVideoEngineLog.i(logcatTag(), "play:" + this);
        if (this.mState == 5) {
            TTVideoEngineLog.e(logcatTag(), "already released, return");
            return;
        }
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEnginePlay(this.mEngineWrapper);
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(1);
        } else {
            _doPlay();
        }
    }

    @Override
    public void release() {
        TTVideoEngineLog.i(logcatTag(), "release," + this);
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEngineStop(this.mEngineWrapper);
        }
        this.mShouldStop = true;
        this.mPrepared = false;
        this.mReleased = true;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(4);
        } else {
            _doRelease();
        }
    }

    @Override
    public void releaseAsync() {
        PlayerMetrics.getInstance().refreshWhenEnd();
        TTVideoEngineLog.i(logcatTag(), "releaseAsync," + this);
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEngineStop(this.mEngineWrapper);
        }
        this.mShouldStop = true;
        this.mPrepared = false;
        this.mReleased = true;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(5);
        } else {
            _doReleaseAsync();
        }
    }

    @Override
    public void resetByPool() {
        TTVideoEngineLog.i(logcatTag(), "resetByPool,  Engine:" + this.mEngineWrapper);
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEngineStop(this.mEngineWrapper);
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(33);
        } else {
            _doResetByPool();
        }
    }

    @Override
    public void stop() {
        TTVideoEngineLog.i(logcatTag(), "stop:" + this);
        Iterator<VideoEngineStateListener> it2 = TTVideoEngine.sEngineStateListeners.iterator();
        while (it2.hasNext()) {
            it2.next().onEngineStop(this.mEngineWrapper);
        }
        this.mShouldPlay = false;
        this.mIsFetchingInfo = false;
        this.mTextureFirstFrame = false;
        this.mTexNotifyFirstFrame = false;
        this.mShouldStop = true;
        this.mRenderHDR2SDR = 0;
        this.mEngineConfig.remove(652);
        this.mSyncUpdateSurface = 0;
        this.mLoopStartTime = 0;
        this.mEngineConfig.remove(24);
        this.mLoopEndTime = 0;
        this.mEngineConfig.remove(25);
        this.mIsPrepareDecodeOnly = false;
        this.mEngineConfig.remove(984);
        this.mOSPlayerIgnoreHeaders = false;
        this.mEngineConfig.remove(4022);
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(3);
        } else {
            _doStop();
        }
    }

    public static class MDLCacheSizeRunnable implements Runnable {
        private WeakReference<TTVideoEngineImpl> mVideoEngineRef;
        private ArrayList<String> temFilePaths;
        private ArrayList<String> temKeys;

        @Override
        public void run() {
            int i;
            int i2;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mState != 5) {
                String str = tTVideoEngineImpl.mVideoID;
                String str2 = tTVideoEngineImpl.mMDLGroupId;
                ArrayList<String> arrayList = this.temFilePaths;
                if (arrayList != null && arrayList.size() > 0) {
                    for (int i3 = 0; i3 < this.temFilePaths.size(); i3++) {
                        String str3 = this.temFilePaths.get(i3);
                        long cacheFileSizeByFilePath = TTVideoEngine.getCacheFileSizeByFilePath(str3);
                        if (cacheFileSizeByFilePath == 0) {
                            i2 = (int) TTVideoEngine.getMissReason(0, str3, str, str2);
                        } else {
                            i2 = 0;
                        }
                        if (tTVideoEngineImpl.mHandler != null) {
                            tTVideoEngineImpl.mHandler.sendMessage(Message.obtain(tTVideoEngineImpl.mHandler, 10, (int) cacheFileSizeByFilePath, i2, str3));
                        }
                    }
                    return;
                }
                ArrayList<String> arrayList2 = this.temKeys;
                if (arrayList2 != null && arrayList2.size() > 0) {
                    for (int i4 = 0; i4 < this.temKeys.size(); i4++) {
                        String str4 = this.temKeys.get(i4);
                        long cacheFileSize = TTVideoEngine.getCacheFileSize(str4);
                        if (cacheFileSize == 0) {
                            i = (int) TTVideoEngine.getMissReason(1, str4, str, str2);
                        } else {
                            i = 0;
                        }
                        if (tTVideoEngineImpl.mHandler != null) {
                            tTVideoEngineImpl.mHandler.sendMessage(Message.obtain(tTVideoEngineImpl.mHandler, 10, (int) cacheFileSize, i, str4));
                        }
                    }
                }
            }
        }

        public MDLCacheSizeRunnable(TTVideoEngineImpl tTVideoEngineImpl, ArrayList<String> arrayList, ArrayList<String> arrayList2) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
            this.temKeys = arrayList;
            this.temFilePaths = arrayList2;
        }
    }

    private void _ShutdownOldSource() {
        this.mIsLocal = false;
        this.mIsDirectURL = false;
        this.mIsPreloaderItem = false;
        this.mIsPlayItem = false;
        this.mIsFeedInfo = false;
        if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 0) {
            this.mMediaPlayer.release();
            this.mMediaPlayer = null;
        }
        _reset();
        _resetUrlIndexMap();
        this.mTraitObjManager.removeAll();
        this.mMediaDataSource = null;
        mdlFetcherRemove();
        this.mState = 0;
        this.currentVideoInfo = null;
        this.mDynamicAudioInfo = null;
        this.mDynamicVideoInfo = null;
        this.mVideoModel = null;
        this.mDirectURL = null;
        this.mLocalURL = null;
        this.mVideoID = null;
        this.mPlayFd = null;
        this.mDirectURL = null;
        this.mTextureFirstFrame = false;
        this.mTexNotifyFirstFrame = false;
        this.mHasFirstFrameShown = false;
        this.mHasFetchedSubtitle = false;
        this.mHasAudioFirstFrameShown = false;
        this.mPlayDuration.reset();
        this.mIsPlayComplete = false;
        this.mDecodedVideoFirstFrame = false;
        this.mPlayStartTimestamp = 0L;
        this.mHasComplete = false;
        this.mPlayTime = 0L;
        this.mRetryingNotHandleError = false;
        this.dashAudioUrlMap.clear();
        this.mCurPosition = -1;
        this.mVideoCodecType = -1;
        this.mAudioCodecType = -1;
        this.mVideoCodecID = -1;
        this.mAudioCodecID = -1;
        this.mAudioCodecProfile = -1;
        this.mVideoCodecProfile = -1;
        this.mBitrate = -1L;
        this.mContainerFPS = 0.0f;
        this.mAudioProcessor = null;
        this.mHasSetAESrcPeak = false;
        this.mHasSetAESrcLoudness = false;
        this.mHasSetAEVolumeInfo = false;
        this.mSubDesInfoModel = null;
        this.mSeeking = false;
        this.mPrecisePausePts = 0L;
        this.mEngineConfig.remove(709);
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setLoggerTimes(63);
        }
        this.mFileHashs.clear();
        this.urlIPMap.clear();
        this.mMDLGroupId = null;
    }

    private void _audioRenderStart() {
        PlayerEventSimpleListener playerEventSimpleListener;
        TTVideoEngineLog.i(logcatTag(), "_audioRenderStart,this:" + this);
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer == null) {
            return;
        }
        if (getConfigInt(664, this.mEnableDebugUINotify) != 0 && (playerEventSimpleListener = this.mPlayerEventListener) != null) {
            playerEventSimpleListener.onAudioRenderOpened(mediaPlayer.getIntOption(48, -1), mediaPlayer.getLongOption(156, -1L), mediaPlayer.getLongOption(163, -1L));
        }
        if (!this.mHasAudioFirstFrameShown) {
            this.mHasAudioFirstFrameShown = true;
            this.mLogger.setLongOption(77, mediaPlayer.getLongOption(628, -1L));
            if (this.mSurface == null && this.mSurfaceHolder == null && this.mRadioModeEnable == 0 && mediaPlayer.getIntOption(62, -100) != 0) {
                this.mLogger.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_USE_PLAYER_SPADE, 1);
            }
        }
        if (this.mHasFirstFrameShown && !this.mSeamSwitchingResolution) {
            return;
        }
        if (mediaPlayer.getIntOption(62, -100) == 0 || this.mRadioModeEnable != 0 || this.mShouldUseAudioRenderStart || (getConfigInt(707, this.mSupportPlayWhenNoSurface) == 1 && this.mSurface == null && this.mSurfaceHolder == null)) {
            _renderStart();
        }
    }

    private void _configWithAppSettings() {
        if (!this.mSettedKeys.contains(11) && !this.mEngineConfig.isKeySet(11)) {
            this.mBufferTimeout = InfoWrapper.getBufferTimeOut();
            this.mEngineConfig.setIntOption(11, InfoWrapper.getBufferTimeOut());
            TTVideoEngineLog.d(logcatTag(), "==========mBufferTimeout:" + getConfigInt(11, this.mBufferTimeout));
        }
        int byteVC1SoftwareCapabilityEnable = InfoWrapper.getByteVC1SoftwareCapabilityEnable();
        int i = 1;
        if (!this.mSettedKeys.contains(7)) {
            this.mHardwareDecodeEnablePlayer2 = InfoWrapper.getHardwareEnable();
            if (byteVC1SoftwareCapabilityEnable == 0 && !this.mCodecStrategyAdapter.isCodecStrategyValid() && this.mErrorCount <= 0) {
                this.mHardwareDecodeEnablePlayer2 = 1;
            }
            TTVideoEngineLog.d(logcatTag(), "==========mHardwareDecodeEnablePlayer2:" + this.mHardwareDecodeEnablePlayer2);
        }
        if (byteVC1SoftwareCapabilityEnable != 0) {
            i = 0;
        }
        this.mForbidByteVC1SoftwareDecode = i;
    }

    private HashMap<String, Integer> _getMdlErrorInfo() {
        String playLog;
        JSONObject jSONObject = null;
        if (getConfigInt(160, this.mDataLoaderEnable) == 0) {
            return null;
        }
        HashMap<String, Integer> hashMap = new HashMap<>();
        synchronized (this) {
            playLog = DataLoaderHelper.getDataLoader().getPlayLog(this.mTraceId);
        }
        TTVideoEngineLog.d(logcatTag(), "get mdl info: " + playLog);
        if (playLog != null && !TextUtils.isEmpty(playLog)) {
            try {
                jSONObject = new JSONObject(playLog);
            } catch (JSONException e) {
                TTVideoEngineLog.e(logcatTag(), e.toString());
            }
        }
        if (jSONObject != null) {
            try {
                if (!jSONObject.isNull("err_code")) {
                    hashMap.put("mdl_err_code", Integer.valueOf(((Number) jSONObject.get("err_code")).intValue()));
                }
                if (!jSONObject.isNull("sub_err_code")) {
                    hashMap.put("mdl_sub_err_code", Integer.valueOf(((Number) jSONObject.get("sub_err_code")).intValue()));
                }
            } catch (Exception e2) {
                TTVideoEngineLog.d(e2);
            }
        }
        return hashMap;
    }

    private String _getSubApiString() {
        if (this.mVideoModel != null && this.currentVideoInfo != null) {
            StringBuilder sb = new StringBuilder();
            String valueStr = this.currentVideoInfo.getValueStr(28);
            if (valueStr == null) {
                valueStr = "";
            }
            String configString = getConfigString(531, this.mSubHostName);
            String configString2 = getConfigString(546, this.mSubIds);
            String configString3 = getConfigString(547, this.mSubFormat);
            if (!TextUtils.isEmpty(configString)) {
                if (!configString.startsWith("http://") && !configString.startsWith("https://")) {
                    sb.append(String.format("https://%s/video/subtitle/v1/%s/%s?", configString, this.mVideoID, valueStr));
                } else {
                    sb.append(String.format("%s/video/subtitle/v1/%s/%s?", configString, this.mVideoID, valueStr));
                }
                if (!TextUtils.isEmpty(configString2)) {
                    sb.append(String.format("sub_ids=%s&language_ids=%s&versions=%s", configString2, this.mSubLanIds, this.mSubVersions));
                }
                if (!TextUtils.isEmpty(configString3)) {
                    if (!TextUtils.isEmpty(configString2)) {
                        sb.append("&");
                    }
                    sb.append(String.format("format=%s", configString3));
                }
            }
            return sb.toString();
        }
        return null;
    }

    private boolean _initIntertrustDrm() {
        IntertrustDrmHelper intertrustDrmHelper = this.mIntertrustDrmHelper;
        if (intertrustDrmHelper != null) {
            intertrustDrmHelper.stop();
        } else {
            this.mIntertrustDrmHelper = new IntertrustDrmHelper();
        }
        int init = this.mIntertrustDrmHelper.init(this.mContext, getConfigInt(38, this.mDrmCloseRootCheck));
        if (init != 0) {
            if (init == -1000) {
                receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9939));
                return false;
            }
            if (init == -1) {
                receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9938));
                return false;
            }
            if (init == -1002) {
                receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9933));
                return false;
            }
            receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9938, init));
            return false;
        }
        if (this.mIntertrustDrmHelper.start() == -1) {
            receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9938));
            return false;
        }
        this.mIntertrustDrmHelper.setListener(new MyDrmTokenProcessedListener(this));
        if (!TextUtils.isEmpty(this.mTokenUrlTemplate)) {
            this.mIntertrustDrmHelper.setTokenUrlTemplate(this.mTokenUrlTemplate);
            return true;
        }
        return true;
    }

    private void _prepareToPlay() {
        String str;
        String str2;
        boolean z;
        if (this.mPlayDuration != null) {
            this.mPlayDuration.clear();
        }
        this.mLogger.setTag(this.mTag);
        this.mLogger.setSubTag(this.mSubTag);
        if (this.mPlayStartTimestamp == 0) {
            this.mPlayStartTimestamp = System.currentTimeMillis();
        }
        if (!this.mIsLocal && !this.mIsDirectURL && this.mPlayFd == null && this.mMediaDataSource == null) {
            if (this.mIsPreloaderItem) {
                long currentTimeMillis = System.currentTimeMillis() / 1000;
                if (this.mPreloaderItem.mUrlTime > 0 && currentTimeMillis - this.mPreloaderItem.mUrlTime > 2400) {
                    z = true;
                } else {
                    z = false;
                }
                if (z) {
                    _fetchVideoInfo();
                }
                _logFirstURL(this.mPreloaderItem.mUrl);
                _logBeginToPlay(this.mPreloaderItem.mVideoID);
                _singleURLParseAndPlay(this.mPreloaderItem.mUrl, this.mHeaders);
            } else if (this.mIsPlayItem) {
                _logBeginToPlay(this.mVideoID);
                _logFirstURL(this.mPlayItem.playURL);
                _singleURLParseAndPlay(this.mPlayItem.playURL, this.mHeaders);
            } else if (this.mIsFeedInfo) {
                _logBeginToPlay(this.mVideoID);
                _parseIPAddress(this.mVideoModel);
            } else {
                _logBeginToPlay(this.mVideoID);
                _fetchVideoInfo();
            }
        } else {
            _logBeginToPlay(this.mVideoID);
            if (this.mIsLocal) {
                str = this.mLocalURL;
            } else {
                str = this.mDirectURL;
            }
            _logFirstURL(str);
            if (this.mIsLocal) {
                str2 = this.mLocalURL;
            } else {
                str2 = this.mDirectURL;
            }
            _singleURLParseAndPlay(str2, this.mHeaders);
        }
        if (this.mMediaPlayer != null && isPcdnNeedPlayInfo()) {
            setPlayInfo(5, 0L);
        }
    }

    private void _reset() {
        TTVideoEngineLog.i(logcatTag(), "reset, this:" + this);
        this.mShouldPlay = false;
        this.mPrepared = false;
        this.mIsFetchingInfo = false;
        this.mABRUsed = false;
        TTTestSpeedListener tTTestSpeedListener = this.mTTSpeedListener;
        if (tTTestSpeedListener != null) {
            tTTestSpeedListener.mAverageDownloadSpeed = 0.0f;
            this.mTTSpeedListener.mAveragePredictSpeed = 0.0f;
            this.mTTSpeedListener.mSpeedAverageCount = 0;
        }
        this.mHeaders.clear();
        _stop(true, 6);
        if (this.mMediaPlayer != null) {
            if (this.mHardwareDecodeEnablePlayer2 == 1 && getConfigInt(977, this.mCodecAndSurfaceReuse) == -1) {
                setSurfaceHook(null);
            }
            if (this.mTextureSrOpen == 1 && this.mPlayBackUsedSR && this.mTextureSurface != null) {
                TTVideoEngineLog.i(logcatTag(), "disable sr while _ShutdownOldSource = " + this.mTextureSrOpen);
                doOpenSR(0, -7880);
            }
            this.mTRSrategy.reset(this.mTextureSurface, this.mHasFirstFrameShown);
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                videoSurface.pause(false);
            }
            this.mMediaPlayer.reset();
            _clearSurface();
        }
        this.mPlayerFirstFrame = false;
        this.mHasFirstFrameShown = false;
        this.mHasFetchedSubtitle = false;
        this.mHasAudioFirstFrameShown = false;
        this.mHttpsEnabled = false;
        this.mRetryEnableHttps = false;
        this.mKeyseed = null;
        this.mFallbackAPI = null;
        this.mHijackRetryCount = 0;
        this.mRetrying = false;
        this.mLogger.reset();
        this.mFirstResolution = true;
        this.mFirstGetWidthHeight = true;
        this.mSeamSwitchingResolution = false;
        this.mFrameCount = 0;
        this.mPlayStartTime = -1L;
        this.mRenderStartTime = -1L;
        this.mStartupSwitchCSModel = -1;
        this.mStartupModel = -1;
        this.mStartUpBitrate = -1L;
        this.mCheckInfoString = null;
        i iVar = this.mABRModule;
        if (iVar != null) {
            iVar.d();
            this.mABRModule = null;
        }
        this.mForceCodec = null;
        this.mShouldUseAudioRenderStart = false;
        this.mAudioInfoId = -1;
        this.mEngineConfig.remove(675);
        this.mLastSwitchRadioModeTime = 0L;
        this.mLastSwitchResolutionTime = 0L;
        this.mTextureRenderError = 0;
        this.mLastSetSurfaceNullTime = 0L;
        this.mMaskFileSize = 0L;
        this.effectTypeSet = new CopyOnWriteArraySet();
    }

    private void _resumeVideo() {
        IVideoModel iVideoModel;
        TTVideoEngineLog.i(logcatTag(), "resumed video, shouldplay:" + this.mShouldPlay + ", mediaplayer:" + this.mMediaPlayer + ", prepared:" + this.mPrepared);
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null && this.mShouldPlay) {
            mediaPlayer.setScreenOnWhilePlaying(true);
            if (this.mPrepared) {
                if (this.mPlaybackState == 0 || this.mIsPlayComplete) {
                    fetchedVideoInfo(this.mVideoModel);
                    if (!TextUtils.isEmpty(this.mVideoID) && !this.mIsFeedInfo && (iVideoModel = this.mVideoModel) != null) {
                        notifyFetchedVideoInfo(iVideoModel);
                    }
                }
                mediaPlayer.setIntOption(100, this.mStartTime);
                mediaPlayer.start();
                _dumpSurface("_renderVideo");
                _updateTextureState(1);
                if (this.mHasFirstFrameShown) {
                    if (this.mPlayDuration != null) {
                        this.mPlayDuration.start();
                    }
                    updatePlaybackState(1);
                }
                if (this.mABRModule != null && this.mEnableABR > 0 && isSupportSeamlessSwitch(this.mVideoModel)) {
                    this.mABRModule.c(TTVideoEngine.sABRAlgorithmType, getConfigInt(500, this.mABRTimerIntervalMilliseconds));
                    this.mLogger.setIsEnableABR(1);
                }
                if (shouldStartTextureRenderCheck()) {
                    this.mTextureSurface.setIntOption(33, 1);
                    return;
                }
                return;
            }
            this.mPausedBeforePrepared = false;
        }
    }

    private void _sendUrlInfoMsg() {
        String str;
        boolean z;
        ArrayList arrayList = new ArrayList();
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            str = iVideoModel.getDynamicType();
        } else {
            str = "";
        }
        VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(17) == 1) {
                z = true;
            } else {
                z = false;
            }
        } else {
            z = this.mDashEnabled;
        }
        if (z && !TextUtils.isEmpty(str) && str.equals("segment_base")) {
            VideoInfo _videoInfoForResolution = _videoInfoForResolution(this.currentResolution, VideoRef.TYPE_VIDEO, this.currentParams);
            VideoInfo _videoInfoForResolution2 = _videoInfoForResolution(this.currentResolution, VideoRef.TYPE_AUDIO, this.currentParams);
            if (_videoInfoForResolution != null) {
                arrayList.add(_videoInfoForResolution);
                String valueStr = _videoInfoForResolution.getValueStr(15);
                if (valueStr != null) {
                    this.mBashDashDefaultMDLKeys.put(UGCMonitor.TYPE_VIDEO, valueStr);
                }
                this.mDynamicVideoInfo = _videoInfoForResolution;
            }
            if (_videoInfoForResolution2 != null) {
                arrayList.add(_videoInfoForResolution2);
                String valueStr2 = _videoInfoForResolution2.getValueStr(15);
                if (valueStr2 != null) {
                    this.mBashDashDefaultMDLKeys.put("audio", valueStr2);
                }
                this.mABRCurrentDownloadedAudioBitrate = _videoInfoForResolution2.getValueInt(3);
                this.mDynamicAudioInfo = _videoInfoForResolution2;
            }
            videoEngineInfos.setKey("usingUrlInfos");
            videoEngineInfos.setUrlInfos(arrayList);
            notifyEngineInfo(videoEngineInfos, true);
            return;
        }
        VideoInfo videoInfo = this.currentVideoInfo;
        if (videoInfo != null) {
            arrayList.add(videoInfo);
            videoEngineInfos.setKey("usingUrlInfos");
            videoEngineInfos.setUrlInfos(arrayList);
            notifyEngineInfo(videoEngineInfos, true);
        }
    }

    private void _updateEffectLog() {
        if (this.mTextureSurface != null) {
            ArrayList arrayList = new ArrayList();
            ArrayList arrayList2 = new ArrayList();
            for (Integer num : this.effectTypeSet) {
                float floatOption = this.mTextureSurface.getFloatOption(124, num.intValue());
                LinkedHashMap linkedHashMap = new LinkedHashMap();
                linkedHashMap.put("type", num);
                linkedHashMap.put("avrtime", Float.valueOf(floatOption));
                arrayList.add(linkedHashMap.toString());
                int intOption = this.mTextureSurface.getIntOption(126, num.intValue());
                if (intOption > 0) {
                    String stringOption = this.mTextureSurface.getStringOption(127, num.intValue());
                    LinkedHashMap linkedHashMap2 = new LinkedHashMap();
                    linkedHashMap2.put("type", num);
                    linkedHashMap2.put("errc", Integer.valueOf(intOption));
                    linkedHashMap2.put("errmsg", stringOption);
                    arrayList2.add(linkedHashMap2.toString());
                }
            }
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.setFloatOption(162, this.mTextureSurface.getFloatOption(120));
                this.mLogger.setStringOption(163, arrayList.toString());
                this.mLogger.setFloatOption(164, this.mTextureSurface.getFloatOption(125));
                if (!arrayList2.isEmpty()) {
                    this.mLogger.setStringOption(165, arrayList2.toString());
                }
                float floatOption2 = this.mTextureSurface.getFloatOption(131);
                float floatOption3 = this.mTextureSurface.getFloatOption(132);
                this.mLogger.setFloatOption(167, floatOption2);
                this.mLogger.setFloatOption(166, floatOption3);
            }
        }
    }

    private void _updateVU() {
        ArrayList arrayList = new ArrayList();
        for (Map.Entry<String, IpInfo> entry : this.urlIPMap.entrySet()) {
            String key = entry.getKey();
            IpInfo value = entry.getValue();
            if (key != null && value != null) {
                HashMap hashMap = new HashMap();
                hashMap.put("url", key);
                hashMap.put("ip", value.ip);
                hashMap.put("dns", value.dns);
                hashMap.put("dns_cache_open", Integer.valueOf(value.isDNSCacheOpen));
                hashMap.put("server_dns_open", Integer.valueOf(value.isServerDNSOpen));
                hashMap.put("url_desc", value.urlDesc);
                if (this.mIsDirectURL && !TextUtils.isEmpty(this.mGroupID)) {
                    hashMap.put("gid", this.mGroupID);
                }
                arrayList.add(hashMap);
            }
        }
        if (!this.mIsDirectURL) {
            this.mLogger.setVUArray(arrayList);
        }
    }

    private String getMediaFileKey() {
        String str;
        String str2;
        String str3;
        long j;
        if (!this.mIsLocal && !this.mIsPlayItem && !this.mIsPreloaderItem) {
            if (this.mIsDirectURL) {
                return this.mFileKey;
            }
            if (this.mVideoModel == null) {
                return null;
            }
            VideoInfo videoInfo = this.currentVideoInfo;
            if (videoInfo != null) {
                str = videoInfo.getValueStr(26);
                j = this.currentVideoInfo.getValueLong(12);
                str2 = this.currentVideoInfo.getValueStr(5);
                str3 = this.currentVideoInfo.getValueStr(15);
            } else {
                str = null;
                str2 = null;
                str3 = null;
                j = 0;
            }
            if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str2) && !TextUtils.isEmpty(str3) && j != 0) {
                if (!TextUtils.isEmpty(str2)) {
                    return String.format("%s_%s_%s_%d_%s", this.mVideoID, str, str3, Long.valueOf(j), TTHelper.customBase64Encode(str2));
                }
                return String.format("%s_%s_%s_%d", this.mVideoID, str, str3, Long.valueOf(j));
            }
        }
        return null;
    }

    void _doStop() {
        _stop(true, 0);
        int configInt = getConfigInt(991, this.mAutoDisconnectedCpu);
        if (configInt == 1) {
            boolean _checkRefreshSurface = _checkRefreshSurface();
            this.mRefreshSurfaceFlag = _checkRefreshSurface;
            if (_checkRefreshSurface) {
                _refreshSurface();
            } else {
                this.mRefreshSurfaceDone = false;
            }
        }
        if (getConfigInt(27, this.mCleanWhenStop) > 0) {
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.reset();
                this.mPrepared = false;
            }
            int configInt2 = getConfigInt(542, this.mCleanSurfaceWhenReset);
            if (this.mMediaPlayer != null && this.mTextureSurface != null && (configInt2 > 0 || (configInt == 1 && this.mRefreshTextureSurface))) {
                this.mMediaPlayer.setSurface(null);
            }
            if (getConfigInt(4004, this.mDecoderRenderClearTextureRenderRef) > 0 && this.mVideoCodecType > 0 && this.mVideoCodecType != 2) {
                releaseTextureRenderRef();
            }
            if (configInt == 1 && this.mRefreshTextureSurface) {
                releaseTextureRenderRef();
                this.mRefreshTextureSurface = false;
            }
            if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 0) {
                this.mMediaPlayer.release();
                this.mMediaPlayer = null;
            }
            MediaPlayer mediaPlayer = this.mAsyncPlayer;
            if (mediaPlayer != null) {
                mediaPlayer.release();
                this.mAsyncPlayer = null;
            }
            this.mState = 0;
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null && videoSurface.getIntOption(133) == 1) {
            MediaPlayer mediaPlayer2 = this.mAsyncPlayer;
            if (mediaPlayer2 == null) {
                mediaPlayer2 = this.mMediaPlayer;
            }
            if (mediaPlayer2 != null) {
                mediaPlayer2.setSurface(null);
            }
            releaseTextureRenderRef();
            TTVideoEngineLog.i(logcatTag(), "texturerender connected cpu,reset");
        }
        Handler handler = this.mTestNetSpeedHandler;
        if (handler != null) {
            handler.removeCallbacks(this.mTestNetSpeedRunable);
        }
        _dataLoaderRemoveEngineRef();
        this.mSRStrategy.resetAll();
        this.mSRNotUseReason = 0;
        this.mGearStrategyEnabled = 0;
        this.mGearStrategyConfig = new GearStrategyConfig();
        this.mEngineConfig.remove(583);
    }

    boolean _doSupportByteVC1Playback() {
        if (this.mMediaPlayer == null) {
            return true;
        }
        try {
            int currentPosition = this.mMediaPlayer.getCurrentPosition();
            int duration = this.mMediaPlayer.getDuration();
            long longOption = this.mMediaPlayer.getLongOption(72, -1L);
            if (this.mMediaPlayer.getIntOption(157, -1) == 5 && this.mPlaybackState == 1 && this.mLoadState == 1 && currentPosition >= 1000 && duration - currentPosition >= 1000 && longOption >= 500) {
                int intOption = this.mMediaPlayer.getIntOption(160, 100);
                long longOption2 = this.mMediaPlayer.getLongOption(152, -1L);
                int intOption2 = this.mMediaPlayer.getIntOption(153, -1);
                float floatOption = this.mMediaPlayer.getFloatOption(151, 0.0f);
                if (floatOption > getConfigInt(l.h, this.mMaxFps)) {
                    floatOption /= 2.0f;
                }
                int configInt = getConfigInt(207, this.mFrameDropNum);
                int i = (((int) floatOption) * configInt) / (configInt + 1);
                TTVideoEngineLog.d(logcatTag(), "cd = " + longOption2 + ", dc = " + intOption2 + ", mdps = " + i + ", vs =" + intOption);
                if (longOption2 <= -350) {
                    if (intOption2 >= (i * 2) / 3 && intOption > 2) {
                        return false;
                    }
                }
            }
        } catch (Exception unused) {
        }
        return true;
    }

    boolean _doSupportByteVC2Playback() {
        if (this.mMediaPlayer == null) {
            return true;
        }
        try {
            int currentPosition = this.mMediaPlayer.getCurrentPosition();
            int duration = this.mMediaPlayer.getDuration();
            long longOption = this.mMediaPlayer.getLongOption(72, -1L);
            if (this.mMediaPlayer.getIntOption(157, -1) == 7 && this.mPlaybackState == 1 && this.mLoadState == 1 && currentPosition >= 1000 && duration - currentPosition >= 1000 && longOption >= 500) {
                int intOption = this.mMediaPlayer.getIntOption(160, 100);
                long longOption2 = this.mMediaPlayer.getLongOption(152, -1L);
                int intOption2 = this.mMediaPlayer.getIntOption(153, -1);
                float floatOption = this.mMediaPlayer.getFloatOption(151, 0.0f);
                if (floatOption > getConfigInt(l.h, this.mMaxFps)) {
                    floatOption /= 2.0f;
                }
                int configInt = getConfigInt(207, this.mFrameDropNum);
                int i = (((int) floatOption) * configInt) / (configInt + 1);
                TTVideoEngineLog.d(logcatTag(), "cd = " + longOption2 + ", dc = " + intOption2 + ", mdps = " + i + ", vs =" + intOption);
                if (longOption2 <= -350) {
                    if (intOption2 >= (i * 2) / 3 && intOption > 2) {
                        return false;
                    }
                }
            }
        } catch (Exception unused) {
        }
        return true;
    }

    @Override
    public int getCurrentPlaybackTime() {
        int i = -1;
        if (this.mState != 3) {
            if (this.mSeamSwitchingResolution || this.mState == 4) {
                i = this.mLastPlaybackTime;
            }
            TTVideoEngineLog.i(logcatTag(), "state not correct return:" + this.mState);
            return i;
        }
        if ((this.mPlaybackState != 1 && this.mPlaybackState != 2 && !this.mPrepared) || this.mShouldStop) {
            TTVideoEngineLog.i(logcatTag(), "playbackstate not correct return:" + this.mPlaybackState);
            return -1;
        }
        if (this.mHasComplete) {
            if (this.mDuration <= 0) {
                return -1;
            }
            return this.mDuration;
        }
        if (getConfigInt(663, this.mGetPositionSkipLooper ? 1 : 0) != 1 && this.mLooperThread.checkEngineLooperThread(true)) {
            if (!this.mLooperThread.sendEngineMessage(151, getConfigInt(950, (int) this.mSendEngineMsgTimeout))) {
                return -1;
            }
            this.mLooperThread.mEngineMsgRetValue.setDataPosition(0);
            return this.mLooperThread.mEngineMsgRetValue.readInt();
        }
        return _doGetCurrentPlaybackTime();
    }

    @Override
    public VideoFormatInfo getVideoFormatInfo() {
        VideoFormatInfo videoFormatInfo = new VideoFormatInfo();
        if (this.mMediaPlayer != null) {
            String stringOption = this.mMediaPlayer.getStringOption(516);
            if (!TextUtils.isEmpty(stringOption)) {
                if (stringOption.indexOf("mp4") > 0) {
                    videoFormatInfo.fileFormat = "mp4";
                } else {
                    int indexOf = stringOption.indexOf(",");
                    if (indexOf < 0) {
                        videoFormatInfo.fileFormat = stringOption;
                    } else {
                        videoFormatInfo.fileFormat = stringOption.substring(0, indexOf);
                    }
                }
            }
            videoFormatInfo.bitrate = this.mMediaPlayer.getLongOption(171, 0L);
            videoFormatInfo.videoCodecName = this.mMediaPlayer.getIntOption(157, -1);
            videoFormatInfo.videoProfile = this.mMediaPlayer.getIntOption(403, -1);
            videoFormatInfo.width = this.mMediaPlayer.getVideoWidth();
            videoFormatInfo.height = this.mMediaPlayer.getVideoHeight();
            videoFormatInfo.rotation = this.mMediaPlayer.getIntOption(555, -1);
            videoFormatInfo.containerFps = this.mMediaPlayer.getFloatOption(151, 0.0f);
            videoFormatInfo.audioCodecName = this.mMediaPlayer.getIntOption(158, -1);
            videoFormatInfo.audioProfile = this.mMediaPlayer.getIntOption(402, -1);
            videoFormatInfo.channels = this.mMediaPlayer.getIntOption(553, -1);
            videoFormatInfo.sampleRate = this.mMediaPlayer.getIntOption(554, -1);
        }
        return videoFormatInfo;
    }

    private void _configHardwareDecode() {
        IVideoModel iVideoModel;
        String str;
        boolean z;
        int vodInt = SettingsHelper.helper().getVodInt("config_hardware_type", 0);
        this.mLogger.setIntOption(95, vodInt);
        if (vodInt > 0) {
            TTVideoEngineLog.i(logcatTag(), "settings hardware config " + vodInt);
            if (vodInt == SettingsHelper.HARDWARE_CONFIG_VIDEO_MODEL) {
                IVideoModel iVideoModel2 = this.mVideoModel;
                if (iVideoModel2 != null) {
                    String videoRefStr = iVideoModel2.getVideoRefStr(223);
                    if (!TextUtils.isEmpty(videoRefStr) && videoRefStr.equals("hw")) {
                        this.mHardwareDecodeEnablePlayer2 = 1;
                    }
                    TTVideoEngineLog.i(logcatTag(), "using videoModel hardware: " + this.mHardwareDecodeEnablePlayer2);
                }
            } else if (vodInt == SettingsHelper.HARDWARE_CONFIG_SETTINGS) {
                JSONObject jSONObject = null;
                VideoInfo videoInfo = this.currentVideoInfo;
                if (videoInfo != null && !TextUtils.isEmpty(videoInfo.getValueStr(8))) {
                    String valueStr = this.currentVideoInfo.getValueStr(8);
                    if (valueStr.equals("h264")) {
                        jSONObject = SettingsHelper.helper().getVodJsonObject("hardware_decode_bytevc0");
                    } else if (valueStr.equals("bytevc1")) {
                        jSONObject = SettingsHelper.helper().getVodJsonObject("hardware_decode_bytevc1");
                    } else if (valueStr.equals("bytevc2")) {
                        jSONObject = SettingsHelper.helper().getVodJsonObject("hardware_decode_bytevc2");
                    }
                }
                if (jSONObject != null) {
                    if (!this.mHasSetHardWare) {
                        this.mHardwareDecodeEnablePlayer2 = 0;
                    }
                    int optInt = jSONObject.optInt("value");
                    JSONArray optJSONArray = jSONObject.optJSONArray("allow_tag_list");
                    JSONArray optJSONArray2 = jSONObject.optJSONArray("block_tag_list");
                    if (TextUtils.isEmpty(this.mTag)) {
                        str = "default";
                    } else {
                        str = this.mTag;
                    }
                    if (optJSONArray2 != null) {
                        int i = 0;
                        while (true) {
                            if (i < optJSONArray2.length()) {
                                if (optJSONArray2.optString(i).equals(str)) {
                                    z = true;
                                    break;
                                }
                                i++;
                            } else {
                                z = false;
                                break;
                            }
                        }
                        if (!z) {
                            this.mLogger.addFeature("st_hw", Integer.valueOf(optInt));
                            this.mHardwareDecodeEnablePlayer2 = optInt;
                        }
                    } else if (optJSONArray != null) {
                        int i2 = 0;
                        while (true) {
                            if (i2 >= optJSONArray.length()) {
                                break;
                            }
                            if (optJSONArray.optString(i2).equals(str)) {
                                this.mLogger.addFeature("st_hw", Integer.valueOf(optInt));
                                this.mHardwareDecodeEnablePlayer2 = optInt;
                                break;
                            }
                            i2++;
                        }
                    } else {
                        this.mLogger.addFeature("st_hw", Integer.valueOf(optInt));
                        this.mHardwareDecodeEnablePlayer2 = optInt;
                    }
                    TTVideoEngineLog.i(logcatTag(), "using settings hardware, dic = " + jSONObject.toString());
                } else if (SettingsHelper.helper().getVodInt("hardware_decode_priority", 0) == 0 || !this.mHasSetHardWare) {
                    int vodInt2 = SettingsHelper.helper().getVodInt("hardware_decode", 0);
                    this.mLogger.addFeature("st_hw", Integer.valueOf(vodInt2));
                    this.mHardwareDecodeEnablePlayer2 = vodInt2;
                }
                if (this.mHardwareDecodeEnablePlayer2 > 0 && this.mVideoModel != null) {
                    this.mAsyncInitEnable = SettingsHelper.helper().getVodInt("hardware_async_init", 1);
                }
                TTVideoEngineLog.i(logcatTag(), "using settings hardware: " + this.mHardwareDecodeEnablePlayer2 + ", async = " + this.mAsyncInitEnable);
            }
        } else if ((!this.mHasSetHardWare || getConfigInt(519, this.mUseServerDecodingMode ? 1 : 0) != 0) && (iVideoModel = this.mVideoModel) != null) {
            String videoRefStr2 = iVideoModel.getVideoRefStr(223);
            if (!TextUtils.isEmpty(videoRefStr2) && videoRefStr2.equals("hw")) {
                this.mHardwareDecodeEnablePlayer2 = 1;
            }
        }
        if (this.mMediaPlayer != null) {
            if (this.mMediaPlayer.getPlayerType() != 1 && this.mMediaPlayer.getPlayerType() != 2 && this.mMediaPlayer.getPlayerType() != 5) {
                this.mHardwareDecodeEnablePlayer2 = 0;
            }
            this.mMediaPlayer.setIntOption(59, this.mHardwareDecodeEnablePlayer2);
        }
    }

    private void _fetchVideoInfo() {
        boolean z;
        String str;
        VideoModelCache.VideoModelCacheInfo videoModelCacheInfo;
        Handler handler;
        this.mState = 1;
        _resetUrlIndexMap();
        String aPIString = getAPIString();
        if (getConfigInt(400, this.mIsUseBoe ? 1 : 0) == 1) {
            aPIString = TTHelper.buildBoeUrl(aPIString);
        }
        this.mAPIString = TTVideoEngineUtils.BuildHttpsApi(aPIString);
        TTVideoEngineLog.i(logcatTag(), "start to fetch video info:" + this.mAPIString);
        boolean z2 = false;
        if (getConfigInt(299, this.mUseVideoModelCacheForce ? 1 : 0) == 1) {
            z = true;
        } else {
            z = false;
        }
        if (this.mVideoModelCache != null && !TextUtils.isEmpty(this.mVideoID) && this.mUseVideoModelCache) {
            boolean isNetAvailable = NetUtils.isNetAvailable(this.mContext);
            if ((this.mErrorCount <= 1 || !isNetAvailable) && (videoModelCacheInfo = this.mVideoModelCache.get(this.mVideoID, this.mAPIString)) != null && (!videoModelCacheInfo.isExpired || z || (!isNetAvailable && DataLoaderHelper.getDataLoader().isRunning() && getConfigInt(160, this.mDataLoaderEnable) > 0))) {
                TTVideoEngineLog.i(logcatTag(), "using videomodel cache");
                this.mLogger.setIsVideoModelCache(1);
                VideoModel videoModel = videoModelCacheInfo.model;
                this.mVideoModel = videoModel;
                _logFetchedVideoInfo(videoModel);
                fetchedVideoInfo(this.mVideoModel);
                if (this.mVideoInfoListener != null) {
                    if (this.mLooperThread.checkSendMainLooper()) {
                        if (getConfigInt(558, this.mWaitForFetchInfoResult ? 1 : 0) != 0) {
                            this.mLooperThread.sendMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL, 0, 0, this.mVideoModel);
                            this.mLooperThread.mMainMsgRetValue.setDataPosition(0);
                            if (this.mLooperThread.mMainMsgRetValue.readInt() == 1) {
                                z2 = true;
                            }
                        } else {
                            this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL, 0, 0, this.mVideoModel);
                        }
                    } else {
                        IVideoModel iVideoModel = this.mVideoModel;
                        if (iVideoModel instanceof VideoModel) {
                            z2 = this.mVideoInfoListener.onFetchedVideoInfo((VideoModel) iVideoModel);
                        }
                    }
                    if (z2) {
                        return;
                    }
                }
                if (getConfigInt(410, this.mAsyncPlayHitVMCache ? 1 : 0) == 1 && (handler = this.mHandler) != null) {
                    try {
                        handler.post(new Runnable() {
                            @Override
                            public final void run() {
                                TTVideoEngineImpl.this.lambda$_fetchVideoInfo$6$TTVideoEngineImpl();
                            }
                        });
                        return;
                    } catch (Exception e) {
                        TTVideoEngineLog.e(logcatTag(), e.toString());
                        _parseIPAddress(this.mVideoModel);
                        return;
                    }
                }
                _parseIPAddress(this.mVideoModel);
                return;
            }
        }
        if (this.mUseVideoModelCache) {
            this.mLogger.setIsVideoModelCache(0);
        }
        this.mIsFetchingInfo = true;
        VideoInfoFetcher videoInfoFetcher = new VideoInfoFetcher(this.mContext, getNetClientSetByUser(), this.mTag);
        this.mFetcher = videoInfoFetcher;
        videoInfoFetcher.setVideoID(this.mVideoID);
        this.mFetcher.setUseVideoModelCache(this.mUseVideoModelCache);
        this.mFetcher.setUseVideoModelCacheForce(z);
        this.mFetcher.setPlayType(this.mPlayType);
        if (getConfigInt(492, this.mUseFallbackAPI ? 1 : 0) > 0 && this.mFallbackAPI != null) {
            this.mFetcher.setUseFallbakApi(true);
        }
        this.mFetcher.setListener(new MyFetcherListener(this));
        VideoInfoFetcher videoInfoFetcher2 = this.mFetcher;
        String str2 = this.mAPIString;
        int i = this.mPlayAPIVersion;
        if (i != 2 && i != 4) {
            str = this.mAuthorization;
        } else {
            str = null;
        }
        videoInfoFetcher2.fetchInfo(str2, str, i, this.mKeyseed);
        this.mFetcher.setResolutionMap(this.mResolutionMap);
    }

    private void _replayOrResume() {
        String str;
        IpInfo ipInfo;
        if (shouldPrepare()) {
            if (!this.mIsLocal && !this.mIsDirectURL && this.mPlayFd == null && this.mMediaDataSource == null) {
                if (this.mIsPreloaderItem) {
                    long currentTimeMillis = System.currentTimeMillis() / 1000;
                    if (this.mPreloaderItem.mUrlTime > 0 && currentTimeMillis - this.mPreloaderItem.mUrlTime > 2400) {
                        _fetchVideoInfo();
                    }
                    _logBeginToPlay(this.mPreloaderItem.mVideoID);
                    _singleURLParseAndPlay(this.mPreloaderItem.mUrl, this.mHeaders);
                    return;
                }
                if (this.mIsPlayItem) {
                    _logBeginToPlay(this.mVideoID);
                    _singleURLParseAndPlay(this.mPlayItem.playURL, this.mHeaders);
                    return;
                }
                _logBeginToPlay(this.mVideoID);
                Map<String, IpInfo> map = this.urlIPMap;
                if (map != null && (ipInfo = map.get(this.mURLInfo.hostURL)) != null) {
                    ipInfo.dns = "FromCache";
                    this.urlIPMap.put(this.mURLInfo.hostURL, ipInfo);
                    _updateVU();
                }
                _playInternal(this.mURLInfo.getCurrentURL(), this.mHeaders);
                return;
            }
            _logBeginToPlay(this.mVideoID);
            if (this.mIsLocal) {
                str = this.mLocalURL;
            } else {
                str = this.mDirectURL;
            }
            _singleURLParseAndPlay(str, this.mHeaders);
            return;
        }
        TTVideoEngineLog.d(logcatTag(), "_replayOrResume state:" + this.mPlaybackState + ", playtime:" + this.mPlayTime);
        if (this.mIsPlayComplete || (this.mPlaybackState == 0 && this.mPlayTime == 0)) {
            _sendUrlInfoMsg();
            _sendMdlCacheMsg();
            _logBeginToPlay(this.mVideoID);
            Map<String, String> map2 = this.mHeaders;
            MediaPlayer mediaPlayer = this.mMediaPlayer;
            if (map2 != null && mediaPlayer != null) {
                map2.put("X-Tt-Traceid", this.mTraceId);
                StringBuilder sb = new StringBuilder();
                for (Map.Entry<String, String> entry : map2.entrySet()) {
                    sb.append(entry.getKey());
                    sb.append(": ");
                    sb.append(entry.getValue());
                    sb.append("\r\n");
                }
                this.mMediaPlayer.setStringOption(20, sb.toString());
            }
            if (this.mPlayDuration != null) {
                this.mPlayDuration.clear();
            }
        }
        _resumeVideo();
    }

    private void _setupSubtitleInfo() {
        SubDesInfoModelProvider subDesInfoModelProvider;
        IVideoModel iVideoModel = this.mVideoModel;
        int i = 0;
        if (iVideoModel != null && iVideoModel.getSubInfoList() != null && this.mEnableSubThread > 0) {
            int size = this.mVideoModel.getSubInfoList().size();
            TTVideoEngineLog.d(logcatTag(), "subtitle num: " + size);
            if (!TextUtils.isEmpty(getConfigString(546, this.mSubIds))) {
                String[] split = getConfigString(546, this.mSubIds).split(",");
                if (TextUtils.isEmpty(this.mSubLanIds) || TextUtils.isEmpty(this.mSubVersions)) {
                    ArrayList arrayList = new ArrayList();
                    ArrayList arrayList2 = new ArrayList();
                    for (com.ss.ttvideoengine.model.SubInfo subInfo : this.mVideoModel.getSubInfoList()) {
                        if (subInfo != null) {
                            for (String str : split) {
                                if (!TextUtils.isEmpty(str) && str.equals(Integer.toString(subInfo.getValueInt(0)))) {
                                    arrayList.add(Integer.toString(subInfo.getValueInt(1)));
                                    arrayList2.add(subInfo.getValueStr(3));
                                }
                            }
                        }
                    }
                    this.mSubLanIds = TextUtils.join(",", arrayList);
                    this.mSubVersions = TextUtils.join(",", arrayList2);
                }
            }
            i = size;
        }
        TTVideoEngineLog.d(logcatTag(), "_setup subtitle info in");
        int i2 = this.mEnableSubThread;
        if (i2 > 0 && (subDesInfoModelProvider = this.mSubDesInfoModel) != null) {
            String subDesInfoModelProvider2 = subDesInfoModelProvider.toString();
            if (subDesInfoModelProvider2 == null || subDesInfoModelProvider2.length() <= 0 || this.mSubDesInfoModel.subtitleCount() <= 0) {
                return;
            }
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.setSubtitleIdsCount(i);
            }
            TTVideoEngineLog.d(logcatTag(), "using subtitle description info for setup subtitle");
            _setSubInfoToMediaPlayer(subDesInfoModelProvider2);
            return;
        }
        if (i2 > 0 && !this.mHasFetchedSubtitle && i > 0) {
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (iVideoEventLogger2 != null) {
                iVideoEventLogger2.setSubtitleIdsCount(i);
            }
            TTVideoEngineLog.d(logcatTag(), "start fetch subtitle info");
            _fetchSubInfo();
            this.mHasFetchedSubtitle = true;
        }
    }

    private void resetMediaPlayerOptions2() {
        int i;
        super.resetMediaPlayerOptions();
        this.mPlayerConfigExecutor.execute(this.mEngineConfig.getItemMap(), 1);
        this.mMediaPlayer.setIntOption(59, this.mHardwareDecodeEnablePlayer2);
        if (this.mEngineConfig.getIntOption(329) == 1) {
            this.mMediaPlayer.setFloatOption(303, this.mEngineConfig.getFloatOption(325));
            this.mMediaPlayer.setFloatOption(304, this.mEngineConfig.getFloatOption(326));
            this.mMediaPlayer.setFloatOption(l.n, this.mEngineConfig.getFloatOption(328));
            this.mMediaPlayer.setFloatOption(l.m, this.mEngineConfig.getFloatOption(327));
            this.mMediaPlayer.setIntOption(643, this.mEngineConfig.getIntOption(343));
            this.mMediaPlayer.setFloatOption(644, this.mEngineConfig.getFloatOption(345));
            this.mMediaPlayer.setFloatOption(645, this.mEngineConfig.getFloatOption(344));
            this.mMediaPlayer.setFloatOption(646, this.mEngineConfig.getFloatOption(346));
            this.mMediaPlayer.setFloatOption(1151, this.mEngineConfig.getFloatOption(348));
            this.mMediaPlayer.setFloatOption(1152, this.mEngineConfig.getFloatOption(349));
            this.mMediaPlayer.setFloatOption(1153, this.mEngineConfig.getFloatOption(350));
            this.mMediaPlayer.setFloatOption(1154, this.mEngineConfig.getFloatOption(351));
            this.mMediaPlayer.setFloatOption(1155, this.mEngineConfig.getFloatOption(352));
            this.mMediaPlayer.setFloatOption(1156, this.mEngineConfig.getFloatOption(353));
            this.mMediaPlayer.setFloatOption(1157, this.mEngineConfig.getFloatOption(354));
            this.mMediaPlayer.setIntOption(1159, this.mEngineConfig.getIntOption(356));
            this.mMediaPlayer.setIntOption(1160, this.mEngineConfig.getIntOption(357));
            this.mMediaPlayer.setStringOption(1158, this.mEngineConfig.getStringOption(355));
            this.mMediaPlayer.setStringOption(1161, this.mEngineConfig.getStringOption(360));
            this.mMediaPlayer.setStringOption(1162, this.mEngineConfig.getStringOption(361));
        }
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        int i2 = 0;
        if (this.mIsStartPlayAutomatically && this.mIsPreDecodeAutoPause) {
            i = 0;
        } else {
            i = 1;
        }
        mediaPlayer.setIntOption(196, i);
        TTVideoEngineLog.i(logcatTag(), "pre decode auto pause : " + this.mIsPreDecodeAutoPause);
        TTVideoEngineLog.i(logcatTag(), "read cache mode : " + this.mIsStartPlayAutomatically);
        MediaPlayer mediaPlayer2 = this.mMediaPlayer;
        if (!this.mIsStartPlayAutomatically) {
            i2 = this.mReadCacheMode;
        }
        mediaPlayer2.setIntOption(289, i2);
        this.mMediaPlayer.setIntOption(290, this.mAutoRangeOffset);
        if (this.mDangerBufferThreshold > 0) {
            TTVideoEngineLog.i(logcatTag(), "buffer threshold enable");
            this.mMediaPlayer.setIntOption(296, 1);
            this.mMediaPlayer.setIntOption(294, this.mDangerBufferThreshold);
            this.mMediaPlayer.setIntOption(295, this.mSecureBufferThreshold);
        }
    }

    private void setupTextureRender() {
        int i;
        int i2;
        TTVideoEngineLog.i(logcatTag(), "[SRLog]setupTextureRender");
        int i3 = 0;
        this.mTextureRenderError = 0;
        this.mTextureRenderer = v.a();
        TTVideoEngineLog.i(logcatTag(), "get texture renderer start");
        v vVar = this.mTextureRenderer;
        if (vVar == null) {
            this.mUseTextureRender = 0;
            TTVideoEngineLog.e(logcatTag(), "couldn't get rendererManager");
            return;
        }
        vVar.a(this.mContext);
        if (mTextureLogListenerExt == null) {
            MyTextureLogListenerExt myTextureLogListenerExt = new MyTextureLogListenerExt();
            mTextureLogListenerExt = myTextureLogListenerExt;
            u.a(0, myTextureLogListenerExt);
        }
        boolean z = this.mUseSRTexture;
        this.mPlayBackUsedSR = z;
        g gVar = new g();
        TextureRenderStrategy textureRenderStrategy = this.mTRSrategy;
        if (textureRenderStrategy != null) {
            this.mAsyncInitEffect = textureRenderStrategy.getAsyncEffect(gVar);
        }
        if (this.mEffectBundle.isEmpty() && this.mAsyncInitEffect) {
            if (z && this.mAsyncInitSR) {
                gVar.a(5, 1);
            }
            if (!this.mTextureRenderer.b(gVar, 0)) {
                if (z) {
                    this.mUseSRTexture = false;
                    return;
                }
                return;
            }
        } else if (this.mEffectBundle.isEmpty() && z && this.mAsyncInitSR && !this.mTextureRenderer.a(0)) {
            TTVideoEngineLog.i("TTVideoEngine", "sr instance not exist, useSR:" + z + ", asyncInitSR:" + this.mAsyncInitSR);
            this.mUseSRTexture = false;
            this.mSRStrategy.onSRStatus(2, -7877);
            return;
        }
        this.mAsyncInitSR = false;
        this.mAsyncInitEffect = false;
        if (this.mTextureRenderer.a(0) && (this.mUseSRTexture || this.mPlayBackUsedSR)) {
            this.mPlayBackUsedSR = true;
            z = true;
        }
        VideoSurface initTextureRender = initTextureRender(z);
        if (initTextureRender == null) {
            this.mUseTextureRender = 0;
            this.mTextureRenderErrorMsg = this.mTextureRenderer.f107969a;
            TTVideoEngineLog.e(logcatTag(), "genOffscreenSurface failed = " + this.mTextureRenderErrorMsg);
            return;
        }
        initTextureRender.ignoreSRResolutionCheck(this.mSRIgnoreRes);
        initTextureRender.setOnDrawFrameListener(new VideoSurface.a() {
            private int mUsingSr = 0;
            private int mUsingSharpe = 0;

            AnonymousClass1() {
            }

            @Override
            public void onDraw(long j) {
                if (TTVideoEngineImpl.this.mDecodedVideoFirstFrame) {
                    TTVideoEngineImpl.this.mFrameCount++;
                    if (TTVideoEngineImpl.this.mTextureSurface != null) {
                        int intOption = TTVideoEngineImpl.this.mTextureSurface.getIntOption(6);
                        int intOption2 = TTVideoEngineImpl.this.mTextureSurface.getIntOption(15);
                        if (this.mUsingSr != intOption || this.mUsingSharpe != intOption2) {
                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "[SRLog]using sr:" + intOption + " frameCount:" + TTVideoEngineImpl.this.mFrameCount + "usingSharpe:" + intOption2);
                            this.mUsingSr = intOption;
                            this.mUsingSharpe = intOption2;
                            TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                            if (tTVideoEngineImpl.getConfigInt(4005, tTVideoEngineImpl.mEnableDecoderRenderVC2RenderLatency) > 0) {
                                if (this.mUsingSr <= 0 && this.mUsingSharpe <= 0) {
                                    TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "non sr latency mode");
                                    TTVideoEngineImpl.this.setIntOption(4006, 1);
                                } else {
                                    TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "sr latency mode");
                                    TTVideoEngineImpl.this.setIntOption(4006, 0);
                                }
                            }
                            TTVideoEngineImpl.this.mSRStrategy.onSRStatus(intOption, 0);
                        }
                    }
                    if (TTVideoEngineImpl.this.mListenerCompact != null) {
                        TTVideoEngineImpl.this.mListenerCompact.onFrameDraw(TTVideoEngineImpl.this.mFrameCount, null);
                    }
                }
                if (!TTVideoEngineImpl.this.mTextureFirstFrame && TTVideoEngineImpl.this.mDecodedVideoFirstFrame) {
                    TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "recive first frame render from texture");
                    TTVideoEngineImpl.this.mTextureFirstFrame = true;
                }
                if (TTVideoEngineImpl.this.mPlayerFirstFrame && !TTVideoEngineImpl.this.mTexNotifyFirstFrame && TTVideoEngineImpl.this.mShouldPlay) {
                    TTVideoEngineImpl tTVideoEngineImpl2 = TTVideoEngineImpl.this;
                    if (tTVideoEngineImpl2.getConfigInt(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME, tTVideoEngineImpl2.mFirstFrameOpenTexture) != 1) {
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "render start by texture, state =" + TTVideoEngineImpl.this.mPlaybackState);
                        TTVideoEngineImpl.this._renderStart();
                    }
                }
            }
        });
        initTextureRender.setOnErrorListener(new VideoSurface.b() {
            @Override
            public final void onError(int i4) {
                TTVideoEngineImpl.this.lambda$setupTextureRender$1$TTVideoEngineImpl(i4);
            }
        });
        initTextureRender.setIntOption(34, this.mEnableTextureRenderNoRenderCheck);
        if (getConfigInt(4009, this.mTextureRenderForbidReuseVideoSurfaceTexture) > 0) {
            if (this.mHardwareDecodeEnablePlayer2 <= 0) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            initTextureRender.setIntOption(116, i2);
        }
        if (getConfigInt(4010, this.mTextureRenderForbidForbidReuseTexture) > 0) {
            if (this.mHardwareDecodeEnablePlayer2 <= 0) {
                i = 1;
            } else {
                i = 0;
            }
            initTextureRender.setIntOption(117, i);
        }
        initTextureRender.setNoRenderListener(new VideoSurface.f() {
            AnonymousClass2() {
            }

            @Override
            public void onNoRenderEnd(int i4) {
                if (TTVideoEngineImpl.this.mLogger != null) {
                    TTVideoEngineImpl.this.mLogger.AVNoRenderEnd(0);
                }
            }

            @Override
            public void onNoRenderStart(int i4) {
                if (TTVideoEngineImpl.this.mLogger != null) {
                    TTVideoEngineImpl.this.mLogger.AVNoRenderStart(0, VideoEventOneNoRender.unifyReason(i4));
                }
            }
        });
        initTextureRender.setOnSetSurfaceListener(new VideoSurface.g() {
            @Override
            public final int onSetSurface(VideoSurface videoSurface, Surface surface) {
                return TTVideoEngineImpl.this.lambda$setupTextureRender$2$TTVideoEngineImpl(videoSurface, surface);
            }
        });
        initTextureRender.setIntOption(3, 1);
        if (getConfigInt(650, this.mOverlayMode) == 2) {
            i3 = 1;
        }
        initTextureRender.setIntOption(2, i3);
        initTextureRender.setIntOption(150, this.mEnableTextureRenderNativeWindow);
        initTextureRender.setIntOption(149, this.mEnableFrameCallbackInRenderThread);
        while (!this.mEffectBundle.isEmpty()) {
            initTextureRender.setEffect(this.mEffectBundle.poll());
        }
        TTVideoEngineLog.i(logcatTag(), "get a surface = " + initTextureRender);
        this.mTextureSurface = initTextureRender;
        if (initTextureRender != null) {
            String stringOption = initTextureRender.getStringOption(119);
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.setStringOption(161, stringOption);
            }
        }
        if (shouldStartTextureRenderCheck()) {
            initTextureRender.setIntOption(33, 1);
        }
        setSurfaceDimensionsToTextureRender();
        resetTexture();
    }

    public void _renderStart() {
        int i;
        boolean z;
        TTVideoEngineLog.i(logcatTag(), "start to render,this:" + this);
        _logRenderStartTime();
        if (this.mShouldPlay) {
            updatePlaybackState(1);
        }
        _logFirstFrame();
        _setupSubtitleInfo();
        this.mTexNotifyFirstFrame = true;
        final boolean isPlaybackUseForEffect = this.mTRSrategy.isPlaybackUseForEffect(1);
        boolean z2 = this.mPlayBackUsedSR;
        if (z2 || isPlaybackUseForEffect) {
            if ((z2 && this.mAsyncInitSR) || (isPlaybackUseForEffect && this.mAsyncInitEffect && this.mTextureSurface == null)) {
                this.mSRNotUseReason = -7898;
                EngineThreadPool.addExecuteTask(new Runnable() {
                    @Override
                    public final void run() {
                        TTVideoEngineImpl.this.lambda$_renderStart$9$TTVideoEngineImpl(isPlaybackUseForEffect);
                    }
                });
            }
            if (this.mTextureSurface != null && this.mMediaPlayer != null) {
                float f = this.mContainerFPS;
                TTVideoEngineLog.d(logcatTag(), "[SRLog]open sr = " + this.mTextureSrOpen + ",open sr check fps: = " + f);
                if (f > 0.0f && f < 31.0f) {
                    i = 0;
                } else {
                    this.mTextureSrOpen = 0;
                    i = -7892;
                }
                TTVideoEngineLog.d(logcatTag(), "[SRLog]open sr after first frame render open=" + this.mTextureSrOpen + " reason=" + i);
                doOpenSR(this.mTextureSrOpen, i);
                this.mTRSrategy.onRenderStart(f, this.mTextureSurface, this.mHasFirstFrameShown);
                if (getConfigInt(4005, this.mEnableDecoderRenderVC2RenderLatency) > 0 && getConfigInt(588, this.mForceDisableOESRender ? 1 : 0) != 1) {
                    TTVideoEngineLog.i(logcatTag(), "general latency");
                    this.mMediaPlayer.setIntOption(4006, getConfigInt(4007, this.mDecoderRenderVC2RenderLatencyGeneral));
                }
            }
        }
        int i2 = this.mLoadState;
        updateLoadState(1, -1);
        if (this.mPlayDuration != null) {
            this.mPlayDuration.start();
        }
        final int i3 = this.mTestNetSpeedDiff;
        if (this.mTestNetSpeed >= 0 && this.mMediaPlayer != null && i3 > 0) {
            this.mTestNetSpeedHandler = new Handler();
            Runnable runnable = new Runnable() {
                @Override
                public final void run() {
                    TTVideoEngineImpl.this.lambda$_renderStart$10$TTVideoEngineImpl(i3);
                }
            };
            this.mTestNetSpeedRunable = runnable;
            this.mTestNetSpeedHandler.postDelayed(runnable, i3 + (i3 / 2));
        }
        if (this.mRetrying) {
            if (this.mLastPlaybackTime != 0 && !isInHousePlayer()) {
                _seekTo(this.mLastPlaybackTime, this.mRetrying);
            }
            this.mRetrying = false;
            this.mLogger.retryFinish();
        }
        if (this.mStartTime != 0 && !isInHousePlayer()) {
            _seekTo(this.mStartTime, this.mSeamSwitchingResolution);
        }
        this.mStartTime = 0;
        if (this.mSeamSwitchingResolution) {
            z = !this.mCloseRenderStartMsgOnSwitchResolutionDone;
            if (this.mLastPlaybackTime != 0 && !isInHousePlayer()) {
                _seekTo(this.mLastPlaybackTime, this.mSeamSwitchingResolution);
            } else {
                this.mSeamSwitchingResolution = false;
                changeResolutionSwitchingState(false);
                IVideoEventLogger iVideoEventLogger = this.mLogger;
                if (iVideoEventLogger != null) {
                    iVideoEventLogger.switchResolutionEnd(true);
                }
            }
        } else {
            z = true;
        }
        this.mErrorCount = 0;
        this.mBestResolutionType = 0;
        this.mEngineConfig.setIntOption(419, 0);
        if (shouldStartTextureRenderCheck() && i2 != 2) {
            this.mTextureSurface.setIntOption(33, 1);
        }
        if (z) {
            notifyRenderStart();
        }
        if (this.mEnableSurfaceHashmapJudgement > 0) {
            _doRecordSurface();
        }
        setPlayInfo(0, this.mDuration);
        _doRefreshCpu();
    }

    @Override
    public String getAPIString() {
        int i;
        boolean z;
        String str;
        if (!TextUtils.isEmpty(this.mFallbackAPI)) {
            try {
                i = JniUtils.getDecodeMethod();
            } catch (Exception unused) {
                i = 0;
            }
            StringBuilder sb = new StringBuilder(this.mFallbackAPI);
            sb.append(String.format("&method=%d", Integer.valueOf(i)));
            if (!TextUtils.isEmpty(this.mForceCodec)) {
                sb.append(String.format("&%s=%s", "force_codec", this.mForceCodec));
            }
            String sb2 = sb.toString();
            TTVideoEngineLog.i(logcatTag(), "api string from fallback api:" + sb2);
            return sb2;
        }
        if (this.mDataSource == null) {
            return null;
        }
        HashMap hashMap = new HashMap();
        boolean tryLoadPlayerPlugin = MediaPlayerWrapper.tryLoadPlayerPlugin();
        String value = TTPlayerConfiger.getValue(14, "");
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(17) == 1) {
                z = true;
            } else {
                z = false;
            }
        } else {
            z = this.mDashEnabled;
        }
        if (tryLoadPlayerPlugin) {
            if (z) {
                hashMap.put("format_type", "dash");
            }
            if (this.mConfigCenterVersion > 0) {
                str = this.mEngineConfig.getStringOption(1000);
            } else {
                str = this.mCodecType;
            }
            if (str.equals("bytevc2")) {
                hashMap.put("codec_type", "4");
            } else if (str.equals("bytevc1")) {
                hashMap.put("codec_type", "3");
            }
        } else {
            this.mHardwareDecodeEnablePlayer2 = 0;
        }
        if (this.mPlayerType == 2 && getConfigInt(34, this.mDrmType) == 2) {
            hashMap.put("format_type", "mpd");
        }
        if (getConfigInt(312, this.mEnableHttps ? 1 : 0) != 1 && !this.mRetryEnableHttps) {
            this.mHttpsEnabled = false;
        } else {
            this.mHttpsEnabled = true;
            hashMap.put("ssl", "1");
        }
        hashMap.put("player_version", value);
        if (this.mEnableMaskThread > 1) {
            hashMap.put("barragemask", "1");
        }
        hashMap.put("cdn_type", String.valueOf(this.mP2PCDNType));
        int lastPortraitResult = PortraitNetworkScore.getInstance().getLastPortraitResult();
        if (lastPortraitResult != -1) {
            hashMap.put("network_score", String.valueOf(lastPortraitResult));
        }
        if (!TextUtils.isEmpty(this.mForceCodec)) {
            hashMap.put("force_codec", this.mForceCodec);
        }
        Map<String, String> playerAbility = TTVideoEngine.getPlayerAbility(this.mPlayerType);
        if (this.mFetchWithAbilityOption && !playerAbility.isEmpty()) {
            try {
                hashMap.put("TtPlayerSdkOptions", new JSONObject(playerAbility).toString());
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        TTVideoEngineLog.i(logcatTag(), hashMap.toString());
        String apiForFetcher = this.mDataSource.apiForFetcher(hashMap, this.mPlayAPIVersion);
        TTVideoEngineLog.i(logcatTag(), "api string from apiForFetcher:" + apiForFetcher);
        return apiForFetcher;
    }

    @Override
    public void resetMediaPlayerOptions() {
        int i;
        super.resetMediaPlayerOptions();
        if (this.mEnableVolumeBalance == 1) {
            this.mMediaPlayer.setFloatOption(303, this.mAEPreGain);
            this.mMediaPlayer.setFloatOption(304, this.mAEThreshold);
            this.mMediaPlayer.setFloatOption(l.n, this.mAEPredelay);
            this.mMediaPlayer.setFloatOption(l.m, this.mAERatio);
            this.mMediaPlayer.setIntOption(643, this.mAEType);
            this.mMediaPlayer.setFloatOption(644, this.mSrcLoudness);
            this.mMediaPlayer.setFloatOption(645, this.mTarLoudness);
            this.mMediaPlayer.setFloatOption(646, this.mSrcPeak);
            this.mMediaPlayer.setFloatOption(1151, this.mReleaseTime);
            this.mMediaPlayer.setFloatOption(1152, this.mLookAheadTime);
            this.mMediaPlayer.setFloatOption(1153, this.mLuRange);
            this.mMediaPlayer.setFloatOption(1154, this.mLuStart);
            this.mMediaPlayer.setFloatOption(1155, this.mLuEnd);
            this.mMediaPlayer.setFloatOption(1156, this.mMaxMomLu);
            this.mMediaPlayer.setFloatOption(1157, this.mMaxShortermLu);
            this.mMediaPlayer.setIntOption(1159, this.mVolumInfoVer);
            this.mMediaPlayer.setIntOption(1160, this.mDeviceAEPlayAbility);
            this.mMediaPlayer.setStringOption(1158, this.mAEConfigJson);
            this.mMediaPlayer.setStringOption(1161, this.mVolumeInfoJson);
            this.mMediaPlayer.setStringOption(1162, this.mAEGraphConfig);
        }
        this.mMediaPlayer.setIntOption(224, this.mEnableClockResumeResetEof);
        this.mMediaPlayer.setIntOption(302, this.mEnableVolumeBalance);
        this.mMediaPlayer.setIntOption(370, this.mEnableLoadControlBufferingTimeout);
        this.mMediaPlayer.setIntOption(570, this.mMdlEnableSeekReopen);
        this.mMediaPlayer.setIntOption(855, this.mAVSyncInterruptEnable);
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        int i2 = 0;
        if (this.mIsStartPlayAutomatically && this.mIsPreDecodeAutoPause) {
            i = 0;
        } else {
            i = 1;
        }
        mediaPlayer.setIntOption(196, i);
        TTVideoEngineLog.i(logcatTag(), "pre decode auto pause : " + this.mIsPreDecodeAutoPause);
        TTVideoEngineLog.i(logcatTag(), "read cache mode : " + this.mIsStartPlayAutomatically);
        MediaPlayer mediaPlayer2 = this.mMediaPlayer;
        if (!this.mIsStartPlayAutomatically) {
            i2 = this.mReadCacheMode;
        }
        mediaPlayer2.setIntOption(289, i2);
        this.mMediaPlayer.setIntOption(290, this.mAutoRangeOffset);
        if (this.mDangerBufferThreshold > 0) {
            TTVideoEngineLog.i(logcatTag(), "buffer threshold enable");
            this.mMediaPlayer.setIntOption(296, 1);
            this.mMediaPlayer.setIntOption(294, this.mDangerBufferThreshold);
            this.mMediaPlayer.setIntOption(295, this.mSecureBufferThreshold);
        }
    }

    private void _setLoggerOptions() {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger == null) {
            return;
        }
        iVideoEventLogger.setIntOption(97, this.mEnableOutletDropLimit ? 1 : 0);
        this.mLogger.setIntOption(93, this.mEnableAudioTrackSmoothClock);
        this.mLogger.setIntOption(94, this.mDisableSpiltVoiceWrite);
        this.mLogger.setIntOption(55, this.mEnableNativeYV12Render);
        this.mLogger.setIntOption(96, StrategyHelper.helper().isRunning() ? 1 : 0);
        int enableCPPBYTEVC1CodecOpt = EngineGlobalConfig.getInstance().getEnableCPPBYTEVC1CodecOpt();
        int i = this.mEnableCPPBYTEVC1CodecOpt;
        if (i > 0 || enableCPPBYTEVC1CodecOpt > 0) {
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (i > 0) {
                enableCPPBYTEVC1CodecOpt = i;
            }
            iVideoEventLogger2.addFeature("bytevc1_decoder_opt", Integer.valueOf(enableCPPBYTEVC1CodecOpt));
        }
        int i2 = this.mOpenVoiceEarly;
        if (i2 > 0) {
            this.mLogger.addFeature("open_voice_early", Integer.valueOf(i2));
        }
        int i3 = this.mMaskDelayLoading;
        if (i3 > 0) {
            this.mLogger.addFeature("mask_delay_loading", Integer.valueOf(i3));
        }
        int i4 = this.mMaskRangeOpt;
        if (i4 > 0) {
            this.mLogger.addFeature("mask_range_req", Integer.valueOf(i4));
        }
        int i5 = this.mEnablePreloadGear;
        if (i5 > 0) {
            this.mLogger.addFeature("preload_gear", Integer.valueOf(i5));
        }
        if (this.mIsPrepareDecodeOnly) {
            this.mLogger.addFeature("pre_decode", 1);
        }
        int i6 = this.mAsyncManageResource;
        if (i6 > 0) {
            this.mLogger.addFeature("async_res", Integer.valueOf(i6));
        }
        int i7 = this.mAudioUseDirectBuffer;
        if (i7 > 0) {
            this.mLogger.addFeature("a_directbuf", Integer.valueOf(i7));
        }
        int i8 = this.mAutoDisconnectedCpu;
        if (i8 > 0) {
            this.mLogger.addFeature("auto_disconnect_cpu", Integer.valueOf(i8));
        }
        int i9 = this.mEnableVideoSecondFrame;
        if (i9 > 0) {
            this.mLogger.addFeature("v_2nd_frame", Integer.valueOf(i9));
        }
        int i10 = this.mGiveBackCodecEarly;
        if (i10 > 0) {
            this.mLogger.addFeature("giveback_codec_early", Integer.valueOf(i10));
        }
        int i11 = this.mQueryAdaptivePlayback;
        if (i11 > 0) {
            this.mLogger.addFeature("query_adapt_playback", Integer.valueOf(i11));
        }
        int i12 = this.mCodecPoolSupportDynamicExtend;
        if (i12 > 0) {
            this.mLogger.addFeature("codecpool_extend", Integer.valueOf(i12));
        }
        int i13 = this.mEnableOptimizeHWDec2SWDec;
        if (i13 > 0) {
            this.mLogger.addFeature("opti_hwdec2swdec", Integer.valueOf(i13));
        }
        int i14 = this.mCodecAndSurfaceReuse;
        if (i14 > 0) {
            this.mLogger.addFeature("codec_surface_reuse", Integer.valueOf(i14));
        }
        if (this.mEnableDynamicFrameDropping > 0) {
            this.mLogger.addFeature("decoder_drop", 2);
        } else if (this.mMaxFps > 0) {
            this.mLogger.addFeature("decoder_drop", 1);
        }
        if (1 == this.mHWEnableDynamicFrameDropping) {
            this.mLogger.addFeature("hw_decoder_drop", 3);
        } else if (1 == this.mEnableHWDropFrameWhenVOIsInDropState) {
            this.mLogger.addFeature("hw_decoder_drop", 1);
        } else if (1 == this.mEnableHWDropFrameWhenAVOutSyncing) {
            this.mLogger.addFeature("hw_decoder_drop", 2);
        }
        int i15 = this.mSkipAudioGraph;
        if (i15 > 0) {
            this.mLogger.addFeature("skip_audio_out", Integer.valueOf(i15));
        }
        int i16 = this.mEnableAIBarrageThread;
        if (i16 > 0) {
            this.mLogger.addFeature("ai_barrage", Integer.valueOf(i16));
        }
        if (this.mPrecisePausePts > 0) {
            this.mLogger.addFeature("precise_pause", 1);
        }
        if (this.mEnbalePreDemux > 0) {
            this.mLogger.addFeature("pre_demux", 1);
        }
        int i17 = this.mEnableDemuxNonBlockRead;
        if (i17 > 0) {
            this.mLogger.addFeature("demux_nonblock_read", Integer.valueOf(i17));
        }
        int i18 = this.mEnableMp4Check;
        if (i18 > 0) {
            this.mLogger.addFeature("av_interlaced_check", Integer.valueOf(i18));
        }
        int i19 = this.mEnableClearMDLCache;
        if (i19 > 0) {
            this.mLogger.addFeature("clear_mdl_cache", Integer.valueOf(i19));
        }
        int i20 = this.mEnablexHEAACSupport;
        if (i20 > 0) {
            this.mLogger.addFeature("xHEAAC_audio_support", Integer.valueOf(i20));
        }
        int i21 = this.mNoBufferUpdate;
        if (i21 > 0) {
            this.mLogger.addFeature(" no_buffer_update", Integer.valueOf(i21));
        }
        int i22 = this.mQueryWinEnable;
        if (i22 > 0) {
            this.mLogger.addFeature("query_win", Integer.valueOf(i22));
        }
        int i23 = this.mMediaCodecAsyncModeEnable;
        if (i23 > 0) {
            this.mLogger.addFeature("mediacodec_async", Integer.valueOf(i23));
        }
        if (this.mEnableForceDisableOESRender && this.mForceDisableOESRender) {
            this.mLogger.addFeature("force_disable_oes_render", 1);
        }
        if (this.mEnableCPPBYTEVC2CodecOpt > 0) {
            this.mLogger.addFeature("bytevc2_opt", 1);
        }
        if (this.mEnableAudioMemIntergration > 0) {
            this.mLogger.addFeature("audiomem_intergration", 1);
        }
        if (this.mEnableBufferingLowerCapacity > 0) {
            this.mLogger.addFeature("lower_buffering_capacity", 1);
        }
        if (this.mEnableDowngradeAsyncCodec > 0) {
            this.mLogger.addFeature("downgrade_asynccodec", 1);
        }
        if (this.mEnableMediaCodecSyncClose > 0) {
            this.mLogger.addFeature("mediacodec_sync_clode", 1);
        }
        if (this.mEnableSeekBuffering > 0) {
            this.mLogger.addFeature("seek_buffering", 1);
        }
        if (this.mAsyncSetWindow > 0) {
            this.mLogger.addFeature("async_set_surface", 1);
        }
        int i24 = this.mPlayerCache;
        if (i24 > 0) {
            this.mLogger.addFeature("cache", Integer.valueOf(i24));
        }
        OptionHolder optionHolder = this.mOptionHolder;
        if (optionHolder != null && optionHolder.getIntOption(42027, 0) > 0) {
            this.mLogger.addFeature("out_thread_optimize", 1);
        }
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null && iVideoModel.getVideoRefBool(253)) {
            this.mLogger.addFeature("mb_refactor", 1);
        }
    }

    private void _updateLogTime() {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (this.mLogger != null && mediaPlayer != null && !this.mHasFirstFrameShown) {
            if (getConfigInt(1301, this.mMaskEnableDataloader) > 0) {
                this.mLogger.addFeature("mask_loader", Integer.valueOf(getConfigInt(1301, this.mMaskEnableDataloader)));
            }
            this.mLogger.addFeature("change_rec_buf_speed", Integer.valueOf(getConfigInt(990, this.mChangeRecBufferSpeed)));
            this.mLogger.addFeature("reuse_codec", Integer.valueOf(mediaPlayer.getIntOption(1042, -1)));
            this.mLogger.addFeature("mc_monitor", Integer.valueOf(getConfigInt(1111, this.mEnableMediaCodecDeathCheck)));
            this.mLogger.addFeature("create_audiotrack_early", Integer.valueOf(getConfigInt(1110, this.mCreateAudioTrackEarly)));
            long longOption = mediaPlayer.getLongOption(68, -1L);
            this.mLogger.setDNSParseTime(longOption, 1);
            this.mLogger.setTranConnectTime(mediaPlayer.getLongOption(69, -1L));
            this.mLogger.setTranFirstPacketTime(mediaPlayer.getLongOption(70, -1L));
            this.mLogger.setAudioDNSParseTime(mediaPlayer.getLongOption(267, -1L), 1);
            this.mLogger.setAudioTranConnectTime(mediaPlayer.getLongOption(268, -1L));
            this.mLogger.setAudioTranFirstPacketTime(mediaPlayer.getLongOption(269, -1L));
            this.mLogger.setReceiveFirstVideoFrameTime(mediaPlayer.getLongOption(75, -1L));
            this.mLogger.setReceiveFirstAudioFrameTime(mediaPlayer.getLongOption(76, -1L));
            this.mLogger.setDecodeFirstVideoFrameTime(mediaPlayer.getLongOption(77, -1L));
            this.mLogger.setDecodeFirstAudioFrameTime(mediaPlayer.getLongOption(78, -1L));
            this.mLogger.setPlayerHostAddr(mediaPlayer.getStringOption(71));
            this.mLogger.deviceStartTime(1, mediaPlayer.getLongOption(156, -1L));
            this.mLogger.deviceStartTime(0, mediaPlayer.getLongOption(155, -1L));
            this.mLogger.devicedOpenedTime(1, mediaPlayer.getLongOption(163, -1L));
            this.mLogger.devicedOpenedTime(0, mediaPlayer.getLongOption(162, -1L));
            long longOption2 = mediaPlayer.getLongOption(210, -1L);
            this.mLogger.setFirstPlayerFirstFrameTime(longOption2);
            if (longOption > 0) {
                this.mLogger.setDNSEndTime(longOption);
            }
            long longOption3 = mediaPlayer.getLongOption(622, -1L);
            if (longOption3 > 0) {
                this.mLogger.setDNSStartTime(longOption3, 1);
            }
            long longOption4 = mediaPlayer.getLongOption(623, -1L);
            if (longOption4 > 0) {
                this.mLogger.setLongOption(66, longOption4);
            }
            this.mLogger.setLongOption(67, mediaPlayer.getLongOption(620, -1L));
            this.mLogger.setLongOption(68, mediaPlayer.getLongOption(624, -1L));
            this.mLogger.setLongOption(78, mediaPlayer.getLongOption(621, -1L));
            this.mLogger.setLongOption(69, mediaPlayer.getLongOption(625, -1L));
            this.mLogger.setLongOption(70, mediaPlayer.getLongOption(626, -1L));
            this.mLogger.setLongOption(71, mediaPlayer.getLongOption(627, -1L));
            this.mLogger.setLongOption(72, mediaPlayer.getLongOption(629, -1L));
            this.mLogger.setLongOption(73, mediaPlayer.getLongOption(631, -1L));
            this.mLogger.setLongOption(74, mediaPlayer.getLongOption(630, -1L));
            this.mLogger.setLongOption(75, mediaPlayer.getLongOption(632, -1L));
            this.mLogger.setLongOption(76, longOption2);
            this.mLogger.setLongOption(77, mediaPlayer.getLongOption(628, -1L));
            this.mLogger.setLongOption(87, mediaPlayer.getLongOption(822, -1L));
            this.mLogger.setLongOption(88, mediaPlayer.getLongOption(307, -1L));
            this.mLogger.setLongOption(120, mediaPlayer.getLongOption(583, -1L));
            this.mLogger.setLongOption(121, mediaPlayer.getLongOption(588, -1L));
            this.mLogger.setLongOption(122, mediaPlayer.getLongOption(584, -1L));
            this.mLogger.setLongOption(123, mediaPlayer.getLongOption(589, -1L));
            this.mLogger.setLongOption(124, mediaPlayer.getLongOption(585, -1L));
            this.mLogger.setLongOption(125, mediaPlayer.getLongOption(590, -1L));
        }
    }

    private void _updateLogger() {
        int i;
        float f;
        float f2;
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            String str = "";
            int i2 = -1;
            if (mediaPlayer != null) {
                iVideoEventLogger.curVideoOutputFps(mediaPlayer.getFloatOption(150, -1.0f));
                this.mLogger.containerFps(mediaPlayer.getFloatOption(151, -1.0f));
                this.mLogger.curVideoDecoderFps(mediaPlayer.getIntOption(186, -1));
                this.mLogger.clockDiff(mediaPlayer.getLongOption(152, -1L));
                this.mLogger.dropCount(mediaPlayer.getIntOption(153, -1));
                this.mLogger.enableSharp(mediaPlayer.getIntOption(189, -1));
                this.mLogger.curVideoDecodeError(mediaPlayer.getIntOption(221, -1));
                this.mLogger.curAudioDecodeError(mediaPlayer.getIntOption(222, -1));
                this.mLogger.curVideoRenderError(mediaPlayer.getIntOption(245, -1));
                if (this.mHardwareDecodeEnablePlayer2 > 0) {
                    this.mLogger.hwCodecName(mediaPlayer.getStringOption(187));
                    this.mLogger.hwCodecException(mediaPlayer.getIntOption(188, -1));
                }
                if (this.mPlaybackState != 0) {
                    this.mLogger.setAudioBufferLength(mediaPlayer.getLongOption(73, -1L));
                    this.mLogger.setVideoBufferLength(mediaPlayer.getLongOption(72, -1L));
                }
                this.mLogger.setTextureRenderError(this.mTextureRenderErrorMsg);
                this.mLogger.setLongOption(21, mediaPlayer.getLongOption(171, -1L));
                this.mLogger.setLongOption(56, mediaPlayer.getLongOption(468, -1L));
                this.mLogger.setLongOption(82, mediaPlayer.getLongOption(850, -1L));
                this.mLogger.setLongOption(84, mediaPlayer.getLongOption(851, -1L));
                this.mLogger.setLongOption(85, mediaPlayer.getLongOption(852, -1L));
                int intOption = mediaPlayer.getIntOption(62, -1);
                int intOption2 = mediaPlayer.getIntOption(61, -1);
                if (intOption == 0) {
                    this.mLogger.setIntOption(12, 1);
                } else {
                    this.mLogger.setIntOption(12, 0);
                }
                if (intOption2 == 0) {
                    this.mLogger.setIntOption(13, 1);
                } else {
                    this.mLogger.setIntOption(13, 0);
                }
                this.mLogger.setIntOption(89, mediaPlayer.getIntOption(912, -1));
                _updateLogTime();
                HashMap hashMap = new HashMap();
                hashMap.put("abrv", this.mAbrVer);
                if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                    this.mNetVer = StrategyCenter.sNetAbrSpeedPredictor.c();
                }
                hashMap.put("netv", this.mNetVer);
                hashMap.put("used", Integer.valueOf(this.mABRUsed ? 1 : 0));
                hashMap.put("pcnt", Integer.valueOf(mediaPlayer.getIntOption(179, 0)));
                hashMap.put("scnt", Integer.valueOf(mediaPlayer.getIntOption(173, 0)));
                hashMap.put("apbr", Integer.valueOf(mediaPlayer.getIntOption(174, 0)));
                hashMap.put("apsp", Float.valueOf(mediaPlayer.getFloatOption(175, 0.0f)));
                hashMap.put("adbr", Integer.valueOf(mediaPlayer.getIntOption(610, 0)));
                TTTestSpeedListener tTTestSpeedListener = this.mTTSpeedListener;
                if (tTTestSpeedListener == null) {
                    f = 0.0f;
                } else {
                    f = tTTestSpeedListener.mAverageDownloadSpeed;
                }
                hashMap.put("npad", Float.valueOf(f));
                TTTestSpeedListener tTTestSpeedListener2 = this.mTTSpeedListener;
                if (tTTestSpeedListener2 == null) {
                    f2 = 0.0f;
                } else {
                    f2 = tTTestSpeedListener2.mAveragePredictSpeed;
                }
                hashMap.put("npap", Float.valueOf(f2));
                hashMap.put("adob", Integer.valueOf(mediaPlayer.getIntOption(615, 0)));
                hashMap.put("aplb", Integer.valueOf(mediaPlayer.getIntOption(614, 0)));
                hashMap.put("avbl", Float.valueOf(mediaPlayer.getFloatOption(TTVideoEngineInterface.PLAYER_OPTION_ENABLE_PLAYER_DEGRADE, 0.0f)));
                hashMap.put("iast", Integer.valueOf(this.mStandAlongAbrStartUp));
                hashMap.put("acsm", Integer.valueOf(this.mStartupSwitchCSModel));
                hashMap.put("stbr", Long.valueOf(this.mStartUpBitrate));
                hashMap.put("uebr", Long.valueOf(this.mUserExpectedBitrate));
                hashMap.put("stre", this.mStartUpResolution);
                hashMap.put("dgbt", Long.valueOf(this.mDowngradeBitrate));
                this.mLogger.setAbrInfo(hashMap);
                if (this.mABRUsed || this.mStandAlongAbrStartUp > 0 || getConfigInt(583, this.mGearStrategyEnabled) > 0) {
                    HashMap hashMap2 = new HashMap();
                    hashMap2.put("adtp", Integer.valueOf(TTVideoEngine.sABRAlgorithmType));
                    hashMap2.put("sptp", Integer.valueOf(TTVideoEngine.sNetSpeedAbrPredictType));
                    hashMap2.put("astp", Integer.valueOf(this.mStartupModel));
                    hashMap2.put("mcbr", Long.valueOf(this.mMaxCacheBitrate));
                    hashMap2.put("stsp", Float.valueOf(this.mAbrStartUpSpeed));
                    hashMap2.put("spsp", Float.valueOf(this.mAbrStartUpPredictSpeed));
                    hashMap2.put("sasp", Float.valueOf(this.mAbrStartUpAverageSpeed));
                    hashMap2.put("stfs", Long.valueOf(this.mAbrStartupBitrateBeforeFitScreen));
                    hashMap2.put("suqs", Float.valueOf(this.mAbrUserQualitySensitivity));
                    hashMap2.put("suef", Integer.valueOf(this.mAbrUserEnterFullScreen));
                    hashMap2.put("srif", this.mAbrSrInfo);
                    hashMap2.put("stif", this.mAbrStartupInfo);
                    i iVar = this.mABRModule;
                    if (iVar != null) {
                        hashMap2.put("abif", iVar.b(81, ""));
                    }
                    ArrayList arrayList = new ArrayList();
                    IVideoModel iVideoModel = this.mVideoModel;
                    if (iVideoModel != null) {
                        List<VideoInfo> videoInfoList = iVideoModel.getVideoInfoList();
                        if (videoInfoList == null) {
                            videoInfoList = Collections.emptyList();
                        }
                        for (VideoInfo videoInfo : videoInfoList) {
                            if (videoInfo != null) {
                                HashMap hashMap3 = new HashMap();
                                hashMap3.put("br", Integer.valueOf(videoInfo.getValueInt(3)));
                                String valueStr = videoInfo.getValueStr(32);
                                if (!TextUtils.isEmpty(valueStr)) {
                                    hashMap3.put("def", valueStr);
                                } else {
                                    hashMap3.put("def", _resolutionToString(videoInfo.getResolution()));
                                }
                                arrayList.add(hashMap3);
                            }
                        }
                    }
                    if (arrayList.size() > 0) {
                        hashMap2.put("brs", arrayList.toArray());
                    }
                    this.mLogger.setAbrGeneralInfo(hashMap2);
                }
            }
            this.mLogger.setIntOption(11, this.mRadioModeEnable);
            this.mLogger.setIntOption(79, isplaybackUsedSR() ? 1 : 0);
            this.mLogger.setIntOption(80, this.mReadCacheMode);
            this.mLogger.setIntOption(81, this.mAutoRangeOffset);
            this.mLogger.setIntOption(133, this.mEnableSRStrategy ? 1 : 0);
            SRStrategy sRStrategy = this.mSRStrategy;
            sRStrategy.setStrategyInfo("ss", Integer.valueOf(sRStrategy.getSRStatus()));
            this.mSRStrategy.setStrategyInfo("ess", Integer.valueOf(this.mEnableSRStrategy ? 1 : 0));
            this.mSRStrategy.setStrategyInfo("eas", Integer.valueOf(getConfigInt(571, this.mABRWithSR)));
            SRStrategy sRStrategy2 = this.mSRStrategy;
            Resolution resolution = this.currentResolution;
            if (resolution != null) {
                i = resolution.getIndex();
            } else {
                i = -1;
            }
            sRStrategy2.setStrategyInfo("cr", Integer.valueOf(i));
            SRStrategy sRStrategy3 = this.mSRStrategy;
            String str2 = this.mCurrentQualityDesc;
            if (str2 == null) {
                str2 = "";
            }
            sRStrategy3.setStrategyInfo("cqd", str2);
            SRStrategy sRStrategy4 = this.mSRStrategy;
            Resolution resolution2 = this.mResolutionBeforeDowngrade;
            if (resolution2 != null) {
                i2 = resolution2.getIndex();
            }
            sRStrategy4.setStrategyInfo("or", Integer.valueOf(i2));
            SRStrategy sRStrategy5 = this.mSRStrategy;
            String str3 = this.mQualityDescBeforeDowngrade;
            if (str3 != null) {
                str = str3;
            }
            sRStrategy5.setStrategyInfo("oqd", str);
            this.mLogger.setSRStrategyInfo(this.mSRStrategy);
            this.mLogger.setGearStrategyEvent(this.mGearStrategyEvent);
        }
        _updateEffectLog();
    }

    private void setMediaPlayerOptions2() {
        super.setMediaPlayerOptions();
        _configNativeRenderRotationAdapt();
        _configNativeYV12Render();
        this.mPlayerConfigExecutor.execute(this.mEngineConfig.getItemMap(), 0);
        this.mMediaPlayer.setIntOption(619, this.mCurrentSubId);
        this.mMediaPlayer.setIntOption(81, this.mEngineConfig.getIntOption(11));
        this.mMediaPlayer.setIntOption(110, this.mEngineConfig.getIntOption(202));
        this.mMediaPlayer.setIntOption(36, this.mLayoutType);
        this.mMediaPlayer.setIntOption(9, this.mNetworkTimeout * 1000000);
        this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_USE_PLAYER_SPADE, this.mUnsupportedSampleRatesInBinary);
        this.mMediaPlayer.setIntOption(79, this.mTestNetSpeed);
        this.mMediaPlayer.setIntOption(66, this.mTestNetSpeedDiff);
        this.mMediaPlayer.setIntOption(133, this.mDisableAccurateStart);
        int intOption = this.mEngineConfig.getIntOption(0);
        if (intOption != 0 && this.mCacheControlEnabled) {
            this.mMediaPlayer.setIntOption(24, intOption);
        }
        int renderType = EngineGlobalConfig.getInstance().getRenderType();
        if (renderType != -1) {
            this.mMediaPlayer.setIntOption(56, renderType);
            TTVideoEngineLog.i(logcatTag(), "set renderType from static context, renderType:" + renderType);
        } else {
            this.mMediaPlayer.setIntOption(56, this.mRenderType);
        }
        this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, this.mNotifyBufferingDirectly);
        if (EngineGlobalConfig.getInstance().getALogWriteAddr() > 0) {
            this.mMediaPlayer.setLongOption(231, EngineGlobalConfig.getInstance().getALogWriteAddr());
        }
        this.mMediaPlayer.setIntOption(223, this.mOutputLog);
        if (EngineGlobalConfig.getInstance().getOutputLogLevelPercise() >= 0) {
            this.mMediaPlayer.setIntOption(1501, EngineGlobalConfig.getInstance().getOutputLogLevelPercise());
            TTVideoEngineLog.d(logcatTag(), "set media Player percise loglever:" + EngineGlobalConfig.getInstance().getOutputLogLevelPercise());
        } else {
            this.mMediaPlayer.setIntOption(984, EngineGlobalConfig.getInstance().getOutputLogLevel());
            TTVideoEngineLog.d(logcatTag(), "set media Player loglever:" + EngineGlobalConfig.getInstance().getOutputLogLevel());
        }
        if (this.mAudioProcessor != null) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(this.mAudioProcessor);
        }
        for (Map.Entry<Integer, TraitObject> entry : this.mTraitObjManager.getAll().entrySet()) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setTraitObject(entry.getKey().intValue(), entry.getValue());
        }
        this.mMediaPlayer.setIntOption(48, this.mVoiceType);
        if (this.mHardwareDropNonRef > 0) {
            this.mMediaPlayer.setIntOption(252, this.mHardwareDropNonRef);
        }
        this.mMediaPlayer.setIntOption(149, this.mEnableOutletDropLimit ? 1 : 0);
        int enableCPPBYTEVC1CodecOpt = EngineGlobalConfig.getInstance().getEnableCPPBYTEVC1CodecOpt();
        if (enableCPPBYTEVC1CodecOpt > 0) {
            this.mMediaPlayer.setIntOption(580, enableCPPBYTEVC1CodecOpt);
        } else {
            this.mMediaPlayer.setIntOption(580, this.mEngineConfig.getIntOption(581));
        }
        if (this.mHardwareDecodeEnablePlayer2 == 1) {
            this.mMediaPlayer.setIntOption(254, this.mEngineConfig.getIntOption(333));
            this.mMediaPlayer.setIntOption(400, this.mEngineConfig.getIntOption(332));
            this.mMediaPlayer.setIntOption(90, this.mEngineConfig.getIntOption(120));
            this.mMediaPlayer.setIntOption(IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY, this.mEngineConfig.getIntOption(324));
            this.mMediaPlayer.setIntOption(216, this.mEngineConfig.getIntOption(323));
            if (this.mUseQcomVpp == 1) {
                this.mMediaPlayer.setIntOption(212, this.mUseQcomVpp);
                this.mMediaPlayer.setIntOption(213, this.mQcomVppLevel);
            }
            if (this.mEngineConfig.getIntOption(401) == 1) {
                this.mMediaPlayer.setIntOption(184, 1);
            }
            this.mMediaPlayer.setIntOption(279, this.mEngineConfig.getIntOption(485));
            if (this.mEngineConfig.getIntOption(339) == 1) {
                this.mMediaPlayer.setIntOption(280, this.mEngineConfig.getIntOption(339));
            }
            this.mMediaPlayer.setIntOption(401, this.mEngineConfig.getIntOption(488));
        }
        if (this.mHardwareDecodeEnablePlayer2 <= 0) {
            this.mMediaPlayer.setIntOption(4007, this.mEngineConfig.getIntOption(120));
        }
        int intOption2 = this.mEngineConfig.getIntOption(675);
        if (this.mVideoModel != null) {
            MediaPlayer mediaPlayer = this.mMediaPlayer;
            if (intOption2 == -1) {
                intOption2 = this.mVideoModel.getVideoRefInt(230);
            }
            mediaPlayer.setIntOption(662, intOption2);
        } else {
            this.mMediaPlayer.setIntOption(662, intOption2);
        }
        if (this.mEngineConfig.getIntOption(956) != -1) {
            this.mMediaPlayer.setIntOption(1003, this.mEngineConfig.getIntOption(956));
            for (int i = 0; i < this.mPrivCodecName.size(); i++) {
                this.mMediaPlayer.setStringOption(1002, this.mPrivCodecName.get(i));
            }
        }
        int intOption3 = this.mEngineConfig.getIntOption(650);
        if ((intOption3 == 2 || intOption3 == 4) && this.mTextureSurface != null) {
            this.mEngineConfig.setIntOption(620, 1);
            this.mEngineConfig.setIntOption(613, 1);
            this.mMediaPlayer.setIntOption(820, 1);
            this.mMediaPlayer.setIntOption(333, 1);
            if (intOption3 == 4) {
                this.mIsMute = true;
            }
        }
        this.mMediaPlayer.setIntOption(333, this.mEngineConfig.getIntOption(613));
        if (this.mMediaPlayer instanceof MediaPlayerWrapper) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setFrameMetadataListener(new MyFrameMetadataListener());
        }
        _setLoggerOptions2();
    }

    private void _setLoggerOptions2() {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger == null) {
            return;
        }
        iVideoEventLogger.setIntOption(97, this.mEnableOutletDropLimit ? 1 : 0);
        this.mLogger.setIntOption(93, this.mEngineConfig.getIntOption(564));
        this.mLogger.setIntOption(94, this.mEngineConfig.getIntOption(565));
        this.mLogger.setIntOption(55, this.mEngineConfig.getIntOption(543));
        this.mLogger.setIntOption(96, StrategyHelper.helper().isRunning() ? 1 : 0);
        int enableCPPBYTEVC1CodecOpt = EngineGlobalConfig.getInstance().getEnableCPPBYTEVC1CodecOpt();
        int intOption = this.mEngineConfig.getIntOption(581);
        if (intOption > 0 || enableCPPBYTEVC1CodecOpt > 0) {
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (intOption > 0) {
                enableCPPBYTEVC1CodecOpt = intOption;
            }
            iVideoEventLogger2.addFeature("bytevc1_decoder_opt", Integer.valueOf(enableCPPBYTEVC1CodecOpt));
        }
        if (this.mEngineConfig.getIntOption(371) > 0) {
            this.mLogger.addFeature("open_voice_early", Integer.valueOf(this.mEngineConfig.getIntOption(371)));
        }
        if (this.mEngineConfig.getIntOption(1300) > 0) {
            this.mLogger.addFeature("mask_delay_loading", Integer.valueOf(this.mEngineConfig.getIntOption(1300)));
        }
        if (this.mEngineConfig.getIntOption(1302) > 0) {
            this.mLogger.addFeature("mask_range_req", Integer.valueOf(this.mEngineConfig.getIntOption(1302)));
        }
        if (this.mEngineConfig.getIntOption(1215) > 0) {
            this.mLogger.addFeature("preload_gear", Integer.valueOf(this.mEngineConfig.getIntOption(1215)));
        }
        if (this.mEngineConfig.getIntOption(984) != 0) {
            this.mLogger.addFeature("pre_decode", 1);
        }
        if (this.mEngineConfig.getIntOption(981) > 0) {
            this.mLogger.addFeature("async_res", Integer.valueOf(this.mEngineConfig.getIntOption(981)));
        }
        if (this.mEngineConfig.getIntOption(983) > 0) {
            this.mLogger.addFeature("a_directbuf", Integer.valueOf(this.mEngineConfig.getIntOption(983)));
        }
        if (this.mEngineConfig.getIntOption(991) > 0) {
            this.mLogger.addFeature("auto_disconnect_cpu", Integer.valueOf(this.mEngineConfig.getIntOption(991)));
        }
        if (this.mEngineConfig.getIntOption(992) > 0) {
            this.mLogger.addFeature("v_2nd_frame", Integer.valueOf(this.mEngineConfig.getIntOption(992)));
        }
        if (this.mEngineConfig.getIntOption(993) > 0) {
            this.mLogger.addFeature("giveback_codec_early", Integer.valueOf(this.mEngineConfig.getIntOption(993)));
        }
        if (this.mEngineConfig.getIntOption(998) > 0) {
            this.mLogger.addFeature("query_adapt_playback", Integer.valueOf(this.mEngineConfig.getIntOption(998)));
        }
        if (this.mEngineConfig.getIntOption(1114) > 0) {
            this.mLogger.addFeature("codecpool_extend", Integer.valueOf(this.mEngineConfig.getIntOption(1114)));
        }
        if (this.mEngineConfig.getIntOption(1117) > 0) {
            this.mLogger.addFeature("opti_hwdec2swdec", Integer.valueOf(this.mEngineConfig.getIntOption(1117)));
        }
        if (this.mEngineConfig.getIntOption(977) > 0) {
            this.mLogger.addFeature("codec_surface_reuse", Integer.valueOf(this.mEngineConfig.getIntOption(977)));
        }
        if (this.mEngineConfig.getIntOption(850) > 0) {
            this.mLogger.addFeature("decoder_drop", 2);
        } else if (this.mEngineConfig.getIntOption(l.h) > 0) {
            this.mLogger.addFeature("decoder_drop", 1);
        }
        if (1 == this.mEngineConfig.getIntOption(861)) {
            this.mLogger.addFeature("hw_decoder_drop", 3);
        } else if (1 == this.mEngineConfig.getIntOption(854)) {
            this.mLogger.addFeature("hw_decoder_drop", 1);
        } else if (1 == this.mEngineConfig.getIntOption(855)) {
            this.mLogger.addFeature("hw_decoder_drop", 2);
        }
        if (this.mEngineConfig.getIntOption(214) > 0) {
            this.mLogger.addFeature("skip_audio_out", Integer.valueOf(this.mEngineConfig.getIntOption(214)));
        }
        if (this.mEngineConfig.getIntOption(MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME) > 0) {
            this.mLogger.addFeature("ai_barrage", Integer.valueOf(this.mEngineConfig.getIntOption(MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_FILENAME)));
        }
        if (this.mEngineConfig.getLongOption(709) > 0) {
            this.mLogger.addFeature("precise_pause", 1);
        }
        if (this.mEngineConfig.getIntOption(586) > 0) {
            this.mLogger.addFeature("pre_demux", 1);
        }
        if (this.mEngineConfig.getIntOption(561) > 0) {
            this.mLogger.addFeature("demux_nonblock_read", Integer.valueOf(this.mEngineConfig.getIntOption(561)));
        }
        if (this.mEngineConfig.getIntOption(705) > 0) {
            this.mLogger.addFeature("av_interlaced_check", Integer.valueOf(this.mEngineConfig.getIntOption(705)));
        }
        if (this.mEngineConfig.getIntOption(603) > 0) {
            this.mLogger.addFeature("clear_mdl_cache", Integer.valueOf(this.mEngineConfig.getIntOption(603)));
        }
        if (this.mEngineConfig.getIntOption(1400) > 0) {
            this.mLogger.addFeature("xHEAAC_audio_support", Integer.valueOf(this.mEngineConfig.getIntOption(1400)));
        }
        if (this.mEngineConfig.getIntOption(552) > 0) {
            this.mLogger.addFeature(" no_buffer_update", Integer.valueOf(this.mEngineConfig.getIntOption(552)));
        }
        if (this.mEngineConfig.getIntOption(953) > 0) {
            this.mLogger.addFeature("query_win", Integer.valueOf(this.mEngineConfig.getIntOption(953)));
        }
        if (this.mEngineConfig.getIntOption(955) > 0) {
            this.mLogger.addFeature("mediacodec_async", Integer.valueOf(this.mEngineConfig.getIntOption(955)));
        }
        if (this.mEngineConfig.getIntOption(587) == 1 && this.mEngineConfig.getIntOption(588) == 1) {
            this.mLogger.addFeature("force_disable_oes_render", 1);
        }
        if (this.mEngineConfig.getIntOption(591) > 0) {
            this.mLogger.addFeature("bytevc2_opt", 1);
        }
        if (this.mEngineConfig.getIntOption(683) > 0) {
            this.mLogger.addFeature("audiomem_intergration", 1);
        }
        if (this.mEngineConfig.getIntOption(685) > 0) {
            this.mLogger.addFeature("lower_buffering_capacity", 1);
        }
        if (this.mEngineConfig.getIntOption(686) > 0) {
            this.mLogger.addFeature("downgrade_asynccodec", 1);
        }
        if (this.mEngineConfig.getIntOption(687) > 0) {
            this.mLogger.addFeature("mediacodec_sync_clode", 1);
        }
        if (this.mEngineConfig.getIntOption(688) > 0) {
            this.mLogger.addFeature("seek_buffering", 1);
        }
        if (this.mEngineConfig.getIntOption(1100) > 0) {
            this.mLogger.addFeature("async_set_surface", 1);
        }
        if (this.mEngineConfig.getIntOption(0) > 0) {
            this.mLogger.addFeature("cache", Integer.valueOf(this.mEngineConfig.getIntOption(0)));
        }
        if (getConfigInt(42027, 0) > 0) {
            this.mLogger.addFeature("out_thread_optimize", 1);
        }
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null && iVideoModel.getVideoRefBool(253)) {
            this.mLogger.addFeature("mb_refactor", 1);
        }
    }

    @Override
    public void resetAllOptions() {
        this.mEngineConfig.reset();
        this.mPlayerCache = 0;
        this.mEnhancementType = 0;
        this.mScaleType = 0;
        this.mLayoutType = 0;
        this.mSettedKeys.clear();
        this.mCodecType = "h264";
        this.mRenderType = 3;
        this.mHardwareDecodeEnablePlayer2 = 0;
        this.mDecoderType = 0;
        this.mOpenVoiceEarly = 0;
        this.mBufferDataMiliSeconds = 0;
        this.mBufferTimeout = 30;
        this.mNetworkTimeout = 5;
        this.mTestAction = 0;
        this.mHlsEnabled = 0;
        this.mEncryptEnabled = 0;
        this.mDashEnabled = false;
        this.mBashEnabled = false;
        this.mHLSSeamlessSwitch = false;
        this.mEnableABR = 0;
        this.mStandAlongAbrStartUp = 0;
        this.mCleanSurfaceWhenReset = 0;
        this.mUseDNSCache = false;
        this.mDNSExpiredTime = 0;
        this.mDisableAccurateStart = 0;
        this.mP2PCDNType = 0;
        this.mForbidP2P = 0;
        this.mUseVideoModelCache = false;
        this.mVideoModelCache = null;
        this.mUseVideoModelCacheForce = false;
        this.mLoopStartTime = 0;
        this.mIsPreDecodeAutoPause = true;
        this.mLoopEndTime = 0;
        this.mLoopCount = 0;
        this.mReuseSocket = 0;
        this.mDataLoaderEnable = 0;
        this.mEnableOppoControl = 0;
        this.mIsUsePlayerDNS = -1;
        this.mEnableSharp = 0;
        this.mIsUseBoe = false;
        this.mEGLNeedWorkAround = 1;
        this.mOriginalRetry = 1;
        this.mLimitMDLCacheSize = 0;
        this.mTestNetSpeedDiff = 500;
        this.mMaxBufferDataMilliSeconds = 5000;
        this.mMovPreferNearestSample = 0;
        this.mSkipFfmpegFindStreamInfo = 0;
        this.mMaxFps = 0;
        this.mEnableDynamicFrameDropping = 0;
        this.mFrameDroppingMultiple = 10;
        this.mFrameDroppingCheckPeriod = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
        this.mFrameDroppingCheckCount = 3;
        this.mHWMaxFps = 0;
        this.mHWEnableDynamicFrameDropping = 0;
        this.mHWFrameDroppingMultiple = 10;
        this.mHWFrameDroppingCheckPeriod = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
        this.mHWFrameDroppingCheckCount = 3;
        this.mEnableHWDropFrameWhenVOIsInDropState = 0;
        this.mEnableHWDropFrameWhenAVOutSyncing = 0;
        this.mCodecFramesDrop = -1;
        this.mFrameDropNum = 2;
        this.mKsyFrameWait = 1;
        this.mLoopReferVideo = 0;
        this.mSkipAudioGraph = 0;
        this.mMediaCodecRender = 1;
        this.mUseMediacodecAudio = 0;
        this.mMediaCodecSyncMode = 0;
        this.mOutputLog = 0;
        this.mExposeSignal = 0;
        this.mNotifyBufferingDirectly = 0;
        this.mUseQcomLowLatency = 0;
        this.mMediaCodecSkipNonRef = 0;
        this.mAVSyncInterruptEnable = 0;
        this.mEnableVolumeBalance = 0;
        this.mBestResolutionType = 0;
        this.mDisablePlayerTimeOut = 0;
        this.mEnableSeekInterrupt = 0;
        this.mAllowedExpiredModel = false;
        this.mUseTextureRender = 0;
        this.mIsDisableShortSeek = 0;
        this.mEnableHttps = false;
        this.mCheckHijack = false;
        this.mAsyncPlayHitVMCache = false;
        this.mIsUseServerDns = false;
        TTPlayerConfiger.setValue(24, 24);
        this.mUseAudioHWDec = 0;
        this.mDefaultRenderType = 3;
        this.mSeekEndEnabled = 0;
        this.mDrmType = 0;
        this.mDrmDowngrade = 0;
        this.mDrmRetry = true;
        this.mDrmCloseRootCheck = 0;
        this.mSoloPlayEnable = 1;
        this.mTimeBarPercentage = 0;
        this.mEnableIndexCache = 0;
        this.mCacheJFrameField = 0;
        this.mEnableFragRange = 0;
        this.mRangeMode = 0;
        this.mLazySeek = 1;
        this.mFFCodecerHeaacV2Compat = 0;
        this.mReadMode = 0;
        this.mVideoRangeSize = 1048576;
        this.mAudioRangeSize = 409600;
        this.mVideoRangeTime = 5000;
        this.mAudioRangeTime = 10000;
        this.mHijackRetryMainDNSType = 2;
        this.mHijackRetryBackupDNSType = 0;
        this.mHijackRetry = true;
        this.mIsTTHlsDrm = 0;
        this.mABRSpeedPredictOutType = 0;
        this.mVoiceType = -1;
        this.mUseCodecPool = 0;
        this.mAccurateLayout = 0;
        this.mHardwareDropNonRef = 0;
        TTVideoEngineConfig.openPerformanceUtils = false;
        this.mFallbackApiRetry = 0;
        this.mEglVersion = 2;
        this.mNeedAdaptiveWorkaround = 0;
        this.mABRTimerIntervalMilliseconds = 500;
        this.mABRSwitchMode = 0;
        this.mABRSwitchSensitivity = 0;
        this.mABRSwitchCSModel = 1;
        this.mABROnceType = 0;
        this.mABRStartupSpeedType = 4;
        this.mABRStartupModel = 0;
        this.mABRWithSR = 0;
        this.mABRFixedLevel = 2;
        this.mABR4GMaxResolutionIndex = Resolution.Undefine.getIndex();
        this.mDowngradeResolutionIndex = Resolution.Undefine.getIndex();
        this.mWifiDefaultResolutionIndex = Resolution.SuperHigh.getIndex();
        this.mABR4GMaxResolutionMode = 0;
        this.mStartupMaxBitRateIndex = Resolution.SuperHigh.getIndex();
        this.mABRProbeMode = 0;
        this.mABREnableAggressivePortraitLowBit = 0;
        this.mScreenWidth = -1;
        this.mScreenHeight = -1;
        this.mPlayerViewWidth = -1;
        this.mPlayerViewHeight = -1;
        this.mEnableAsync = 0;
        this.mRadioModeEnable = 0;
        this.mDelayBufferingUpdate = 0;
        this.mPostPrepare = 0;
        this.mStopSourceAsync = 0;
        this.mDisableHWDecSeamless = 0;
        this.mDisableMcReuse = 0;
        this.mFirstRangeSize = 0;
        this.mFirstFrameSecOffset = 0.0f;
        this.mNetSpeedLevel = -1;
        this.mEnableVideoCodecPixelAlign = 0;
        this.mSegmentFormatFlag = 2;
        this.mEnableDirectUrlCheck = 0;
        this.mCodecFrcLevel = 0;
        this.mPrepareCacheMs = 1000;
        this.mUseFallbackAPI = true;
        this.mDirectUrlBashEnabled = false;
        this.mUpdateTimestampMode = 1;
        this.mEnableOpenTimeout = 1;
        this.mEnableBarrageMask = 0;
        this.mEnableAIBarrage = 0;
        this.mEnableMaskThread = 0;
        this.mEnableAIBarrageThread = 0;
        this.mEnableCacheTimeStamp = 0;
        this.mEnableSub = 0;
        this.mEnableOptSubLoadTime = 0;
        this.mMaskDelayLoading = 0;
        this.mMaskRangeOpt = 0;
        this.mMaskHeaderLen = 0;
        this.mMaskEnableDataloader = 0;
        this.mEnableSubThread = 0;
        this.mThreadSafeRefSwitcher = 0;
        this.mOpenSubRetryTimes = -1;
        this.mEnableOptSubSearch = 0;
        this.mEnableRecreateSubIfDetached = 0;
        this.mSeekExact = 0;
        this.mKeepFormatThreadAlive = 0;
        this.mAEType = 0;
        this.mSkipBufferTimeout = 0;
        this.mLiveStartIndex = -3;
        this.mEnableRefreshByTime = 0;
        this.mCurrentSubId = 0;
        this.mEnableFlushSeek = 0;
        this.mSpeedXDrop = 0;
        this.mUseServerDecodingMode = false;
        this.mEnableSpeedReport = false;
        TTVideoEngine.sReportSpeedInfoMaxWindowSize = 100;
        this.mEnableClearMDLCache = 0;
        this.mClearShutDown = false;
        this.mPosUpdateInterval = 0;
        this.mEnableLoadControlBufferingTimeout = 0;
        this.mFindStreamInfoProbeSize = 5000000;
        this.mFindStreamInfoProbDuration = 0;
        this.mNetworkReconnectCount = 0;
        this.mDummyAudioSleep = 1;
        this.mDisablePlayerStayAwake = 0;
        this.mEnableVideoFrameMetaCallback = 0;
        this.mNoAVSync = 0;
        this.mOverlayMode = 0;
        this.mRenderHDR2SDR = 0;
        this.mSyncUpdateSurface = 0;
        this.mEnableHeartBeat = false;
        this.mHeartBeatInterval = IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST;
        this.mEnableNativeYV12Render = 0;
        this.mForceCloseCodec = 0;
        this.mFilePlayNoBuffering = 0;
        this.mNoBufferUpdate = 0;
        this.mClipHEAACV2FirstPtsPacket = 0;
        this.mWaitForFetchInfoResult = true;
        this.mGetPositionSkipLooper = false;
        this.mFirstFrameOpenTexture = 0;
        this.mEnableDebugUINotify = 0;
        this.mSendEngineMsgTimeout = 0L;
        this.mGetMasterClockByPts = 0;
        this.mAlwaysDoAVSync = 0;
        this.mResumeFileIOBlockThresMs = 0;
        this.mSurfaceHolderByKernel = 0;
        this.mMediacodecStopTimeout = 0;
        this.mEnableFastStop = 0;
        this.mEnableCodecRecycle = 0;
        this.mEnableVideoTimestampMonotonic = 0;
        this.mFeedPacketUntilEmpty = 0;
        this.mEnableDemuxNonBlockRead = 0;
        this.mEnableFallbackSWDec = 1;
        this.mEnableThreadPriority = 0;
        this.mThreadPriorityValue = 0;
        this.mEnableVodVideoRenderStall = 0;
        this.mRenderStallThreshold = 0;
        this.mEnableOptInaccurateStart = 0;
        this.mEnableOptSeekClk = 0;
        this.mEnableAudioTrackSmoothClock = 0;
        this.mDisableSpiltVoiceWrite = 0;
        this.mNativeRenderRotationAdapt = 0;
        this.mIgnoreAudioRenderEOSDelayMs = 0;
        this.mIgnoreDirectlyBuffering = 0;
        this.mDynamicThreadPriorityValue = 0;
        this.mAudioStreamType = -2;
        this.mAudioChannelType = 0;
        this.mAudioTrackSessionId = -1;
        this.mEnableOutletDropLimit = false;
        this.mEnableMediaCodecRealtime = 1;
        this.mQueryWinEnable = -1;
        this.mPreferNearestMaxPosOffset = -1;
        this.mMediaCodecAsyncModeEnable = -1;
        this.mSettingCodecName = -1;
        this.mAVsyncRefined = -1;
        this.mOnlyPlayAudioForBothStream = -1;
        this.mCodecAndSurfaceReuse = -1;
        this.mMCMaxWidth = -1;
        this.mMCMaxHeight = -1;
        this.mIgnoreSurfaceCreated = -1;
        this.mForbidBufferingNotFinished = -1;
        this.mAudioInfoId = -1;
        this.mPreciseCache = 0;
        this.mEnableClockResumeResetEof = 0;
        this.mMdlEnableSeekReopen = 0;
        this.mSkipStartWhenPrepared = false;
        this.mNativeCallAbr = 0;
        this.mEnablePreRenderBufferingUpdate = 0;
        this.mPreRenderBufferingUpdatePercentage = 0;
        this.mGearStrategyEnabled = 0;
        this.mQuickGetFileCache = false;
        this.mEnableHEAACV2PtsMSCorrection = 0;
        this.mEnableVC1BlockList = 1;
        this.mEnableHChipAdaptiveWorkAround = 0;
        this.mEnableMChipSkipAdaptiveWorkAround = 0;
        this.mEnableCPPBYTEVC1CodecOpt = 0;
        this.mEnableMp4Check = 0;
        this.mEnableDeinterlace = 0;
        this.mReportFirstFrameFrameBufferOnly = 0;
        this.mEnableTextureRenderNoRenderCheck = 0;
        this.mSupportPlayWhenNoSurface = 0;
        this.mEnableGetPlayerReqOffset = 1;
        this.mExoRenderReadyMs = -1;
        this.mExoConsecutiveFailNum = -1;
        this.mExoCodecReusable = 0;
        this.mExoCodecAsyncInitEnable = 0;
        this.mExoAllowMediaCodecHelper = 0;
        this.mEnableTmpLog = 0;
        this.mEnbalePreDemux = 0;
        this.mEnableForceDisableOESRender = false;
        this.mForceDisableOESRender = false;
        this.mStopCloseIO = 0;
        this.mEnableCPPBYTEVC2CodecOpt = 0;
        this.mEnableAudioMemIntergration = 0;
        this.mEnableBufferingLowerCapacity = 0;
        this.mAutoAddMedia = 1;
        this.mForbidOSPlayer = 0;
        this.mIsStartPlayAutomatically = true;
        this.mCleanWhenStop = 0;
        this.mMaxAccumulatedCountSetByUser = 30;
        this.mSetTrackVolume = 0;
        this.mDisableResetSystemVolume = 0;
        this.mFallbackExoFirst = -1;
        this.mPrecisePausePts = 0L;
        this.mSubHostName = "";
        this.mSubLanIds = "";
        this.mSubIds = "";
        this.mSubFormat = "";
        this.mABR4GMaxResolutionQuality = null;
        this.mDowngradeResolutionQuality = null;
        this.mWifiDefaultResolutionQuality = null;
        this.mStartupMaxBitRateQuality = null;
        this.mClassLoaderState = null;
        this.mCheckInfoString = null;
        this.mPrivCodecName.clear();
        this.mCodecType = "h264";
        this.mExoLoadControlParameters = null;
        this.mEnableSetPlayInfoToP2P = 1;
        this.mUseVdpDisk = -1;
        this.mTestNetSpeed = -1;
        this.mEnableNetLevel = 0;
        this.mTestNetSpeedListener = null;
        this.mTTSpeedListener = null;
        this.mHttpsEnabled = false;
        this.mIsDashSource = false;
        this.mHasSetHardWare = false;
        this.mHasSetAESrcLoudness = false;
        this.mHasSetAESrcPeak = false;
        this.mHasSetAEVolumeInfo = false;
        this.mAEForbidCompressor = false;
        this.mRotation = 0;
        this.mIsMirrorHorizontal = false;
        this.mIsMirrorVertical = false;
        this.mForbidByteVC1SoftwareDecode = 1;
        this.mPlayAPIVersion = 0;
        this.mAuthorization = "";
        this.mSubAuthToken = "";
        this.mUseQcomVpp = 0;
        this.mQcomVppLevel = -1;
        this.mAEPreGain = 0.25f;
        this.mAEThreshold = -18.0f;
        this.mAERatio = 8.0f;
        this.mAEPredelay = 0.007f;
        this.mSrcLoudness = 0.0f;
        this.mSrcPeak = 0.0f;
        this.mTarLoudness = 0.0f;
        this.mReleaseTime = 200.0f;
        this.mLookAheadTime = 3.0f;
        this.mSpeedXDropFPSLimit = 50.0f;
        this.mEnableTextureRenderNoRenderCheck = 0;
        this.mVideoID = null;
        this.mHaveSetSpeedTest = false;
        this.mPlayType = 0;
        this.mHeaders.clear();
        this.mNetClient = null;
        this.mDataSource = null;
        this.mSubDesInfoModel = null;
        this.mListenerCompact = new ListenerCompact();
        this.mMaskInfoListener = null;
        this.mAIBarrageInfoListener = null;
        this.mSubInfoListener = null;
        this.mSubInfoCallBack = null;
        this.mVideoInfoListener = null;
        this.mVideoEngineInfoListener = null;
        this.mCacheFilePathListener = null;
        this.mExternVideoLoggerListener = null;
        this.mPlayerEventListener = null;
        this.mVideoEngineGetInfoListener = null;
        this.mExternLogKey = null;
        synchronized (this.mExtraSurfaceQueue) {
            this.mExtraSurfaceQueue.clear();
        }
        this.mSurfaceCallback = null;
        this.mVideoModel = null;
        this.mKeyseed = null;
        this.mFallbackAPI = null;
        this.mVideoModelVersion = 0;
        this.mLogger.reset();
        this.mFetcher = null;
        DNSParser dNSParser = this.mDNSParser;
        if (dNSParser != null) {
            dNSParser.setCompletionListener(null);
            this.mDNSParser = null;
        }
        SubInfoFetcher subInfoFetcher = this.mSubFetcher;
        if (subInfoFetcher != null) {
            subInfoFetcher.setListener(null);
            this.mSubFetcher = null;
        }
        this.mPlayStartTime = -1L;
        this.mRenderStartTime = -1L;
        this.currentBitrate = -1L;
        this.currentResolution = Resolution.Standard;
        this.expectedResolution = Resolution.Auto;
        this.lastResolution = Resolution.Undefine;
        this.mLastSwitchResolutionTime = 0L;
        this.currentVideoInfo = null;
        this.mDynamicAudioInfo = null;
        this.mDynamicVideoInfo = null;
        this.mURLs = null;
        this.urlIndexMap.clear();
        this.urlIPMap.clear();
        this.dashVideoUrlMap.clear();
        this.dashAudioUrlMap.clear();
        this.currentHost = "";
        this.mAPIString = null;
        this.mSeamSwitchingResolution = false;
        this.mResolutionSwitching = false;
        this.mResolutionSwitchingStartTime = 0L;
        this.mHasFetchedSubtitle = false;
        this.mHasAudioFirstFrameShown = false;
        this.mStartTime = 0;
        this.mFileKey = null;
        this.mDecryptionKey = "";
        this.mSpadea = "";
        this.mTokenUrlTemplate = "";
        this.mGroupID = "";
        this.mIsPreloaderItem = false;
        this.mPreloaderItem = null;
        this.mIsFeedInfo = false;
        this.mIsPlayItem = false;
        this.mPlayItem = null;
        this.mFirstURL = true;
        this.mFirstHost = true;
        this.mFirstIP = true;
        this.mFirstQuality = true;
        this.mFirstQualityType = true;
        this.mFirstResolution = true;
        this.mCacheControlEnabled = false;
        this.mIsPrepareDecodeOnly = false;
        this.mOSPlayerIgnoreHeaders = false;
        this.mUnsupportedSampleRatesInBinary = 0;
        this.mBufferingStartT = 0L;
        this.mPauseStartT = 0L;
        this.mPlayFd = null;
        this.mPipeOffset = 0L;
        this.mPipeLength = 0L;
        this.mMediaDataSource = null;
        this.mVideoModelCache = null;
        this.mIsFetchingInfo = false;
        this.mResolutionMap = null;
        this.mUsingDataLoaderPlayTaskKeys.clear();
        this.mUsingDataLoaderPlayFilePaths.clear();
        this.mUsingDataLoaderPlayRawKey = null;
        this.mAudioProcessor = null;
        this.mTraitObjManager.removeAll();
        this.mTextureFirstFrame = false;
        this.mPlayerFirstFrame = false;
        this.mTextureRenderErrorMsg = null;
        this.mDecodedVideoFirstFrame = false;
        this.mTextureSrOpen = 0;
        this.mOldTextureAlgType = -1;
        this.mTextureAlgType = -1;
        this.mTextureSRBinPath = null;
        this.mTextureSROclModuleName = null;
        this.mTextureSRDspModuleName = null;
        this.mMaxTextureWidth = 0;
        this.mMaxTextureHeight = 0;
        this.mLensBundle = null;
        this.mPlayBackUsedSR = false;
        this.mTRSrategy.reset(this.mTextureSurface, this.mHasFirstFrameShown);
        this.mUseSRTexture = false;
        this.mSRIgnoreRes = false;
        this.mAsyncInitSR = false;
        this.mAsyncInitEffect = false;
        this.mDynamicControlSR = false;
        this.mSRStrategy = new SRStrategy();
        this.mOverlayMode = 0;
        this.mEffectBundle.clear();
        this.mEnableSRStrategy = false;
        this.currentParams = null;
        this.expectedParams = null;
        this.mCurrentQuality = "";
        this.mCurrentQualityDesc = "";
        this.mCurrentQualityType = 0;
        this.mHandler = null;
        this.mRetryEnableHttps = false;
        this.mHijackRetryCount = 0;
        this.mCheckInfoString = null;
        this.mShouldUseAudioRenderStart = false;
        this.mLastSetSurfaceNullTime = 0L;
        this.mSetValidSurfaceTimeout = 0;
        this.mLoadControlInterface = null;
        this.mMaskInfoInterface = null;
        this.mAIBarrageInfoInterface = null;
        this.mSubInfoInterface = null;
        this.mVVTime = 0L;
        this.mVideoPreloadSize = 0L;
        this.mURLInfo = new URLInfo();
        this.mTTHlsDrmToken = "";
        this.mAsyncPlayer = null;
        this.mStartupSwitchCSModel = -1;
        this.mStartupModel = -1;
        this.mStartUpBitrate = -1L;
        this.mPredictStartBitrate = -1L;
        this.mUserExpectedBitrate = -1L;
        this.mDowngradeBitrate = -1L;
        this.mMaxCacheBitrate = -1L;
        this.mAbrStartupBitrateBeforeFitScreen = -1L;
        this.mAbrStartUpSpeed = -1.0f;
        this.mAbrStartUpPredictSpeed = -1.0f;
        this.mAbrStartUpAverageSpeed = -1.0f;
        this.mAbrUserQualitySensitivity = -1.0f;
        this.mAbrUserEnterFullScreen = -1;
        this.mAbrVer = null;
        this.mNetVer = null;
        this.mStartUpResolution = "";
        this.mAbrSrInfo = "";
        this.mAbrStartupInfo = "";
        this.mGearStrategyEnabled = 0;
        this.mGearStrategyConfig = new GearStrategyConfig();
        this.mSpeedShiftConfig = null;
        this.mABRModule = null;
        this.mPlayStartTimestamp = 0L;
        this.mABRCurrentDownloadedAudioBitrate = 0;
        this.mABRStartupBandwidthParameter = 0.9f;
        this.mABRStallPenaltyParameter = 9.0f;
        this.mABRSwitchPenaltyParameter = 2.0f;
        this.mABRBandwidthParameter = 1.0f;
        this.mNetworkSpeedReportSamplingRate = 0.0f;
        this.mEnableDowngradeAsyncCodec = 0;
        this.mEnableMediaCodecSyncClose = 0;
        this.mEnableSeekBuffering = 0;
        this.mBytevc2NalsizeCheck = 0;
        this.mHardwareCodecerFlushClose = 0;
        this.mOptAudioRenderTimeReport = 0;
        this.mBT601CloseCodecAsync = 0;
        this.mForbidFallbackNativeRender = 0;
        this.mDecoderRenderContinueRetry = 0;
        this.mDecoderRenderClearSurface = 0;
        this.mDecoderRenderClearTextureRenderRef = 0;
        this.mTraceId = "";
        this.mVC2DecodecLowLatency = 0;
        this.mVC2WppMode = 0;
        this.mVC2DynamicControl = 0;
        this.mAudioPtsMSCorrectionExtension = 0;
        this.mFetchWithAbilityOption = false;
        this.mLowerAudioMemCapacity = 0;
        this.mVC2ThreadNum = 4;
        this.mEnableLooperThread = false;
        this.mBashDashDefaultMDLKeys.clear();
        this.mBarrageMaskUrl = null;
        this.mAIBarrageUrl = null;
        this.mMaskFileHash = null;
        this.mSubPathInfo = null;
        this.mFileHashs.clear();
        this.mReadCacheMode = 0;
        this.mAutoRangeOffset = 0;
        this.mDangerBufferThreshold = 0;
        this.mSecureBufferThreshold = 0;
        this.mCurPosition = -1;
        this.mAudioCodecProfile = -1;
        this.mVideoCodecProfile = -1;
        this.mBitrate = -1L;
        this.mContainerFPS = 0.0f;
        this.mIntertrustDrmHelper = null;
        this.mFrameCount = 0;
        this.mHeartBeatStarted = false;
        this.mPlayDurationExcludePlayerMethod = false;
        this.mSRNotUseReason = 0;
        this.mMDLFetcherListener = null;
        this.mFFmpegProtocol = null;
        this.mForceCodec = null;
        this.mHlsSubDemuxerProbeType = -1;
        this.mAsyncManageResource = -1;
        this.mAudioUseDirectBuffer = -1;
        this.mCloseCodecPool = -1;
        this.mMaxCodecNumsInPool = -1;
        this.mDummySurfaceForbid = -1;
        this.mEnableOptimizeMp4Abr = 0;
        this.mEnableMediaCodecFairMutex = 0;
        this.mEnableRangeOptimize = 0;
        this.mThreadName2CharSuffix = 0;
        this.mEnableOptimizePrerender = 0;
        this.mEnableAsyncDownload = 0;
        this.mEnablePreloadGear = 0;
        this.mEnableAsyncProbe = 0;
        this.mEnableOptimizeAsyncDownload = 0;
        this.mEnableCacheInfo = 0;
        this.mEnableOptimizeRadioMode = 0;
        this.mEnableOptimizeIO = 0;
        this.mEnableOptimizeDashSeek = 0;
        this.mAnRenderRefreshSurface = 0;
        this.mBashRetryRestartPlayer = false;
        this.mDisplayMode = new DisplayMode();
        this.mEnableReportFirstAVSyncFrame = 1;
        this.mEnableReportPreloadTraceId = false;
        super.resetAllOptions();
        this.effectTypeSet = new CopyOnWriteArraySet();
        this.mErrorThrowOptEnable = false;
    }

    void _setPlayerMute(boolean z) {
        super.setIsMute(z);
    }

    @Override
    public boolean getLooping(boolean z) {
        return this.mLooping;
    }

    public void lambda$setSubDesInfoModel$3$TTVideoEngineImpl(SubDesInfoModelProvider subDesInfoModelProvider) {
        this.mSubDesInfoModel = subDesInfoModelProvider;
    }

    @Override
    protected void notifyError(Error error) {
        _notifyError(error);
    }

    @Override
    public void setCacheControlEnabled(boolean z) {
        this.mCacheControlEnabled = z;
    }

    @Override
    public void setCacheFilePathListener(CacheFilePathListener cacheFilePathListener) {
        this.mCacheFilePathListener = cacheFilePathListener;
    }

    @Override
    public void setDataSource(DataSource dataSource) {
        this.mDataSource = dataSource;
    }

    @Override
    public void setFFmpegProtocolObject(TTVideoEngineFFmpegProtocol tTVideoEngineFFmpegProtocol) {
        this.mFFmpegProtocol = tTVideoEngineFFmpegProtocol;
    }

    @Override
    public void setGroupID(String str) {
        this.mGroupID = str;
    }

    @Override
    public void setLensParams(Bundle bundle) {
        this.mLensBundle = bundle;
    }

    @Override
    public void setLoadControl(LoadControl loadControl) {
        this.mLoadControlInterface = loadControl;
    }

    @Override
    public void setNetworkClient(TTVNetClient tTVNetClient) {
        this.mNetClient = tTVNetClient;
    }

    @Override
    public void setPlayerEventListener(PlayerEventSimpleListener playerEventSimpleListener) {
        this.mPlayerEventListener = playerEventSimpleListener;
    }

    @Override
    public void setTTHlsDrmToken(String str) {
        this.mTTHlsDrmToken = str;
    }

    @Override
    public void setVideoEngineGetInfoListener(VideoEngineGetInfoListener videoEngineGetInfoListener) {
        this.mVideoEngineGetInfoListener = videoEngineGetInfoListener;
    }

    @Override
    public void setVideoEngineInfoListener(VideoEngineInfoListener videoEngineInfoListener) {
        this.mVideoEngineInfoListener = videoEngineInfoListener;
    }

    @Override
    public void setVideoEngineSimpleCallback(VideoEngineSimpleCallback videoEngineSimpleCallback) {
        setVideoEngineCallback(videoEngineSimpleCallback);
    }

    @Override
    public void setVideoModel(VideoModel videoModel) {
        setVideoModel((IVideoModel) videoModel);
    }

    public class AnonymousClass2 implements VideoSurface.f {
        AnonymousClass2() {
        }

        @Override
        public void onNoRenderEnd(int i4) {
            if (TTVideoEngineImpl.this.mLogger != null) {
                TTVideoEngineImpl.this.mLogger.AVNoRenderEnd(0);
            }
        }

        @Override
        public void onNoRenderStart(int i4) {
            if (TTVideoEngineImpl.this.mLogger != null) {
                TTVideoEngineImpl.this.mLogger.AVNoRenderStart(0, VideoEventOneNoRender.unifyReason(i4));
            }
        }
    }

    class AnonymousClass3 extends MaskInfo {
        AnonymousClass3() {
        }

        @Override
        protected void onMaskInfoCallback(int i, int i2, String str) {
            if (TTVideoEngineImpl.this.mMaskInfoListener != null) {
                TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                if (tTVideoEngineImpl.getConfigInt(499, tTVideoEngineImpl.mEnableBarrageMask) > 0) {
                    TTVideoEngineImpl.this.mMaskInfoListener.onMaskInfoCallback(i, i2, str);
                }
            }
        }
    }

    class AnonymousClass4 extends MaskInfo {
        AnonymousClass4() {
        }

        @Override
        protected void onMaskInfoCallback(int i, int i2, String str) {
            if (TTVideoEngineImpl.this.mAIBarrageInfoListener != null) {
                TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                if (tTVideoEngineImpl.getConfigInt(512, tTVideoEngineImpl.mEnableAIBarrage) > 0) {
                    TTVideoEngineImpl.this.mAIBarrageInfoListener.onBarrageInfoCallBack(i, i2, str);
                    return;
                }
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "AIBarrage listener is null or switcher is off");
        }
    }

    class AnonymousClass5 extends SubInfo {
        @Override
        protected void onSubLoadFinished(int i) {
        }

        @Override
        protected void onSubLoadFinished2(int i, String str) {
        }

        @Override
        protected void onSubSwitchCompleted(int i, int i2) {
        }

        AnonymousClass5() {
        }

        @Override
        protected void onSubInfoCallback2(int i, String str) {
            if (TTVideoEngineImpl.this.mSubInfoListener != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    String optString = jSONObject.optString("info");
                    TTVideoEngineImpl.this.mSubInfoListener.onSubInfoCallback(i, jSONObject.optInt("pts"), optString);
                    return;
                } catch (JSONException unused) {
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "construct json failed");
                    return;
                }
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoListener is null");
        }

        @Override
        protected void onSubInfoCallback(int i, int i2, String str) {
            if (TTVideoEngineImpl.this.mSubInfoListener != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                TTVideoEngineImpl.this.mSubInfoListener.onSubInfoCallback(i, i2, str);
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: listener: " + str);
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoListener is null");
        }
    }

    class AnonymousClass6 extends SubInfo {
        AnonymousClass6() {
        }

        @Override
        protected void onSubLoadFinished(int i) {
            int i2;
            if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle call back: finished old did call back");
                if (i >= 0) {
                    i2 = 1;
                } else {
                    i2 = 0;
                }
                TTVideoEngineImpl.this.mSubInfoCallBack.onSubLoadFinished(i2);
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
        }

        @Override
        protected void onSubSwitchCompleted(int i, int i2) {
            if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                TTVideoEngineImpl.this.mSubInfoCallBack.onSubSwitchCompleted(i, i2);
            } else {
                TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null");
            }
        }

        @Override
        protected void onSubInfoCallback2(int i, String str) {
            if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                TTVideoEngineImpl.this.mSubInfoCallBack.onSubInfoCallback(i, str);
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: callback2: " + str);
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
        }

        @Override
        protected void onSubLoadFinished2(int i, String str) {
            int i2;
            if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: call back: finished did call back");
                if (i >= 0) {
                    i2 = 1;
                } else {
                    i2 = 0;
                }
                try {
                    JSONObject jSONObject = new JSONObject(str);
                    if (i2 == 1) {
                        i = 0;
                    }
                    jSONObject.put(com.bytedance.accountseal.a.l.l, i);
                    str = jSONObject.toString();
                } catch (JSONException unused) {
                }
                TTVideoEngineImpl.this.mSubInfoCallBack.onSubLoadFinished2(i2, str);
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
        }

        @Override
        protected void onSubInfoCallback(int i, int i2, String str) {
            if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                JSONObject jSONObject = new JSONObject();
                try {
                    jSONObject.put("info", str);
                    jSONObject.put("pts", i2);
                    TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: callback: " + str);
                    TTVideoEngineImpl.this.mSubInfoCallBack.onSubInfoCallback(i, jSONObject.toString());
                    return;
                } catch (JSONException unused) {
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "put content field failed");
                    return;
                }
            }
            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null");
        }
    }

    private boolean _isDashSource(String str) {
        return FormatProvider.FormatProviderHolder.isMpd(str);
    }

    private void setSurfaceHook(Surface surface) {
        setSurfaceHookTimeOut(surface, -1);
    }

    public void _logFetchedFailed(Error error) {
        this.mLogger.fetchInfoComplete((VideoModel) null, error);
    }

    public void _logFetchedVideoInfo(IVideoModel iVideoModel) {
        this.mLogger.fetchInfoComplete(iVideoModel, (Error) null);
    }

    public void _logMessage(String str) {
        this.mLogger.logMessage(str);
    }

    @Override
    public void addVideoEngineCallback(VideoEngineCallback videoEngineCallback) {
        this.mListenerCompact.addVideoEngineCallback(videoEngineCallback);
    }

    @Override
    public int getIntOption(int i) {
        return _doGetIntOption(i);
    }

    @Override
    public long getLongOption(int i) {
        return _doGetLongOption(i);
    }

    @Override
    public String getStringOption(int i) {
        return _doGetStringOption(i);
    }

    @Override
    public void removeVideoEngineCallback(VideoEngineCallback videoEngineCallback) {
        this.mListenerCompact.removeVideoEngineCallback(videoEngineCallback);
    }

    @Override
    public void setABRListener(ABRListener aBRListener) {
        this.mListenerCompact.setABRListener(aBRListener);
    }

    @Override
    public void setGearStrategyEngineConfig(GearStrategyConfig gearStrategyConfig) {
        if (gearStrategyConfig == null) {
            return;
        }
        this.mGearStrategyConfig = gearStrategyConfig;
    }

    @Override
    public void setRadioMode(boolean z) {
        setIntOption(480, z ? 1 : 0);
    }

    @Override
    public void setSARChangeListener(SARChangeListener sARChangeListener) {
        this.mListenerCompact.setSARChangeListener(sARChangeListener);
    }

    @Override
    public void setStreamInfoListener(StreamInfoListener streamInfoListener) {
        this.mListenerCompact.setStreamInfoListener(streamInfoListener);
    }

    @Override
    public void setSurfaceHolder(SurfaceHolder surfaceHolder) {
        setSurfaceHolder(surfaceHolder, false);
    }

    @Override
    public void setVideoBufferDetailListener(VideoBufferDetailListener videoBufferDetailListener) {
        this.mListenerCompact.setVideoBufferDetailListener(videoBufferDetailListener);
    }

    @Override
    public void setVideoURLRouteListener(VideoURLRouteListener videoURLRouteListener) {
        this.mListenerCompact.setVideoURLRouteListener(videoURLRouteListener);
    }

    public class AnonymousClass1 implements VideoSurface.a {
        private int mUsingSr = 0;
        private int mUsingSharpe = 0;

        AnonymousClass1() {
        }

        @Override
        public void onDraw(long j) {
            if (TTVideoEngineImpl.this.mDecodedVideoFirstFrame) {
                TTVideoEngineImpl.this.mFrameCount++;
                if (TTVideoEngineImpl.this.mTextureSurface != null) {
                    int intOption = TTVideoEngineImpl.this.mTextureSurface.getIntOption(6);
                    int intOption2 = TTVideoEngineImpl.this.mTextureSurface.getIntOption(15);
                    if (this.mUsingSr != intOption || this.mUsingSharpe != intOption2) {
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "[SRLog]using sr:" + intOption + " frameCount:" + TTVideoEngineImpl.this.mFrameCount + "usingSharpe:" + intOption2);
                        this.mUsingSr = intOption;
                        this.mUsingSharpe = intOption2;
                        TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                        if (tTVideoEngineImpl.getConfigInt(4005, tTVideoEngineImpl.mEnableDecoderRenderVC2RenderLatency) > 0) {
                            if (this.mUsingSr <= 0 && this.mUsingSharpe <= 0) {
                                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "non sr latency mode");
                                TTVideoEngineImpl.this.setIntOption(4006, 1);
                            } else {
                                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "sr latency mode");
                                TTVideoEngineImpl.this.setIntOption(4006, 0);
                            }
                        }
                        TTVideoEngineImpl.this.mSRStrategy.onSRStatus(intOption, 0);
                    }
                }
                if (TTVideoEngineImpl.this.mListenerCompact != null) {
                    TTVideoEngineImpl.this.mListenerCompact.onFrameDraw(TTVideoEngineImpl.this.mFrameCount, null);
                }
            }
            if (!TTVideoEngineImpl.this.mTextureFirstFrame && TTVideoEngineImpl.this.mDecodedVideoFirstFrame) {
                TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "recive first frame render from texture");
                TTVideoEngineImpl.this.mTextureFirstFrame = true;
            }
            if (TTVideoEngineImpl.this.mPlayerFirstFrame && !TTVideoEngineImpl.this.mTexNotifyFirstFrame && TTVideoEngineImpl.this.mShouldPlay) {
                TTVideoEngineImpl tTVideoEngineImpl2 = TTVideoEngineImpl.this;
                if (tTVideoEngineImpl2.getConfigInt(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME, tTVideoEngineImpl2.mFirstFrameOpenTexture) != 1) {
                    TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "render start by texture, state =" + TTVideoEngineImpl.this.mPlaybackState);
                    TTVideoEngineImpl.this._renderStart();
                }
            }
        }
    }

    public static class MyABRStrategy extends ABRStrategy {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        private MyABRStrategy(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public String probeBitrate(String str) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mABRModule != null) {
                String a2 = tTVideoEngineImpl.mABRModule.a(str);
                if (!TextUtils.isEmpty(a2)) {
                    TTVideoEngineLog.d(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "[ABR] predict next segment result:" + a2 + ", this:" + tTVideoEngineImpl);
                }
                return a2;
            }
            return null;
        }

        @Override
        public int probeBitrate(int i) {
            ABRResult b2;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mABRModule != null && (b2 = tTVideoEngineImpl.mABRModule.b()) != null && b2.a() > 0) {
                int i2 = (int) b2.a(0).f34313a;
                TTVideoEngineLog.d(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "[ABR] predict next segment bitrate:" + i2 + "bps, this:" + tTVideoEngineImpl);
                return i2;
            }
            return -1;
        }

        MyABRStrategy(TTVideoEngineImpl tTVideoEngineImpl, AnonymousClass1 anonymousClass1) {
            this(tTVideoEngineImpl);
        }
    }

    public static class MyDrmTokenProcessedListener implements IntertrustDrmHelper.IntertrustDrmHelperListener {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        public MyDrmTokenProcessedListener(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public void onError(Error error) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && error != null) {
                tTVideoEngineImpl.receivedError(error);
            }
        }

        @Override
        public void onTokenProcessed(Error error) {
            IntertrustDrmHelper intertrustDrmHelper;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null || tTVideoEngineImpl.mUserStopped) {
                return;
            }
            if (error != null) {
                tTVideoEngineImpl.receivedError(error);
            }
            int i = 1;
            if (tTVideoEngineImpl.mVideoModel != null) {
                String vType = tTVideoEngineImpl.mVideoModel.getVType();
                vType.hashCode();
                char c2 = 65535;
                switch (vType.hashCode()) {
                    case 103407:
                        if (vType.equals("hls")) {
                            c2 = 0;
                            break;
                        }
                        break;
                    case 108321:
                        if (vType.equals("mpd")) {
                            c2 = 1;
                            break;
                        }
                        break;
                    case 3075986:
                        if (vType.equals("dash")) {
                            c2 = 2;
                            break;
                        }
                        break;
                }
                switch (c2) {
                    case 0:
                        break;
                    default:
                        TTVideoEngineLog.w(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "intertrust drm unsupported vtype:" + tTVideoEngineImpl.mVideoModel.getVType());
                    case 1:
                    case 2:
                        i = 2;
                        break;
                }
                intertrustDrmHelper = tTVideoEngineImpl.mIntertrustDrmHelper;
                if (intertrustDrmHelper != null) {
                    TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "mIntertrustDrmHelper is null, return.");
                    return;
                }
                String makeUrl = intertrustDrmHelper.makeUrl(tTVideoEngineImpl.mURLInfo.hostURL, i);
                if (TextUtils.isEmpty(makeUrl)) {
                    tTVideoEngineImpl.receivedError(new Error("kTTVideoErrorDomainIntertrustDRM", -9936));
                    return;
                } else {
                    tTVideoEngineImpl._playInternal(makeUrl, tTVideoEngineImpl.mHeaders);
                    return;
                }
            }
            i = 2;
            intertrustDrmHelper = tTVideoEngineImpl.mIntertrustDrmHelper;
            if (intertrustDrmHelper != null) {
            }
        }
    }

    public static class MyFetcherListener implements VideoInfoFetcher.FetcherListener {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        public MyFetcherListener(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public void onLog(String str) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetcher cancelled");
            if (tTVideoEngineImpl == null) {
                return;
            }
            tTVideoEngineImpl._logMessage(str);
        }

        @Override
        public void onRetry(Error error) {
            if (error == null) {
                return;
            }
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetcher should retry, error:" + error.toString());
            if (tTVideoEngineImpl == null) {
                return;
            }
            tTVideoEngineImpl.mLogger.needRetryToFetch(error, tTVideoEngineImpl.mPlayAPIVersion);
        }

        @Override
        public void onStatusException(int i, String str) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "video status exception:" + i);
            tTVideoEngineImpl.mIsFetchingInfo = false;
            if (tTVideoEngineImpl.mLogger != null) {
                tTVideoEngineImpl.mLogger.movieFinish(i, str);
            }
            if (tTVideoEngineImpl.mLooperThread.checkSendMainLooper()) {
                tTVideoEngineImpl.mLooperThread.postMainLooperMessage(410, i, 0, null);
            } else {
                tTVideoEngineImpl.mListenerCompact.onVideoStatusException(i);
            }
        }

        @Override
        public void onCompletion(VideoModel videoModel, Error error) {
            boolean onFetchedVideoInfo;
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            tTVideoEngineImpl.mIsFetchingInfo = false;
            if (videoModel != null && error == null) {
                tTVideoEngineImpl.mVideoModel = videoModel;
                TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetch info success");
                tTVideoEngineImpl._logFetchedVideoInfo(videoModel);
                if (tTVideoEngineImpl.mEnableTmpLog == 1) {
                    tTVideoEngineImpl.showLongLog(tTVideoEngineImpl.mVideoModel.toMediaInfoJsonString());
                }
                tTVideoEngineImpl.mIsDashSource = videoModel.isDashSource();
                tTVideoEngineImpl.mDashEnabled = tTVideoEngineImpl.mIsDashSource;
                tTVideoEngineImpl.mEngineConfig.setIntOption(17, tTVideoEngineImpl.mIsDashSource ? 1 : 0);
                if (tTVideoEngineImpl.mIsPreloaderItem) {
                    return;
                }
                tTVideoEngineImpl.fetchedVideoInfo(videoModel);
                if (tTVideoEngineImpl.mVideoInfoListener != null) {
                    if (tTVideoEngineImpl.mLooperThread.checkSendMainLooper()) {
                        if (tTVideoEngineImpl.getConfigInt(558, tTVideoEngineImpl.mWaitForFetchInfoResult ? 1 : 0) != 0) {
                            tTVideoEngineImpl.mLooperThread.sendMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL, 0, 0, tTVideoEngineImpl.mVideoModel);
                            if (tTVideoEngineImpl.mLooperThread.mMainMsgRetValue.readInt() == 1) {
                                onFetchedVideoInfo = true;
                            }
                        } else {
                            tTVideoEngineImpl.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL, 0, 0, tTVideoEngineImpl.mVideoModel);
                        }
                        onFetchedVideoInfo = false;
                    } else {
                        onFetchedVideoInfo = tTVideoEngineImpl.mVideoInfoListener.onFetchedVideoInfo(videoModel);
                    }
                    if (onFetchedVideoInfo) {
                        tTVideoEngineImpl.mLogger.fetchedAndLeaveByUser(1);
                        return;
                    }
                    tTVideoEngineImpl.mLogger.fetchedAndLeaveByUser(0);
                }
                tTVideoEngineImpl._parseIPAddress(videoModel);
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetch info failed:" + error.toString());
            if (error != null) {
                if (error.parameters.containsKey("log_id")) {
                    tTVideoEngineImpl.mLogger.setStringOption(15, (String) error.parameters.get("log_id"));
                }
                tTVideoEngineImpl._logFetchedFailed(error);
                tTVideoEngineImpl.receivedError(error);
                return;
            }
            tTVideoEngineImpl._logFetchedFailed(new Error("kTTVideoErrorDomainFetchingInfo", -9997, "fetch empty"));
            tTVideoEngineImpl.receivedError(new Error("kTTVideoErrorDomainFetchingInfo", -9997, "fetch empty"));
        }
    }

    public static class MyFrameMetadataListener implements FrameMetadataListener {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        @Override
        public void didReceivePacket(int i, long j, long j2, Map map) {
            FrameMetadataListener.CC.$default$didReceivePacket(this, i, j, j2, map);
        }

        @Override
        public void frameDTSNotify(int i, long j, long j2) {
        }

        @Override
        public void onAbrDecisionInfo(long j, String str) {
            FrameMetadataListener.CC.$default$onAbrDecisionInfo(this, j, str);
        }

        @Override
        public void receiveBinarySei(ByteBuffer byteBuffer) {
        }

        @Override
        public void updateFrameTerminatedDTS(int i, long j, long j2) {
        }

        private MyFrameMetadataListener(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        MyFrameMetadataListener(TTVideoEngineImpl tTVideoEngineImpl, AnonymousClass1 anonymousClass1) {
            this(tTVideoEngineImpl);
        }

        @Override
        public void onFrameAboutToBeRendered(int i, long j, long j2, Map<Integer, String> map) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl != null && tTVideoEngineImpl.mTextureSurface != null) {
                tTVideoEngineImpl.mTextureSurface.frameMetaCallback(j, j2, map);
            }
            if (tTVideoEngineImpl.mLooperThread.checkSendMainLooper()) {
                HashMap hashMap = new HashMap();
                hashMap.put("type", Integer.valueOf(i));
                hashMap.put("pts", Long.valueOf(j));
                hashMap.put("wallClockTime", Long.valueOf(j2));
                hashMap.put("frameData", map);
                tTVideoEngineImpl.mLooperThread.postMainLooperMessage(421, 0, 0, hashMap);
                return;
            }
            tTVideoEngineImpl.mListenerCompact.onFrameAboutToBeRendered(tTVideoEngineImpl.mEngineWrapper, i, j, j2, map);
        }
    }

    public static class MySubFetcherListener implements SubInfoFetcher.FetcherListener {
        private final WeakReference<TTVideoEngineImpl> mVideoEngineRef;

        public MySubFetcherListener(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mVideoEngineRef = new WeakReference<>(tTVideoEngineImpl);
        }

        @Override
        public void onLog(String str) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            TTVideoEngineLog.i(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "sub fetcher cancelled");
            if (tTVideoEngineImpl == null) {
            }
        }

        @Override
        public void onCompletion(String str, Error error) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mVideoEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            SubInfoListener subInfoListener = tTVideoEngineImpl.mSubInfoListener;
            SubInfoSimpleCallBack subInfoSimpleCallBack = tTVideoEngineImpl.mSubInfoCallBack;
            if (subInfoListener != null && tTVideoEngineImpl.mEnableSub > 0) {
                subInfoListener.onSubPathInfo(str, error);
            } else if (subInfoSimpleCallBack != null && tTVideoEngineImpl.mEnableSub > 0) {
                subInfoSimpleCallBack.onSubPathInfo(str, error);
            } else {
                TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "mSubInfoListener is null");
            }
            if (str != null && error == null) {
                if (str != null && tTVideoEngineImpl.mMediaPlayer != null && tTVideoEngineImpl.mLogger != null) {
                    tTVideoEngineImpl._setSubInfoToMediaPlayer(str);
                    return;
                }
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "sub fetch info failed:" + error.toString());
            if (error != null && tTVideoEngineImpl.mLogger != null) {
                tTVideoEngineImpl.mLogger.setSubtitleError(error.toString());
            }
        }
    }

    private void _logFirstQualityType(int i) {
        if (this.mFirstQualityType) {
            this.mFirstQualityType = false;
            this.mLogger.setInitialQualityType(i);
        }
    }

    private void _updateTextureState(int i) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(1, i);
        }
    }

    private static String generateCrosstalkStr(Map map) {
        try {
            return new JSONObject(map).toString();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }

    void _doSetDataSource(IMediaDataSource iMediaDataSource) {
        _ShutdownOldSource();
        this.mMediaDataSource = iMediaDataSource;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setSourceType(7, null);
        }
    }

    void _doSetLooping(boolean z) {
        super.setLooping(z);
        this.mLogger.setLooping(z);
    }

    void _doSetTestSpeedEnable(int i) {
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setIntOption(79, i);
        }
    }

    public void doSetMirrorHorizontal(boolean z) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return;
        }
        this.mIsMirrorHorizontal = z;
        videoSurface.setIntOption(30, z ? 1 : 0);
    }

    public void doSetMirrorVertical(boolean z) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return;
        }
        this.mIsMirrorVertical = z;
        videoSurface.setIntOption(31, z ? 1 : 0);
    }

    public void doSetStrategySource(StrategySource strategySource) {
        _ShutdownOldSource();
        try {
            this.mCodecStrategyAdapter.setStrategySource(strategySource);
        } catch (EngineException e) {
            e.printStackTrace();
        }
    }

    @Override
    public IMediaMetrics getMetrics(int i) {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger == null) {
            return null;
        }
        return iVideoEventLogger.buildMetrics(i);
    }

    @Override
    public Map<String, Object> getStrategyLogData(String str) {
        return StrategyHelper.helper().getLogData(this.mVideoID, str);
    }

    @Override
    protected void notifyInfoIdChanged(int i) {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.onVideoInfoIdChanged(i);
        }
        this.mListenerCompact.onInfoIdChanged(i);
    }

    @Override
    public void setDecryptionKey(String str) {
        TTVideoEngineLog.i(logcatTag(), "setDecryptionKey");
        this.mDecryptionKey = str;
    }

    @Override
    public void setLiveID(String str) {
        setVideoID(str);
        this.mLogger.setPlayType(1);
        this.mPlayType = 1;
    }

    @Override
    public void setMaskInfoListener(MaskInfoListener maskInfoListener) {
        this.mMaskInfoListener = maskInfoListener;
        if (this.mMaskInfoInterface == null) {
            this.mMaskInfoInterface = new MaskInfo() {
                AnonymousClass3() {
                }

                @Override
                protected void onMaskInfoCallback(int i, int i2, String str) {
                    if (TTVideoEngineImpl.this.mMaskInfoListener != null) {
                        TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                        if (tTVideoEngineImpl.getConfigInt(499, tTVideoEngineImpl.mEnableBarrageMask) > 0) {
                            TTVideoEngineImpl.this.mMaskInfoListener.onMaskInfoCallback(i, i2, str);
                        }
                    }
                }
            };
        }
    }

    @Override
    public void setResolutionMap(HashMap<String, Resolution> hashMap) {
        if (hashMap != null && hashMap.size() > 0) {
            this.mResolutionMap = hashMap;
        }
    }

    @Override
    public void setSpeedShiftConfig(SpeedShiftConfig speedShiftConfig) {
        this.mSpeedShiftConfig = speedShiftConfig;
        this.mBestResolutionType = 3;
        this.mEngineConfig.setIntOption(419, 3);
    }

    @Override
    public void setTokenUrlTemplate(String str) {
        this.mTokenUrlTemplate = str;
        IntertrustDrmHelper intertrustDrmHelper = this.mIntertrustDrmHelper;
        if (intertrustDrmHelper != null) {
            intertrustDrmHelper.setTokenUrlTemplate(str);
        }
    }

    private static class SmartUrlInfoCallback implements SmartUrlFetcher.Callback {
        private WeakReference<TTVideoEngineImpl> mEngineRef;
        private MyFetcherListener mListener;

        public SmartUrlInfoCallback(TTVideoEngineImpl tTVideoEngineImpl) {
            this.mEngineRef = new WeakReference<>(tTVideoEngineImpl);
            this.mListener = new MyFetcherListener(tTVideoEngineImpl);
        }

        @Override
        public void onError(SmartUrlFetcher.RequestParams requestParams, Error error) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            TTVideoEngineLog.e(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), String.format("fetchSmartUrlInfo failed:%s", error.toString()));
            if (error.parameters.containsKey("log_id")) {
                tTVideoEngineImpl.mLogger.setStringOption(15, (String) error.parameters.get("log_id"));
            }
            tTVideoEngineImpl._logFetchedFailed(error);
            tTVideoEngineImpl.mCodecStrategyAdapter.fallbackToDirectUrl();
        }

        @Override
        public void onComplete(SmartUrlFetcher.RequestParams requestParams, int i, SmartUrlFetcher.Result result) {
            TTVideoEngineImpl tTVideoEngineImpl = this.mEngineRef.get();
            if (tTVideoEngineImpl == null) {
                return;
            }
            TTVideoEngineLog.d(TTVideoEngineInternal.logcatTag(tTVideoEngineImpl), "fetchSmartUrlInfo success " + result);
            IVideoEventLogger iVideoEventLogger = tTVideoEngineImpl.mLogger;
            int i2 = 1;
            if (i != 1) {
                i2 = 0;
            }
            iVideoEventLogger.setIsVideoModelCache(i2);
            if (result.isEncodeStream()) {
                this.mListener.onCompletion((VideoModel) result.videoModel, null);
            } else if (tTVideoEngineImpl.mCodecStrategyAdapter != null) {
                tTVideoEngineImpl.mCodecStrategyAdapter.fallbackToDirectUrl();
            }
        }
    }

    private String _addThirdPartyProtocolHead(String str) {
        TTVideoEngineFFmpegProtocol tTVideoEngineFFmpegProtocol;
        if (str != null && (tTVideoEngineFFmpegProtocol = this.mFFmpegProtocol) != null) {
            return tTVideoEngineFFmpegProtocol.getProtocolName() + ":" + str;
        }
        return str;
    }

    private boolean _isDashSource(VideoInfo videoInfo) {
        String valueStr = videoInfo.getValueStr(6);
        if (!TextUtils.isEmpty(valueStr) && (valueStr.equals("dash") || valueStr.equals("mpd"))) {
            return true;
        }
        return false;
    }

    private void _logFirstHost(String str) {
        if (this.mFirstHost) {
            this.mFirstHost = false;
            this.mLogger.setInitialHost(str);
        }
        this.mLogger.setCurHost(str);
    }

    private void _logFirstIP(String str) {
        if (this.mFirstIP) {
            this.mFirstIP = false;
            this.mLogger.setInitialIP(str);
        }
        this.mLogger.setCurIP(str);
    }

    private void _logFirstQuality(String str) {
        if (this.mFirstQuality) {
            this.mFirstQuality = false;
            this.mLogger.setInitialQuality(str);
        }
        this.mLogger.setCurQuality(str);
    }

    private void _logFirstResolution(Resolution resolution) {
        boolean z;
        String _resolutionToString = _resolutionToString(resolution);
        if (this.mFirstResolution) {
            if (resolution == Resolution.Auto) {
                z = true;
            } else {
                z = false;
            }
            this.mFirstResolution = z;
            this.mLogger.setInitialResolution(_resolutionToString);
        }
        this.mLogger.setCurResolution(_resolutionToString);
    }

    private String _resolutionToString(Resolution resolution) {
        if (resolution == null) {
            return "nil";
        }
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null) {
            return iVideoModel.resolutionToString(resolution);
        }
        return resolution.toString(VideoRef.TYPE_VIDEO);
    }

    private boolean _usePlayerDNS(boolean z) {
        IVideoEventLogger iVideoEventLogger;
        int configInt = getConfigInt(110, this.mIsUsePlayerDNS);
        if ((configInt == 1 || z) && (iVideoEventLogger = this.mLogger) != null) {
            iVideoEventLogger.setStringOption(86, "localDNS");
        }
        if (configInt == 1) {
            return true;
        }
        if (configInt == 0) {
            return false;
        }
        return z;
    }

    private void changeResolutionSwitchingState(boolean z) {
        if (z) {
            this.mResolutionSwitching = true;
            this.mResolutionSwitchingStartTime = SystemClock.currentThreadTimeMillis();
        } else {
            this.mResolutionSwitching = false;
            this.mResolutionSwitchingStartTime = 0L;
        }
    }

    private void initMDLFetcher(Context context) {
        if (sFetcherMaker == null) {
            sFetcherMaker = new FetcherMaker(context);
        }
        AVMDLURLFetcherBridge.setFetcherMaker(sFetcherMaker);
    }

    private boolean isSupportBash(int i) {
        if (((getConfigInt(489, this.mSegmentFormatFlag) >> i) & 1) == 1) {
            return true;
        }
        return false;
    }

    private boolean isSupportHLSSeamlessSwitch(IVideoModel iVideoModel) {
        if (iVideoModel == null || !iVideoModel.hasFormat(IVideoModel.Format.HLS)) {
            return false;
        }
        return iVideoModel.isSupportHLSSeamlessSwitch();
    }

    private void setTextureLayoutMode(int i) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return;
        }
        int i2 = 2;
        if (i != 0) {
            if (i == 1) {
                i2 = 1;
            }
            videoSurface.setIntOption(26, i2);
        }
        i2 = 0;
        videoSurface.setIntOption(26, i2);
    }

    void _doSetDataSource(FileDescriptor fileDescriptor) {
        _ShutdownOldSource();
        this.mPlayFd = fileDescriptor;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setSourceType(6, null);
        }
    }

    public void _parseDNSComplete(String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(IVideoLayerCommand.VIDEO_HOST_CMD_SHOW_CLARITY_LIST, 0, 0, str);
        } else {
            _doParseDNSComplete(str);
        }
    }

    public void _parseIPAddress(IVideoModel iVideoModel) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(301, 0, 0, iVideoModel);
        } else {
            _doParseIPAddress(iVideoModel);
        }
    }

    synchronized void addSurfaceCallback(SurfaceHolder surfaceHolder) {
        if (this.mSurfaceCallback == null) {
            TTVideoEngineSurfaceCallback tTVideoEngineSurfaceCallback = new TTVideoEngineSurfaceCallback(this.mEngineWrapper);
            this.mSurfaceCallback = tTVideoEngineSurfaceCallback;
            surfaceHolder.addCallback(tTVideoEngineSurfaceCallback);
        }
    }

    @Override
    public void asyncInitSR(boolean z) {
        this.mAsyncInitSR = z;
        TTVideoEngineLog.i(logcatTag(), "[SRLog]asyncInitSR = " + z);
    }

    @Override
    public void configResolution(Resolution resolution) {
        TTVideoEngineLog.i(logcatTag(), "configResolution " + resolution);
        if (resolution == null) {
            return;
        }
        _configResolution(resolution, null);
    }

    public void doSetRotation(int i) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface == null) {
            return;
        }
        if (i != 0 && i != 90 && i != 180 && i != 270) {
            i = 0;
        }
        this.mRotation = i;
        videoSurface.setIntOption(29, i);
    }

    @Override
    public void dynamicControlSR(boolean z) {
        this.mDynamicControlSR = z;
        TTVideoEngineLog.i(logcatTag(), "[SRLog]dynamicControlSR = " + z);
    }

    @Override
    public float getFloatOption(int i) {
        if (i != 474) {
            return _doGetFloatOption(i);
        }
        TTTestSpeedListener tTTestSpeedListener = this.mTTSpeedListener;
        if (tTTestSpeedListener == null) {
            return 0.0f;
        }
        return tTTestSpeedListener.mAverageDownloadSpeed;
    }

    @Override
    public String getSubtitleContentInfo(int i) {
        if (this.mMediaPlayer == null || !(this.mMediaPlayer instanceof MediaPlayerWrapper)) {
            return null;
        }
        return ((MediaPlayerWrapper) this.mMediaPlayer).getSubtitleContent(i);
    }

    @Override
    public void ignoreSRResolutionLimit(boolean z) {
        this.mSRIgnoreRes = z;
        TTVideoEngineLog.i(logcatTag(), "[SRLog]ignoreSRResolutionLimit ignore=" + z);
    }

    public void lambda$_playInternal$7$TTVideoEngineImpl(Looper looper) {
        setupTextureRender();
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setLooper(looper);
        }
        TTVideoEngineLog.d(logcatTag(), "[SRLog]setupTextureRender in child thread");
    }

    public void lambda$_playInternal2$8$TTVideoEngineImpl(Looper looper) {
        setupTextureRender();
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setLooper(looper);
        }
        TTVideoEngineLog.d(logcatTag(), "[SRLog]setupTextureRender in child thread");
    }

    public void lambda$_renderStart$9$TTVideoEngineImpl(boolean z) {
        this.mTRSrategy.setIsInitForEffect(1, z);
        VideoSurface initTextureRender = initTextureRender(true);
        if (initTextureRender != null) {
            initTextureRender.release();
        }
        this.mAsyncInitSR = false;
        this.mAsyncInitEffect = false;
    }

    @Override
    protected void notifyBufferEnd(int i) {
        TTVideoEngineLooperThread2 tTVideoEngineLooperThread2 = this.mLooperThread;
        if (tTVideoEngineLooperThread2 != null && tTVideoEngineLooperThread2.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(416, i, 0, null);
            return;
        }
        ListenerCompact listenerCompact = this.mListenerCompact;
        if (listenerCompact != null) {
            listenerCompact.onBufferEnd(i);
        }
    }

    @Override
    protected void notifyBufferingUpdate(int i) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(403, i, 0, null);
        } else {
            this.mListenerCompact.onBufferingUpdate(this.mEngineWrapper, i);
        }
        _doMetrics();
    }

    protected void notifyFetchedVideoInfo(IVideoModel iVideoModel) {
        if (this.mVideoInfoListener == null) {
            return;
        }
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL, 0, 0, iVideoModel);
        } else {
            this.mVideoInfoListener.onFetchedVideoInfo((VideoModel) iVideoModel);
        }
    }

    @Override
    protected void notifyPlaybackStateChanged(int i) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(400, this.mPlaybackState, 0, null);
        } else {
            this.mListenerCompact.onPlaybackStateChanged(this.mEngineWrapper, this.mPlaybackState);
        }
    }

    @Override
    protected void notifySeekCompletion(boolean z) {
        if (this.mSeekCompletionListener == null) {
            return;
        }
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_DEFAULT_RENDER_TYPE, z ? 1 : 0, 0, null);
        } else {
            this.mSeekCompletionListener.onCompletion(z);
        }
    }

    @Override
    protected void notifyStreamChanged(int i) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(407, i, 0, null);
        } else {
            this.mListenerCompact.onStreamChanged(this.mEngineWrapper, i);
        }
    }

    @Override
    public void setAIBarrageUrl(String str) {
        TTVideoEngineLog.i(logcatTag(), "AIBarrage: setUrl " + str);
        this.mAIBarrageUrl = str;
    }

    @Override
    public void setBarrageMaskHeadLen(int i) {
        TTVideoEngineLog.i(logcatTag(), "setBarrageMaskHeadLen " + i);
        this.mMaskHeaderLen = i;
    }

    @Override
    public void setBarrageMaskUrl(String str) {
        TTVideoEngineLog.i(logcatTag(), "setBarrageMaskUrl " + str);
        this.mBarrageMaskUrl = str;
    }

    @Override
    public void setDataSource(IMediaDataSource iMediaDataSource) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(13, 0, 0, iMediaDataSource);
        } else {
            _doSetDataSource(iMediaDataSource);
        }
    }

    @Override
    public void setDirectURL(String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(19, 0, 0, str);
        } else {
            _doSetDirectURL(str, new String[]{str});
        }
    }

    @Override
    public void setEncodedKey(String str) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        TTVideoEngineLog.i(logcatTag(), "setEncodedKey");
        this.mSpadea = str;
    }

    @Override
    public void setGroupIdUseDataLoader(String str) {
        this.mMDLGroupId = str;
        TTVideoEngineLog.i(logcatTag(), "set groupID: " + this.mMDLGroupId);
    }

    @Override
    public void setListener(VideoEngineListener videoEngineListener) {
        TTVideoEngineLog.d(logcatTag(), "setListener " + videoEngineListener);
        this.mListenerCompact.setVideoEngineListener(videoEngineListener);
    }

    @Override
    public void setLocalURL(String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(18, 0, 0, str);
        } else {
            _doSetLocalURL(str);
        }
    }

    @Override
    public void setMirrorHorizontal(boolean z) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(29, z ? 1 : 0);
        } else {
            doSetMirrorHorizontal(z);
        }
    }

    @Override
    public void setMirrorVertical(boolean z) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(30, z ? 1 : 0);
        } else {
            doSetMirrorVertical(z);
        }
    }

    @Override
    public void setPlayAuthToken(String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(31, 0, 0, str);
        } else {
            doSetPlayAuthToken(str);
        }
    }

    @Override
    public void setPlayItem(TTVideoEnginePlayItem tTVideoEnginePlayItem) {
        if (tTVideoEnginePlayItem == null) {
            return;
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(17, 0, 0, tTVideoEnginePlayItem);
        } else {
            _doSetPlayItem(tTVideoEnginePlayItem);
        }
    }

    @Override
    public void setReportLogEnable(boolean z) {
        TTVideoEngineLog.d(logcatTag(), "setReportLogEnable " + z);
        this.mLogger.setUploadLogEnabled(z);
    }

    @Override
    public void setRotation(int i) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(28, i);
        } else {
            doSetRotation(i);
        }
    }

    @Override
    public void setStartTime(int i) {
        TTVideoEngineLog.i(logcatTag(), "setStartTime:" + i);
        this.mStartTime = i;
        this.mLogger.setStartTime(i);
    }

    @Override
    public void setUnSupportSampleRates(int[] iArr) {
        if (!isInHousePlayer()) {
            return;
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(51, 0, 0, iArr);
        } else {
            _setUnSupportSampleRates(iArr);
        }
    }

    @Override
    public void setVideoBufferListener(VideoBufferListener videoBufferListener) {
        TTVideoEngineLog.d(logcatTag(), "setVideoBufferListener " + videoBufferListener);
        this.mListenerCompact.setVideoBufferListener(videoBufferListener);
    }

    @Override
    public void setVideoEngineCallback(VideoEngineCallback videoEngineCallback) {
        TTVideoEngineLog.d(logcatTag(), "setVideoEngineSimpleCallback " + videoEngineCallback);
        this.mListenerCompact.setVideoEngineCallback(videoEngineCallback);
    }

    @Override
    public void setVideoID(String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(14, 0, 0, str);
        } else {
            _doSetVideoID(str);
        }
    }

    @Override
    public void setVideoInfoListener(VideoInfoListener videoInfoListener) {
        TTVideoEngineLog.d(logcatTag(), "setVideoInfoListener " + videoInfoListener);
        this.mVideoInfoListener = videoInfoListener;
    }

    @Override
    public void setVideoModel(IVideoModel iVideoModel) {
        if (iVideoModel == null) {
            return;
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(16, 0, 0, iVideoModel);
        } else {
            _doSetVideoModel(iVideoModel);
        }
    }

    private boolean _isNeedNotifyMdlErrorCode(Error error) {
        if (getConfigInt(160, this.mDataLoaderEnable) == 0 || DataLoaderHelper.getDataLoader().getIntValue(9018) == 0) {
            return false;
        }
        if (DataLoaderHelper.getDataLoader().getIntValue(9020) == 0 && !DataLoaderHelper.getDataLoader().isNotifyNetworkErrorCodes(error.code)) {
            return false;
        }
        return true;
    }

    private void _judgeSurfaceHashMap(Surface surface) {
        if (surface != null) {
            Map<Surface, Boolean> map = mSurfaceHashMap;
            if (map.get(surface) != null && map.get(surface).booleanValue()) {
                TTVideoEngineLog.i("TTVideoEngine", "remain native render from surface hashmap");
                this.mRenderType = 5;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, this.mRenderType);
                }
            }
        }
    }

    private void _logBeginToPlay(String str) {
        if (this.mLogger != null) {
            long currentTimeMillis = System.currentTimeMillis();
            this.mPlayTime = currentTimeMillis;
            this.mLogger.setDnsMode(getConfigInt(110, this.mIsUsePlayerDNS));
            this.mLogger.beginToPlay(str, currentTimeMillis, AppInfo.mDeviceId);
            this.mTraceId = this.mLogger.getTraceID();
        }
    }

    private void _preBuffering(int i) {
        TTVideoEngineLog.i(logcatTag(), "preBuffering start,this:" + this + ", code:" + i);
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.moviePreStalled(i);
        }
    }

    private boolean _removeThirdPartyProtocolHead(String[] strArr) {
        TTVideoEngineFFmpegProtocol tTVideoEngineFFmpegProtocol;
        if (strArr == null || (tTVideoEngineFFmpegProtocol = this.mFFmpegProtocol) == null) {
            return false;
        }
        String protocolName = tTVideoEngineFFmpegProtocol.getProtocolName();
        boolean z = false;
        for (int i = 0; i < strArr.length; i++) {
            if (strArr[i].substring(0, protocolName.length()).equals(protocolName)) {
                strArr[i] = strArr[i].substring(protocolName.length() + 1);
                z = true;
            }
        }
        return z;
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("_doPrepare")
    public static void com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop__doPrepare(TTVideoEngineImpl tTVideoEngineImpl) {
        TTVideoEngineImpl tTVideoEngineImpl2 = tTVideoEngineImpl;
        LogWrapper.info("AudioCore-TTVideoEngineAops", "_doPrepare ,currentTag = " + ((String) tTVideoEngineImpl2.get("tag")) + ", subTag = " + ((String) tTVideoEngineImpl2.get("subtag")), new Object[0]);
        z.a(tTVideoEngineImpl2);
        tTVideoEngineImpl.TTVideoEngineImpl___doPrepare$___twin___();
    }

    private boolean isSupportBash(IVideoModel iVideoModel) {
        if (iVideoModel == null) {
            return false;
        }
        if ((!iVideoModel.hasFormat(IVideoModel.Format.DASH) || !isSupportBash(1)) && (!iVideoModel.hasFormat(IVideoModel.Format.MP4) || !isSupportBash(2))) {
            return false;
        }
        return iVideoModel.isSupportBash();
    }

    private static boolean isSupportSeamlessSwitch(String str) {
        if (TextUtils.isEmpty(str)) {
            return false;
        }
        String lowerCase = str.toLowerCase();
        if (!lowerCase.startsWith("mem://bash") && !lowerCase.startsWith("mem://hls") && !FormatProvider.FormatProviderHolder.isM3u8(str) && !FormatProvider.FormatProviderHolder.isMpd(str)) {
            return false;
        }
        return true;
    }

    float _doGetFloatOption(int i) {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        try {
            if (i != 70) {
                if (i != 71) {
                    if (i != 474) {
                        return super.getFloatOption(i);
                    }
                    TTTestSpeedListener tTTestSpeedListener = this.mTTSpeedListener;
                    if (tTTestSpeedListener == null) {
                        return 0.0f;
                    }
                    return tTTestSpeedListener.mAverageDownloadSpeed;
                }
                if (mediaPlayer == null) {
                    return 0.0f;
                }
                return mediaPlayer.getFloatOption(150, 0.0f);
            }
            if (this.mContainerFPS <= 0.0f && mediaPlayer != null) {
                this.mContainerFPS = mediaPlayer.getFloatOption(151, 0.0f);
            }
            return this.mContainerFPS;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return 0.0f;
        }
    }

    public void lambda$_setSurfaceSync$4$TTVideoEngineImpl(Surface surface) {
        this.mSurface = surface;
        if (surface != null && this.mLogger != null && !this.mHasFirstFrameShown) {
            this.mLogger.setSurface(surface.toString());
        }
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        if (mediaPlayer != null) {
            setSurfaceHook(this.mSurface);
        }
    }

    void _setUnSupportSampleRates(int[] iArr) {
        if (iArr.length <= 0) {
            return;
        }
        int length = MediaPlayer.MEDIA_PLAYER_SUPPORT_SAMPLERATES.length;
        this.mUnsupportedSampleRatesInBinary = 0;
        for (int i : iArr) {
            int i2 = 0;
            while (true) {
                if (i2 >= length) {
                    break;
                }
                if (MediaPlayer.MEDIA_PLAYER_SUPPORT_SAMPLERATES[i2] == i) {
                    this.mUnsupportedSampleRatesInBinary = (1 << i2) | this.mUnsupportedSampleRatesInBinary;
                    break;
                }
                i2++;
            }
        }
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_USE_PLAYER_SPADE, this.mUnsupportedSampleRatesInBinary);
        }
    }

    void _updateCurrentInfoToMDL(int i) {
        setPlayInfo(1, i);
        if (getConfigInt(656, this.mEnableHeartBeat ? 1 : 0) != 1) {
            _syncPlayInfoToMdl();
            if (getConfigInt(160, this.mDataLoaderEnable) > 0) {
                DataLoaderHelper.getDataLoader().updateCurrentNetStatus();
            }
        }
    }

    @Override
    public void initSRStrategyConfig(SRStrategyConfig sRStrategyConfig) {
        TTVideoEngineLog.i(logcatTag(), "[SRLog]initSRStrategyConfig mSRStrategy=" + this.mSRStrategy + " config=" + sRStrategyConfig);
        if (sRStrategyConfig == null) {
            return;
        }
        this.mEnableSRStrategy = true;
        sRStrategyConfig.setStrategyType(1);
        this.mSRStrategy.setSRStrategyMode(0);
        this.mSRStrategy.updateConfig(sRStrategyConfig);
    }

    public void lambda$_renderStart$10$TTVideoEngineImpl(int i) {
        TestNetSpeedListener testNetSpeedListener;
        if (this.mMediaPlayer != null) {
            long longOption = this.mMediaPlayer.getLongOption(63, 0L);
            if (longOption >= 0 && (testNetSpeedListener = this.mTestNetSpeedListener) != null) {
                testNetSpeedListener.onSpeedReceive(longOption);
            }
            int i2 = this.mTestNetSpeed;
            if ((i2 == 1 || (i2 == 0 && longOption < 0)) && i > 0) {
                this.mTestNetSpeedHandler.postDelayed(this.mTestNetSpeedRunable, i);
            }
        }
    }

    public void lambda$setupTextureRender$1$TTVideoEngineImpl(int i) {
        int i2;
        this.mTextureRenderError = i;
        if (getConfigInt(1504, this.mEnableNotifyRenderException) > 0) {
            Error error = new Error("kTTVideoErrorTextureRender", -8000, i);
            if (this.mLooperThread.checkSendMainLooper()) {
                this.mLooperThread.postMainLooperMessage(409, 0, 0, error);
            } else {
                this.mListenerCompact.onError(error);
            }
        }
        if (i == 1 || i == 2) {
            if (i == 1) {
                i2 = -7896;
            } else {
                i2 = -7895;
            }
            this.mSRStrategy.onSRStatus(2, i2);
        }
    }

    @Override
    protected void notifyLoadStateChanged(int i) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(401, i, this.mShouldPlay ? 1 : 0, null);
        } else if (this.mShouldPlay || i != 3) {
            this.mListenerCompact.onLoadStateChanged(this.mEngineWrapper, i);
        }
    }

    int parseP2PCDNType(String str) {
        int indexOf;
        int i;
        if (TextUtils.isEmpty(str) || (indexOf = str.indexOf("cdn_type=")) == -1 || (i = indexOf + 9) >= str.length()) {
            return 0;
        }
        char charAt = str.charAt(i);
        if (!Character.isDigit(charAt)) {
            return 0;
        }
        return Character.getNumericValue(charAt);
    }

    @Override
    public void setAIBarrageInfoListener(AIBarrageSimpleCallback aIBarrageSimpleCallback) {
        int i;
        String logcatTag = logcatTag();
        StringBuilder sb = new StringBuilder();
        sb.append("AIBarrage: set listen exist: ");
        if (aIBarrageSimpleCallback != null) {
            i = 1;
        } else {
            i = 0;
        }
        sb.append(i);
        TTVideoEngineLog.i(logcatTag, sb.toString());
        this.mAIBarrageInfoListener = aIBarrageSimpleCallback;
        if (this.mAIBarrageInfoInterface == null) {
            this.mAIBarrageInfoInterface = new MaskInfo() {
                AnonymousClass4() {
                }

                @Override
                protected void onMaskInfoCallback(int i2, int i22, String str) {
                    if (TTVideoEngineImpl.this.mAIBarrageInfoListener != null) {
                        TTVideoEngineImpl tTVideoEngineImpl = TTVideoEngineImpl.this;
                        if (tTVideoEngineImpl.getConfigInt(512, tTVideoEngineImpl.mEnableAIBarrage) > 0) {
                            TTVideoEngineImpl.this.mAIBarrageInfoListener.onBarrageInfoCallBack(i2, i22, str);
                            return;
                        }
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "AIBarrage listener is null or switcher is off");
                }
            };
        }
    }

    @Override
    public void setAdditionSubModel(SubModelProvider subModelProvider) {
        TTVideoEngineLog.d(logcatTag(), "subtitle: set addition sub model: " + subModelProvider.toString());
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.setStringOption(1600, subModelProvider.toString());
        }
    }

    @Override
    public void setAudioProcessor(AudioProcessor audioProcessor) {
        if (this.mAsyncSetAudioProcessor == 1 && this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(109, 441, 0, audioProcessor);
            return;
        }
        this.mAudioProcessor = audioProcessor;
        if (this.mMediaPlayer != null) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(audioProcessor);
        }
    }

    @Override
    public void setCustomStr(String str) {
        if (this.mLogger != null && !TextUtils.isEmpty(str)) {
            if (str.length() > 512) {
                str = str.substring(0, 512);
                TTVideoEngineLog.i(logcatTag(), "customStr too long to be truncated!");
            }
            this.mLogger.setCustomStr(str);
        }
    }

    @Override
    public void setDirectUrlUseDataLoader(DirectUrlItem directUrlItem) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(32, 0, 0, directUrlItem);
        } else {
            _doSetDirectUrlUseDataLoader(directUrlItem.allUrls(), directUrlItem.fileKey(), directUrlItem.vid(), directUrlItem.cdnExpiredTime(), directUrlItem.urlExpireTimes());
        }
    }

    @Override
    public void setIsMute(boolean z) {
        TTVideoEngineLog.i(logcatTag(), "setIsMute:" + z);
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(10, z ? 1 : 0);
        } else {
            _setPlayerMute(z);
        }
    }

    @Override
    public void setPreloaderItem(TTAVPreloaderItem tTAVPreloaderItem) {
        if (tTAVPreloaderItem == null) {
            this.mIsPreloaderItem = false;
            return;
        }
        if (TextUtils.isEmpty(tTAVPreloaderItem.mUrl)) {
            setVideoID(tTAVPreloaderItem.mVideoID);
        } else if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(15, 0, 0, tTAVPreloaderItem);
        } else {
            _doSetPreloaderItem(tTAVPreloaderItem);
        }
    }

    @Override
    public void setSubAuthToken(String str) {
        String base64Decode = TTHelper.base64Decode(str);
        if (!TextUtils.isEmpty(base64Decode)) {
            try {
                String optString = new JSONObject(base64Decode).optString("GetSubtitleAuthToken");
                this.mSubAuthToken = optString;
                if (TextUtils.isEmpty(optString)) {
                    this.mSubAuthToken = base64Decode;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        TTVideoEngineLog.d(logcatTag(), "setSubAuthToken " + str);
    }

    @Override
    public void setSubDesInfoModel(final SubDesInfoModelProvider subDesInfoModelProvider) {
        TTVideoEngineLog.d(logcatTag(), "subtitle: set subtitle description info: " + subDesInfoModelProvider.toString());
        this.mLooperThread.runOnLooperThread(new Runnable() {
            @Override
            public final void run() {
                TTVideoEngineImpl.this.lambda$setSubDesInfoModel$3$TTVideoEngineImpl(subDesInfoModelProvider);
            }
        });
    }

    @Override
    public void setSubInfoCallBack(SubInfoSimpleCallBack subInfoSimpleCallBack) {
        int i;
        this.mSubInfoCallBack = subInfoSimpleCallBack;
        String logcatTag = logcatTag();
        StringBuilder sb = new StringBuilder();
        sb.append("subtitle: set callback, null: %d");
        if (subInfoSimpleCallBack == null) {
            i = 1;
        } else {
            i = 0;
        }
        sb.append(i);
        TTVideoEngineLog.d(logcatTag, sb.toString());
        if (this.mSubInfoInterface == null) {
            this.mSubInfoInterface = new SubInfo() {
                AnonymousClass6() {
                }

                @Override
                protected void onSubLoadFinished(int i2) {
                    int i22;
                    if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle call back: finished old did call back");
                        if (i2 >= 0) {
                            i22 = 1;
                        } else {
                            i22 = 0;
                        }
                        TTVideoEngineImpl.this.mSubInfoCallBack.onSubLoadFinished(i22);
                        return;
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
                }

                @Override
                protected void onSubSwitchCompleted(int i2, int i22) {
                    if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        TTVideoEngineImpl.this.mSubInfoCallBack.onSubSwitchCompleted(i2, i22);
                    } else {
                        TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null");
                    }
                }

                @Override
                protected void onSubInfoCallback2(int i2, String str) {
                    if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        TTVideoEngineImpl.this.mSubInfoCallBack.onSubInfoCallback(i2, str);
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: callback2: " + str);
                        return;
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
                }

                @Override
                protected void onSubLoadFinished2(int i2, String str) {
                    int i22;
                    if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: call back: finished did call back");
                        if (i2 >= 0) {
                            i22 = 1;
                        } else {
                            i22 = 0;
                        }
                        try {
                            JSONObject jSONObject = new JSONObject(str);
                            if (i22 == 1) {
                                i2 = 0;
                            }
                            jSONObject.put(com.bytedance.accountseal.a.l.l, i2);
                            str = jSONObject.toString();
                        } catch (JSONException unused) {
                        }
                        TTVideoEngineImpl.this.mSubInfoCallBack.onSubLoadFinished2(i22, str);
                        return;
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null or mEnableSub == 0");
                }

                @Override
                protected void onSubInfoCallback(int i2, int i22, String str) {
                    if (TTVideoEngineImpl.this.mSubInfoCallBack != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        JSONObject jSONObject = new JSONObject();
                        try {
                            jSONObject.put("info", str);
                            jSONObject.put("pts", i22);
                            TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: callback: " + str);
                            TTVideoEngineImpl.this.mSubInfoCallBack.onSubInfoCallback(i2, jSONObject.toString());
                            return;
                        } catch (JSONException unused) {
                            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "put content field failed");
                            return;
                        }
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoCallBack is null");
                }
            };
        }
    }

    @Override
    public void setSubInfoListener(SubInfoListener subInfoListener) {
        int i;
        String logcatTag = logcatTag();
        StringBuilder sb = new StringBuilder();
        sb.append("subtitle: set info listener, null: %d");
        if (subInfoListener == null) {
            i = 1;
        } else {
            i = 0;
        }
        sb.append(i);
        TTVideoEngineLog.d(logcatTag, sb.toString());
        this.mSubInfoListener = subInfoListener;
        if (this.mSubInfoInterface == null) {
            this.mSubInfoInterface = new SubInfo() {
                @Override
                protected void onSubLoadFinished(int i2) {
                }

                @Override
                protected void onSubLoadFinished2(int i2, String str) {
                }

                @Override
                protected void onSubSwitchCompleted(int i2, int i22) {
                }

                AnonymousClass5() {
                }

                @Override
                protected void onSubInfoCallback2(int i2, String str) {
                    if (TTVideoEngineImpl.this.mSubInfoListener != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        try {
                            JSONObject jSONObject = new JSONObject(str);
                            String optString = jSONObject.optString("info");
                            TTVideoEngineImpl.this.mSubInfoListener.onSubInfoCallback(i2, jSONObject.optInt("pts"), optString);
                            return;
                        } catch (JSONException unused) {
                            TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "construct json failed");
                            return;
                        }
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoListener is null");
                }

                @Override
                protected void onSubInfoCallback(int i2, int i22, String str) {
                    if (TTVideoEngineImpl.this.mSubInfoListener != null && TTVideoEngineImpl.this.mEnableSub > 0) {
                        TTVideoEngineImpl.this.mSubInfoListener.onSubInfoCallback(i2, i22, str);
                        TTVideoEngineLog.d(TTVideoEngineImpl.this.logcatTag(), "subtitle: listener: " + str);
                        return;
                    }
                    TTVideoEngineLog.e(TTVideoEngineImpl.this.logcatTag(), "mSubInfoListener is null");
                }
            };
        }
    }

    @Override
    public void setSurfaceSync(Surface surface) {
        TTVideoEngineLog.i(logcatTag(), "setSurfaceSync = " + surface + ",this:" + this);
        _setSurfaceSync(surface, (long) getConfigInt(950, (int) this.mSendEngineMsgTimeout), false);
    }

    public void showLongLog(String str) {
        if (this.mEnableTmpLog != 1) {
            return;
        }
        if (str != null) {
            int i = 3900;
            if (str.length() > 3900) {
                int length = str.length();
                int i2 = 0;
                while (i < length) {
                    TTVideoEngineLog.d(logcatTag(), str.substring(i2, i));
                    i2 += 3900;
                    i = Math.min(i + 3900, length);
                }
                TTVideoEngineLog.i(logcatTag(), str.substring(i2, i));
                return;
            }
        }
        TTVideoEngineLog.i(logcatTag(), str);
    }

    @Override
    public void snapshot(SnapshotListener snapshotListener) {
        if (snapshotListener == null) {
            TTVideoEngineLog.d(logcatTag(), "snapshotListener is null");
            return;
        }
        if (this.mTextureSurface == null) {
            TTVideoEngineLog.d(logcatTag(), "TextureSurface is null");
            snapshotListener.onSnapShot(null, 0, 0);
        } else {
            Bundle bundle = new Bundle();
            bundle.putBoolean("origin_video", true);
            this.mTextureSurface.saveFrame(bundle, new $$Lambda$TTVideoEngineImpl$vF76UXqUPvtBrTINaJsoExGxA1E(snapshotListener));
        }
    }

    @Override
    public void updateSRStrategyConfig(SRStrategyConfig sRStrategyConfig) {
        TTVideoEngineLog.i(logcatTag(), "[SRLog]updateSRStrategyConfig mSRStrategy=" + this.mSRStrategy + " config=" + sRStrategyConfig);
        this.mSRStrategy.updateConfig(sRStrategyConfig);
    }

    private void _abnormalOccured(int i) {
        int i2;
        if (this.mLogger != null) {
            OptionHolder optionHolder = this.mOptionHolder;
            int i3 = -1;
            if (optionHolder != null) {
                i3 = getConfigInt(42303, optionHolder.getIntOption(42303, 0));
                i2 = getConfigInt(42302, this.mOptionHolder.getIntOption(42302, -1));
            } else {
                i2 = -1;
            }
            this.mLogger.setIntOption(178, i);
            this.mLogger.setIntOption(180, i3);
            this.mLogger.setIntOption(179, i2);
            TTVideoEngineLog.i("TTVideoEngine", "abnormalOccured: " + i + " strategy: " + i3 + " interval: " + i2);
        }
    }

    private void _bufferStart(int i) {
        TTVideoEngineLog.i(logcatTag(), "buffering start,this:" + this + ", code:" + i);
        if (this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(33, 0);
        }
        boolean z = this.mTexNotifyFirstFrame;
        int bufferStartAction = getBufferStartAction();
        if (this.mNotifyBufferingDirectly == 1 && !this.mHasFirstFrameShown) {
            this.mLogger.playbackBufferStart();
        }
        if (this.mHasFirstFrameShown && !this.mSeeking && this.mLoadState != 3 && i == 0) {
            this.mLogger.reportBufferingMetrics();
        }
        notifyBufferStart(i, z ? 1 : 0, bufferStartAction);
        updateLoadState(2, i);
        _updateTextureState(4);
    }

    private void _decoderStart(int i) {
        PlayerEventSimpleListener playerEventSimpleListener;
        PlayerEventSimpleListener playerEventSimpleListener2;
        if (this.mMediaPlayer != null && getConfigInt(664, this.mEnableDebugUINotify) != 0) {
            if (i == 0 && (playerEventSimpleListener2 = this.mPlayerEventListener) != null) {
                playerEventSimpleListener2.onVideoDecoderOpened(this.mMediaPlayer.getIntOption(157, -1), this.mMediaPlayer.getLongOption(629, -1L), this.mMediaPlayer.getLongOption(630, -1L));
                this.mPlayerEventListener.onVideoDecodedFirstFrame(this.mMediaPlayer.getLongOption(77, -1L));
            } else if (i == 1 && (playerEventSimpleListener = this.mPlayerEventListener) != null) {
                playerEventSimpleListener.onAudioDecoderOpened(this.mMediaPlayer.getIntOption(158, -1), this.mMediaPlayer.getLongOption(631, -1L), this.mMediaPlayer.getLongOption(632, -1L));
            }
        }
    }

    private void _notifyError(Error error) {
        if (this.mLogger != null) {
            if (this.mPlayDuration != null) {
                this.mLogger.addWatchedDuration(this.mPlayDuration.getPlayedDuration());
            }
            this.mLogger.movieFinish(error, this.mPlayAPIVersion);
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(33, 0);
        }
        this.mStarted = false;
        this.mIsStartPlayAutomatically = true;
        if (_isNeedNotifyMdlErrorCode(error)) {
            error.parameters.putAll(_getMdlErrorInfo());
        }
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(409, 0, 0, error);
        } else {
            this.mListenerCompact.onError(error);
        }
        this.mErrorCount = 0;
        this.mAccumulatedErrorCount = 0;
        this.mErrorEnd = true;
    }

    private void _onABRGetPredictResult(int i) {
        if (this.mABRModule != null && i >= 0) {
            TTVideoEngineLog.d(logcatTag(), "[ABR] predict next segment bitrate:" + i + "bps, this:" + this);
            if (this.mLooperThread.checkSendMainLooper()) {
                this.mLooperThread.postMainLooperMessage(600, 0, i, null);
            } else {
                this.mListenerCompact.onABRPredictBitrate(0, i);
            }
            long j = this.currentBitrate;
            long j2 = i;
            if (j != j2) {
                this.mLogger.abrEventStart(j, j2);
                this.currentBitrate = j2;
            }
        }
    }

    private void _renderSeekComplete(int i) {
        TTVideoEngineLog.i(logcatTag(), "render seek complete:" + i);
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.renderSeekCompleted(i);
            this.mLogger.showedOneFrame();
        }
        if (this.mSeeking) {
            this.mSeeking = false;
            this.mSeekingStartTime = 0L;
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (iVideoEventLogger2 != null) {
                iVideoEventLogger2.seekCompleted();
                this.mLogger.showedOneFrame();
            }
        }
        if (shouldStartTextureRenderCheck()) {
            this.mTextureSurface.setIntOption(33, 1);
        }
        if (this.mVideoEngineInfoListener != null) {
            TTVideoEngineLog.i(logcatTag(), "render seek complete call back " + i);
            VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
            videoEngineInfos.setKey("renderSeekComplete");
            videoEngineInfos.setObject(Integer.valueOf(i));
            notifyEngineInfo(videoEngineInfos, true);
        }
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("_doReleaseAsync")
    public static void com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_doReleaseAsync(TTVideoEngineImpl tTVideoEngineImpl) {
        tTVideoEngineImpl.TTVideoEngineImpl___doReleaseAsync$___twin___();
        try {
            String currentPlayPath = tTVideoEngineImpl.getCurrentPlayPath();
            LogWrapper.info("AudioCore-TTVideoEngineAops", "_doReleaseAsync ,TTVideoEngine = " + tTVideoEngineImpl, new Object[0]);
            LogWrapper.info("AudioCore-TTVideoEngineAops", "_doReleaseAsync ,playPath = " + currentPlayPath, new Object[0]);
        } catch (Throwable th) {
            LogWrapper.error("AudioCore-TTVideoEngineAops", "_doReleaseAsync ,exception = " + th.getMessage(), new Object[0]);
        }
    }

    private VideoSurface initTextureRender(boolean z) {
        int i;
        TTVideoEngineLog.i(logcatTag(), "use sr tex = " + z);
        v vVar = this.mTextureRenderer;
        if (vVar == null) {
            return null;
        }
        if (getConfigInt(650, this.mOverlayMode) != 0) {
            i = 4;
        } else {
            i = 0;
        }
        int i2 = i | 0;
        g gVar = new g();
        gVar.a(5, z ? 1 : 0);
        if (this.mTRSrategy.isInitForEffect(1)) {
            gVar.a(1, 1);
        }
        gVar.f = TTVideoEngineConfig.setEGLBitDepth;
        VideoSurface a2 = vVar.a(gVar, i2);
        if (a2 != null) {
            if (z) {
                initSr(a2);
            }
            this.mTRSrategy.didInitTextureRender(a2);
            a2.setIntOption(26, this.mLayoutType);
        }
        return a2;
    }

    private boolean isSupportBash(String str) {
        if (!TextUtils.isEmpty(str) && isSupportBash(2)) {
            String lowerCase = str.toLowerCase();
            if (!lowerCase.startsWith("file://") && !lowerCase.startsWith("/") && !FormatProvider.FormatProviderHolder.isM3u8(str) && !FormatProvider.FormatProviderHolder.isMpd(str)) {
                return true;
            }
        }
        return false;
    }

    private boolean isSupportSeamlessSwitch(IVideoModel iVideoModel) {
        boolean z;
        boolean z2;
        if (iVideoModel == null) {
            return false;
        }
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(33) == 1) {
                z = true;
            } else {
                z = false;
            }
        } else {
            z = this.mBashEnabled;
        }
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(671) == 1) {
                z2 = true;
            } else {
                z2 = false;
            }
        } else {
            z2 = this.mHLSSeamlessSwitch;
        }
        if (iVideoModel.hasFormat(IVideoModel.Format.DASH)) {
            return true;
        }
        if (iVideoModel.hasFormat(IVideoModel.Format.MP4)) {
            if (!z || !isSupportBash(iVideoModel)) {
                return false;
            }
            return true;
        }
        if (!iVideoModel.hasFormat(IVideoModel.Format.HLS) || !z2 || !isSupportHLSSeamlessSwitch(iVideoModel)) {
            return false;
        }
        return true;
    }

    private void resetFallbackApi(Error error) {
        String str = this.mFallbackAPI;
        if (str != null && "dash".equals(TTHelper.getParam(str, "format_type")) && (-9993 == error.code || !isInHousePlayer())) {
            this.mFallbackAPI = TTHelper.overrideUrlParam(this.mFallbackAPI, "format_type", "mp4");
        }
        if (this.mFallbackAPI != null) {
            if (-9993 == error.code || !isInHousePlayer()) {
                this.mFallbackAPI = TTHelper.overrideUrlParam(this.mFallbackAPI, "codec_type", "0");
            }
        }
    }

    void _doSetLocalURL(String str) {
        if (str != null && !str.equals(this.mLocalURL) && (!TTVideoEngineUtils.isFlagOn(EngineGlobalConfig.getInstance().getEngineOptimizeFlag(), 1L) || this.mEngineHasUsed)) {
            TTVideoEngineLog.i(logcatTag(), "set local url:" + str);
            _ShutdownOldSource();
            this.mState = 0;
            this.mUserStopped = false;
            this.mLastPlaybackTime = 0;
            this.mFirstURL = true;
            this.mAPIString = null;
        }
        this.mEngineHasUsed = true;
        this.mStarted = false;
        this.mIsLocal = true;
        this.mLocalURL = str;
        this.mBufferingStartT = 0L;
        this.mLogger.setSourceType(0, "");
        this.mFileKey = null;
        Resolution resolution = Resolution.Undefine;
        this.currentResolution = resolution;
        this.mLogger.configResolution(_resolutionToString(resolution), "");
    }

    void _doSetPlayItem(TTVideoEnginePlayItem tTVideoEnginePlayItem) {
        boolean isExpired = tTVideoEnginePlayItem.isExpired();
        if (!TextUtils.isEmpty(tTVideoEnginePlayItem.playURL) && !isExpired) {
            _ShutdownOldSource();
            if (!tTVideoEnginePlayItem.equals(this.mPlayItem)) {
                if (this.mPlayItem != null) {
                    _reset();
                }
                this.mIsPlayItem = true;
                this.mFirstURL = true;
                this.mFirstIP = true;
                this.mFirstHost = true;
                this.mState = 0;
                this.mUserStopped = false;
                this.mLastPlaybackTime = 0;
                this.mAPIString = null;
            }
            this.mStarted = false;
            this.mPlayItem = tTVideoEnginePlayItem;
            this.mBufferingStartT = 0L;
            if (tTVideoEnginePlayItem.resolution != null) {
                this.currentResolution = tTVideoEnginePlayItem.resolution;
            }
            this.mVideoID = tTVideoEnginePlayItem.vid;
            this.mLogger.setSourceType(2, tTVideoEnginePlayItem.vid);
            this.mFileKey = null;
            return;
        }
        setVideoID(tTVideoEnginePlayItem.vid);
    }

    void _doSetPlaybackParams(PlaybackParams playbackParams) {
        boolean z;
        super.setPlaybackParams(playbackParams);
        if (playbackParams != null && playbackParams.getSpeed() != -1.0f) {
            SRStrategy sRStrategy = this.mSRStrategy;
            SRStrategyConfig newConfig = SRStrategyConfig.newConfig();
            if (((int) (playbackParams.getSpeed() * 100.0f)) != 100) {
                z = true;
            } else {
                z = false;
            }
            sRStrategy.updateConfig(newConfig.setIsSpeed(z));
        }
        if (this.mMediaPlayer != null && this.mSRStrategy.getSRStrategyMode() == 0 && this.mHasFirstFrameShown) {
            this.mTextureSrOpen = this.mSRStrategy.isSRSatisfied() ? 1 : 0;
            int sRNotUseReason = this.mSRStrategy.getSRNotUseReason();
            this.mSRNotUseReason = sRNotUseReason;
            doOpenSR(this.mTextureSrOpen, sRNotUseReason);
        }
        if (playbackParams != null) {
            this.mLogger.setPlaybackParams(playbackParams);
        }
    }

    void _doSetPreloaderItem(TTAVPreloaderItem tTAVPreloaderItem) {
        int i = tTAVPreloaderItem.mResolution;
        if (i != 0) {
            if (i != 1) {
                if (i != 2) {
                    if (i != 3) {
                        if (i != 4) {
                            setVideoID(tTAVPreloaderItem.mVideoID);
                            return;
                        }
                        this.currentResolution = Resolution.FourK;
                    } else {
                        this.currentResolution = Resolution.ExtremelyHigh;
                    }
                } else {
                    this.currentResolution = Resolution.SuperHigh;
                }
            } else {
                this.currentResolution = Resolution.High;
            }
        } else {
            this.currentResolution = Resolution.Standard;
        }
        _ShutdownOldSource();
        TTAVPreloaderItem tTAVPreloaderItem2 = this.mPreloaderItem;
        if (tTAVPreloaderItem2 != null && !tTAVPreloaderItem2.equals(tTAVPreloaderItem)) {
            _reset();
            this.mIsLocal = false;
            this.mFirstURL = true;
            this.mFirstIP = true;
            this.mFirstHost = true;
            this.mState = 0;
            this.mUserStopped = false;
            this.mLastPlaybackTime = 0;
            this.mFetcher = null;
            this.mAPIString = null;
        }
        this.mStarted = false;
        this.mIsPreloaderItem = true;
        this.mPreloaderItem = tTAVPreloaderItem;
        this.mBufferingStartT = 0L;
        String str = tTAVPreloaderItem.mVideoID;
        this.mVideoID = str;
        this.mLogger.setSourceType(3, str);
        this.mFileKey = null;
        TTVideoEngineLog.i(logcatTag(), "set preloaderitem");
    }

    void _doSetVideoID(String str) {
        if (str != null && !str.equals(this.mVideoID) && (!TTVideoEngineUtils.isFlagOn(EngineGlobalConfig.getInstance().getEngineOptimizeFlag(), 1L) || this.mEngineHasUsed)) {
            TTVideoEngineLog.i(logcatTag(), "set video id:" + str);
            _ShutdownOldSource();
            this.mIsLocal = false;
            this.mFirstURL = true;
            this.mFirstIP = true;
            this.mFirstHost = true;
            this.mState = 0;
            this.mUserStopped = false;
            this.mLastPlaybackTime = 0;
            this.mAPIString = null;
        }
        this.mEngineHasUsed = true;
        this.mStarted = false;
        this.mVideoID = str;
        this.mBufferingStartT = 0L;
        this.mLogger.setSourceType(5, str);
        this.mFileKey = null;
    }

    void _dumpSurface(String str) {
        if (!TTVideoEngineLog.d()) {
            return;
        }
        Surface surface = this.mSurface;
        SurfaceHolder surfaceHolder = this.mSurfaceHolder;
        StringBuilder sb = new StringBuilder();
        sb.append(this);
        sb.append(" -> ");
        sb.append(str);
        sb.append(" dumpSurface: ");
        sb.append("mSurface = ");
        sb.append(surface);
        if (surface != null) {
            sb.append(" isValid = ");
            sb.append(surface.isValid());
        }
        sb.append(", mSurfaceHolder = ");
        sb.append(surfaceHolder);
        if (surfaceHolder != null) {
            Surface surface2 = surfaceHolder.getSurface();
            sb.append(" surface = ");
            sb.append(surface2);
            if (surface2 != null) {
                sb.append(" isValid = ");
                sb.append(surface2.isValid());
            }
        }
        VideoSurface videoSurface = this.mTextureSurface;
        sb.append(", mTextureSurface = ");
        sb.append(videoSurface);
        if (videoSurface != null) {
            sb.append(" isValid = ");
            sb.append(videoSurface.isValid());
        }
        TTVideoEngineLog.d(logcatTag(), sb.toString());
    }

    public void _setSubInfoToMediaPlayer(String str) {
        this.mSubPathInfo = str;
        if (!TextUtils.isEmpty(str) && this.mEnableSubThread > 0) {
            this.mMediaPlayer.setIntOption(618, this.mEnableSub);
            this.mMediaPlayer.setStringOption(TTVideoEngineInterface.PLAYER_OPTION_IS_DEGRADE_RELEASE, this.mSubPathInfo);
            this.mLogger.setLongOption(83, System.currentTimeMillis());
        }
        TTVideoEngineLog.d(logcatTag(), "sub option: " + this.mEnableSub + "sub thread: " + this.mEnableSubThread + " url:" + this.mSubPathInfo);
    }

    public void doSetPlayAuthToken(String str) {
        String optString;
        IVideoEventLogger iVideoEventLogger;
        String base64Decode = TTHelper.base64Decode(str);
        if (!TextUtils.isEmpty(base64Decode)) {
            try {
                JSONObject jSONObject = new JSONObject(base64Decode);
                String optString2 = jSONObject.optString("GetPlayInfoToken");
                this.mAuthorization = optString2;
                if (TextUtils.isEmpty(optString2)) {
                    this.mAuthorization = base64Decode;
                }
                optString = jSONObject.optString("TokenVersion");
            } catch (JSONException e) {
                e.printStackTrace();
                this.mAuthorization = base64Decode;
            }
            if (TextUtils.isEmpty(optString) && optString.equals("V2")) {
                this.mPlayAPIVersion = 4;
            } else {
                this.mPlayAPIVersion = 2;
            }
            TTVideoEngineLog.d(logcatTag(), "setPlayAuthToken " + str + " version = " + this.mPlayAPIVersion);
            iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger == null) {
                iVideoEventLogger.setPlayAPIVersion(this.mPlayAPIVersion, str);
                return;
            }
            return;
        }
        optString = "";
        if (TextUtils.isEmpty(optString)) {
        }
        this.mPlayAPIVersion = 2;
        TTVideoEngineLog.d(logcatTag(), "setPlayAuthToken " + str + " version = " + this.mPlayAPIVersion);
        iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger == null) {
        }
    }

    @Override
    public void setLooping(boolean z) {
        TTVideoEngineLog.i(logcatTag(), "setLooping:" + z);
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(6, z ? 1 : 0);
        } else {
            _doSetLooping(z);
        }
        TTVideoEngineLog.i(logcatTag(), "set looping value:" + (z ? 1 : 0));
    }

    @Override
    public void setPlaybackParams(PlaybackParams playbackParams) {
        if (playbackParams != null) {
            TTVideoEngineLog.d(logcatTag(), "setPlaybackParams:" + playbackParams + ", speed:" + playbackParams.getSpeed() + ", pitch:" + playbackParams.getPitch());
        }
        this.mPlaybackParams = playbackParams;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(53, 0, 0, playbackParams);
        } else {
            _doSetPlaybackParams(playbackParams);
        }
    }

    @Override
    public void setSurface(Surface surface) {
        TTVideoEngineLog.i(logcatTag(), "setsurface = " + surface + ", pre-surface:" + this.mSurface + ",this:" + this);
        if (surface == null) {
            this.mLastSetSurfaceNullTime = System.currentTimeMillis();
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(54, 0, 0, surface);
        } else {
            lambda$_setSurfaceSync$4$TTVideoEngineImpl(surface);
        }
    }

    @Override
    public void setSurfaceHolderSync(SurfaceHolder surfaceHolder) {
        TTVideoEngineLog.i(logcatTag(), "setSurfaceHolderSync = " + surfaceHolder + ", this:" + this);
        if (surfaceHolder == null) {
            this.mLastSetSurfaceNullTime = System.currentTimeMillis();
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            if (!this.mLooperThread.sendEngineMessage(55, getConfigInt(950, (int) this.mSendEngineMsgTimeout), 0, 0, surfaceHolder) && surfaceHolder != null) {
                this.mSetValidSurfaceTimeout = 1;
                return;
            }
            return;
        }
        _doSetSurfaceHolder(surfaceHolder, false);
    }

    @Override
    protected void updatePlaybackState(int i) {
        if (this.mPlaybackState != i) {
            TTVideoEngineLog.i(logcatTag(), "playback state changed, prev:" + this.mPlaybackState + ", current:" + i);
            this.mPlaybackState = i;
            notifyPlaybackStateChanged(i);
            TTVideoEngineMonitor tTVideoEngineMonitor = this.mEngineStateMonitor;
            if (tTVideoEngineMonitor != null) {
                if (i == 1) {
                    tTVideoEngineMonitor.engineStateChange(hashCode(), true);
                } else {
                    tTVideoEngineMonitor.engineStateChange(hashCode(), false);
                }
            }
        }
    }

    private void _bufferEnd(int i) {
        IVideoEventLogger iVideoEventLogger;
        TTVideoEngineLog.i(logcatTag(), "buffering end,this:" + this + ", code:" + i);
        if (this.mPlayDuration != null && this.mPlaybackState == 1) {
            this.mPlayDuration.start();
        }
        long elapsedRealtime = SystemClock.elapsedRealtime();
        long j = this.mBufferingStartT;
        if (j > 0 && elapsedRealtime >= j) {
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (iVideoEventLogger2 != null) {
                iVideoEventLogger2.movieStallEnd(i);
            }
            if (i == 0) {
                setPlayInfo(4, 1L);
            }
            int configInt = getConfigInt(668, this.mResumeFileIOBlockThresMs);
            if (configInt > 0 && elapsedRealtime - this.mBufferingStartT > configInt) {
                TTVideoEngineLog.d(logcatTag(), "resume io thres:" + configInt + " cur block:" + (elapsedRealtime - this.mBufferingStartT));
            }
            this.mBufferingStartT = 0L;
        } else if (this.mNotifyBufferingDirectly == 1 && (iVideoEventLogger = this.mLogger) != null) {
            iVideoEventLogger.playbackBufferEnd();
        }
        this.mBufferingType = -1;
        notifyBufferEnd(i);
        updateLoadState(1, i);
        _updateTextureState(1);
        if (shouldStartTextureRenderCheck()) {
            this.mTextureSurface.setIntOption(33, 1);
        }
    }

    private void _parseDNS(String str) {
        int i;
        boolean z;
        int i2;
        TTVideoEngineLog.i(logcatTag(), "hostnameURL:" + str);
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_parseDNS should stop");
            return;
        }
        this.mState = 2;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        boolean z2 = false;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setDNSStartTime(System.currentTimeMillis(), 0);
        }
        try {
            DNSParser dNSParser = new DNSParser(this.mContext, new URL(str).getHost(), getNetClientSetByUser());
            this.mDNSParser = dNSParser;
            dNSParser.setCompletionListener(new MyDNSCompletionListener(this));
            if (this.mErrorCount != 0) {
                this.mDNSParser.setForceReparse();
            }
            DNSParser dNSParser2 = this.mDNSParser;
            if (this.mUseDNSCache) {
                i = 1;
            } else {
                i = 0;
            }
            if (getConfigInt(18, i) == 1) {
                z = true;
            } else {
                z = false;
            }
            dNSParser2.setIsUseDNSCache(z);
            int configInt = getConfigInt(19, this.mDNSExpiredTime);
            if (configInt > 0) {
                this.mDNSParser.setDNSExpiredTimeInS(configInt);
            }
            if (this.mIsUseServerDns) {
                i2 = 1;
            } else {
                i2 = 0;
            }
            if (getConfigInt(403, i2) == 1) {
                z2 = true;
            }
            if (z2 && this.mVideoModel != null) {
                this.mDNSParser.setIsUseServerDNS(z2);
                this.mDNSParser.setDnsInfo(this.mVideoModel.getDnsInfo(), Long.valueOf(this.mVideoModel.getVideoRefLong(216)));
            }
            this.mDNSParser.start();
        } catch (Exception e) {
            TTVideoEngineLog.d(e);
        }
    }

    private void _seekComplete(boolean z) {
        long max;
        IVideoEventLogger iVideoEventLogger;
        TTVideoEngineLog.i(logcatTag(), "seek complete");
        if (z && (iVideoEventLogger = this.mLogger) != null) {
            iVideoEventLogger.setLoggerTimes(169);
        }
        if (!isInHousePlayer()) {
            this.mSeeking = false;
            this.mSeekingStartTime = 0L;
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (iVideoEventLogger2 != null) {
                iVideoEventLogger2.seekCompleted();
                this.mLogger.showedOneFrame();
            }
        }
        if (this.mSeamSwitchingResolution) {
            this.mSeamSwitchingResolution = false;
            changeResolutionSwitchingState(false);
            IVideoEventLogger iVideoEventLogger3 = this.mLogger;
            if (iVideoEventLogger3 != null) {
                iVideoEventLogger3.switchResolutionEnd(true);
            }
        }
        if (shouldStartTextureRenderCheck()) {
            this.mTextureSurface.setIntOption(33, 1);
        }
        notifySeekCompletion(z);
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null && isPcdnNeedPlayInfo()) {
            long longOption = mediaPlayer.getLongOption(73, -1L);
            long longOption2 = mediaPlayer.getLongOption(72, -1L);
            int intOption = mediaPlayer.getIntOption(62, 0);
            int intOption2 = mediaPlayer.getIntOption(61, 0);
            if (intOption == 1 && intOption2 == 1) {
                max = Math.max(0L, Math.min(longOption, longOption2));
            } else if (intOption2 == 1) {
                max = Math.max(0L, longOption);
            } else if (intOption == 1) {
                max = Math.max(0L, longOption2);
            } else {
                return;
            }
            setPlayInfo(5, max);
        }
    }

    private void _streamChanged(int i) {
        int intOption;
        int i2;
        TTVideoEngineLog.i(logcatTag(), "stream " + i + " changed, state:" + this.mPlaybackState + ", mPrepared:" + (this.mPrepared ? 1 : 0) + ", mLoadState:" + this.mLoadState);
        int i3 = 0;
        if (this.mSeeking) {
            this.mSeeking = false;
            this.mSeekingStartTime = 0L;
        }
        if (getConfigInt(664, this.mEnableDebugUINotify) != 0 && this.mPlayerEventListener != null && this.mMediaPlayer != null) {
            if (i == 0) {
                this.mPlayerEventListener.onVideoInputFormatChanged(getVideoFormatInfo());
            } else if (i == 1) {
                this.mPlayerEventListener.onAudioInputFormatChanged(getVideoFormatInfo());
            }
        }
        if (i == 0 && !this.mDecodedVideoFirstFrame) {
            this.mDecodedVideoFirstFrame = true;
        }
        if (this.mPrepared && this.mPlaybackState != 0 && this.mLoadState != 0) {
            notifyStreamChanged(i);
            if (i == 0 && this.mMediaPlayer != null && this.mTextureSurface != null) {
                if ((getConfigInt(4009, this.mTextureRenderForbidReuseVideoSurfaceTexture) > 0 || getConfigInt(4010, this.mTextureRenderForbidForbidReuseTexture) > 0) && (intOption = this.mMediaPlayer.getIntOption(157, -1)) > 0) {
                    if (getConfigInt(4009, this.mTextureRenderForbidReuseVideoSurfaceTexture) > 0) {
                        VideoSurface videoSurface = this.mTextureSurface;
                        if (intOption != 2) {
                            i2 = 1;
                        } else {
                            i2 = 0;
                        }
                        videoSurface.setIntOption(116, i2);
                    }
                    if (getConfigInt(4010, this.mTextureRenderForbidForbidReuseTexture) > 0) {
                        VideoSurface videoSurface2 = this.mTextureSurface;
                        if (intOption != 2) {
                            i3 = 1;
                        }
                        videoSurface2.setIntOption(117, i3);
                    }
                }
            }
        }
    }

    private void _tryRegisterMdlHandle(MediaPlayer mediaPlayer) {
        boolean z;
        TTVideoEngineLog.i(logcatTag(), "_tryRegisterMdlHandle, player type:" + mediaPlayer.getPlayerType());
        boolean z2 = true;
        if ((!mHasRegisterMdlProto && mediaPlayer.getPlayerType() == 1) || (getConfigInt(5010, this.mExoEnableNativeMdl ? 1 : 0) != 0 && !mHasRegisterMdlProtoForExo && mediaPlayer.getPlayerType() == 5)) {
            long longValue = DataLoaderHelper.getDataLoader().getLongValue(1003);
            if (longValue != -1) {
                DataLoaderHelper.getDataLoader().setIntValue(1004, (int) mediaPlayer.setLongOption(500, longValue));
                if (mediaPlayer.getPlayerType() == 1) {
                    z = true;
                } else {
                    z = false;
                }
                mHasRegisterMdlProto = z;
                if (mediaPlayer.getPlayerType() != 5) {
                    z2 = false;
                }
                mHasRegisterMdlProtoForExo = z2;
            }
            TTVideoEngineLog.i(logcatTag(), "get handle: " + longValue);
        }
    }

    private void _videoBitrateChanged(int i) {
        Resolution resolution = Resolution.Undefine;
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null && iVideoModel.hasData()) {
            Resolution[] allResolutions = Resolution.getAllResolutions();
            int i2 = 0;
            while (true) {
                if (i2 < allResolutions.length) {
                    VideoInfo videoInfo = this.mVideoModel.getVideoInfo(allResolutions[i2], VideoRef.TYPE_VIDEO, (Map<Integer, String>) null);
                    if (videoInfo != null && videoInfo.getValueInt(3) == i) {
                        resolution = allResolutions[i2];
                        this.lastResolution = this.currentResolution;
                        this.currentBitrate = i;
                        this.currentResolution = resolution;
                        this.mCurrentQualityDesc = videoInfo.getValueStr(32);
                        _logFirstResolution(this.currentResolution);
                        this.mLogger.configResolution(_resolutionToString(this.currentResolution), _resolutionToString(this.lastResolution));
                        this.mLogger.setCurrentQualityDesc(this.mCurrentQualityDesc);
                        break;
                    }
                    i2++;
                } else {
                    break;
                }
            }
        }
        TTVideoEngineLog.i(logcatTag(), "video bitrate changed:" + i + ", resoluton:" + resolution.toString(VideoRef.TYPE_VIDEO));
        if (this.mPlaybackState == 2 && this.mSeamSwitchingResolution) {
            this.mSeamSwitchingResolution = false;
            changeResolutionSwitchingState(false);
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            if (iVideoEventLogger != null) {
                iVideoEventLogger.switchResolutionEnd(true);
            }
        } else {
            if (this.mResolutionSwitching) {
                this.mLogger.switchResolutionEnd(false);
            }
            changeResolutionSwitchingState(false);
        }
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(417, i, 0, resolution);
        } else {
            this.mListenerCompact.onVideoStreamBitrateChanged(resolution, i);
        }
        if (this.mEnableABR == 1) {
            this.mLogger.abrEventEnd(i);
        }
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("createMediaPlayer")
    public static MediaPlayer com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_createMediaPlayer(TTVideoEngineImpl tTVideoEngineImpl) {
        MediaPlayer TTVideoEngineImpl__createMediaPlayer$___twin___ = tTVideoEngineImpl.TTVideoEngineImpl__createMediaPlayer$___twin___();
        if (TTVideoEngineImpl__createMediaPlayer$___twin___ != null && d.A().f38144J) {
            String str = (String) tTVideoEngineImpl.get("tag");
            LogWrapper.info("AudioCore-TTVideoEngineAops", "createMediaPlayer playerType = " + TTVideoEngineImpl__createMediaPlayer$___twin___.getPlayerType() + ", tag = " + str, new Object[0]);
            if (TTVideoEngineImpl__createMediaPlayer$___twin___.isOSPlayer() && (str.equals("AudioPlayer-SDK") || str.equals("AudioPlayer"))) {
                PlayAddress currentPlayAddress = com.xs.fm.player.sdk.play.a.a().getCurrentPlayAddress();
                com.dragon.read.component.audio.biz.protocol.core.api.handler.b b2 = NsAudioModuleApi.IMPL.audioCoreContextApi().b();
                String currentChapterId = b2.getCurrentChapterId();
                long v = b2.v();
                if (currentPlayAddress != null && currentPlayAddress.isEncrypt) {
                    try {
                        if (z.f46125a) {
                            LogWrapper.info("AudioCore-TTVideoEngineAops", "osPlayer play encrypt but hasRetry", new Object[0]);
                            com.xs.fm.player.sdk.play.a.a().stop();
                            ToastUtils.showCommonToastSafely("播放器异常,请检测网络或尝试重启应用");
                            return TTVideoEngineImpl__createMediaPlayer$___twin___;
                        }
                        z.f46125a = true;
                        LogWrapper.info("AudioCore-TTVideoEngineAops", "stop last because osPlayer play encrypt", new Object[0]);
                        com.xs.fm.player.sdk.play.a.a().stop();
                        ThreadUtils.postInForegroundAtFrontOfQueue(new z.b(currentChapterId, v));
                    } catch (Throwable th) {
                        th.printStackTrace();
                    }
                }
            }
        }
        return TTVideoEngineImpl__createMediaPlayer$___twin___;
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("_doPlay")
    public static void com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_doPlay(TTVideoEngineImpl tTVideoEngineImpl) {
        TTVideoEngineImpl tTVideoEngineImpl2 = tTVideoEngineImpl;
        LogWrapper.info("AudioCore-TTVideoEngineAops", "_doPlay ,currentTag = " + ((String) tTVideoEngineImpl2.get("tag")) + ", subTag = " + ((String) tTVideoEngineImpl2.get("subtag")), new Object[0]);
        z.a(tTVideoEngineImpl2);
        ae.a();
        tTVideoEngineImpl.TTVideoEngineImpl___doPlay$___twin___();
        try {
            LogWrapper.info("AudioCore-TTVideoEngineAops", "_doPlay ,TTVideoEngine = " + tTVideoEngineImpl, new Object[0]);
            LogWrapper.info("AudioCore-TTVideoEngineAops", "_doPlay ,playPath = " + tTVideoEngineImpl.getCurrentPlayPath(), new Object[0]);
        } catch (Throwable th) {
            LogWrapper.error("AudioCore-TTVideoEngineAops", "_doPlay ,exception = " + th.getMessage(), new Object[0]);
        }
        Npth.addTag("last_player_vid", tTVideoEngineImpl.getVideoID());
    }

    private void initSr(VideoSurface videoSurface) {
        Bundle bundle;
        TTVideoEngineLog.i(logcatTag(), "initSr,mTextureAlgType:" + this.mTextureAlgType);
        if (this.mTextureAlgType != -1 && videoSurface != null) {
            if (this.mLensBundle != null) {
                bundle = new Bundle(this.mLensBundle);
            } else {
                bundle = new Bundle();
            }
            bundle.putInt("effect_type", 5);
            bundle.putInt("action", 21);
            bundle.putInt("srAlgType", this.mTextureAlgType);
            bundle.putInt("srMaxSizeWidth", this.mMaxTextureWidth);
            bundle.putInt("srMaxSizeHeight", this.mMaxTextureHeight);
            bundle.putInt("enable_bmf", EngineGlobalConfig.getInstance().getEnableBmf());
            bundle.putInt("sr_backend", this.mSrBackend);
            bundle.putInt("scale_type", this.mSrScaleType);
            bundle.putInt("pool_size", this.mSrPoolSize);
            bundle.putString("kernelBinPath", this.mTextureSRBinPath);
            bundle.putString("oclModleName", this.mTextureSROclModuleName);
            bundle.putString("dspModleName", this.mTextureSRDspModuleName);
            bundle.putString("moduleName", FeatureManager.getModuleName());
            bundle.putString("programCacheDir", this.mProgramCacheDir);
            bundle.putInt("use_bmf_component", this.mUseBmfComponent);
            bundle.putString("lib_path", this.mSRLibPath);
            videoSurface.setEffect(bundle);
        }
    }

    private void setSRInitConfigWithBundle(Bundle bundle) {
        if (bundle == null) {
            return;
        }
        int i = bundle.getInt("srAlgType");
        String string = bundle.getString("kernelBinPath");
        String string2 = bundle.getString("oclModleName");
        String string3 = bundle.getString("dspModleName");
        int i2 = bundle.getInt("sr_backend");
        int i3 = bundle.getInt("scale_type");
        int i4 = bundle.getInt("pool_size");
        String string4 = bundle.getString("programCacheDir");
        int i5 = bundle.getInt("use_bmf_component");
        String string5 = bundle.getString("lib_path");
        this.mOldTextureAlgType = this.mTextureAlgType;
        this.mTextureAlgType = i;
        this.mTextureSRBinPath = string;
        this.mTextureSROclModuleName = string2;
        this.mTextureSRDspModuleName = string3;
        this.mSrBackend = i2;
        this.mSrScaleType = i3;
        this.mSrPoolSize = i4;
        this.mProgramCacheDir = string4;
        this.mUseBmfComponent = i5;
        this.mSRLibPath = string5;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setSrAlgorithm(i);
            this.mLogger.setSrScaleType(i3);
            this.mLogger.setEnableBmfSr(EngineGlobalConfig.getInstance().getEnableBmf());
        }
        TTVideoEngineLog.i(logcatTag(), "[SRLog]sr init config = " + this.mTextureAlgType + "," + this.mTextureSRBinPath + "," + this.mTextureSROclModuleName + ", " + this.mTextureSRDspModuleName);
    }

    long _doGetLongOption(int i) {
        if (this.mConfigCenterVersion > 0) {
            return _doGetLongOption2(i);
        }
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        try {
            if (i != 81) {
                if (i != 315) {
                    if (i != 461) {
                        if (i != 950) {
                            if (i != 614) {
                                if (i != 615) {
                                    switch (i) {
                                        case 60:
                                            if (this.mBitrate < 0 && mediaPlayer != null) {
                                                this.mBitrate = mediaPlayer.getLongOption(171, 0L);
                                            }
                                            return this.mBitrate;
                                        case 61:
                                            if (mediaPlayer == null) {
                                                return -1L;
                                            }
                                            return mediaPlayer.getLongOption(73, 0L);
                                        case 62:
                                            if (mediaPlayer == null) {
                                                return -1L;
                                            }
                                            return mediaPlayer.getLongOption(72, 0L);
                                        case 63:
                                            if (mediaPlayer == null) {
                                                return -1L;
                                            }
                                            return mediaPlayer.getLongOption(63, -1L);
                                        case 64:
                                            if (mediaPlayer == null) {
                                                return -1L;
                                            }
                                            return mediaPlayer.getLongOption(468, -1L);
                                        default:
                                            return super.getLongOption(i);
                                    }
                                }
                                long j = this.mRenderStartTime;
                                TTVideoEngineLog.i(logcatTag(), "get mRenderStartTime:" + j);
                                return j;
                            }
                            long j2 = this.mPlayStartTime;
                            TTVideoEngineLog.i(logcatTag(), "get mPlayStartTime:" + j2);
                            return j2;
                        }
                        return this.mSendEngineMsgTimeout;
                    }
                    return this.mVideoPreloadSize;
                }
                if (mediaPlayer == null) {
                    return -1L;
                }
                return mediaPlayer.getLongOption(46, 0L);
            }
            if (mediaPlayer == null) {
                return -1L;
            }
            long longOption = mediaPlayer.getLongOption(240, 0L);
            TTVideoEngineLog.i(logcatTag(), "get value of KeyIsLastBufferSizeU64: " + longOption);
            return longOption;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return -1L;
        }
    }

    long _doGetLongOption2(int i) {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        try {
            if (i != 81) {
                if (i != 315) {
                    if (i != 461) {
                        if (i != 614) {
                            if (i != 615) {
                                switch (i) {
                                    case 60:
                                        if (this.mBitrate < 0 && mediaPlayer != null) {
                                            this.mBitrate = mediaPlayer.getLongOption(171, 0L);
                                        }
                                        return this.mBitrate;
                                    case 61:
                                        if (mediaPlayer == null) {
                                            return -1L;
                                        }
                                        return mediaPlayer.getLongOption(73, 0L);
                                    case 62:
                                        if (mediaPlayer == null) {
                                            return -1L;
                                        }
                                        return mediaPlayer.getLongOption(72, 0L);
                                    case 63:
                                        if (mediaPlayer == null) {
                                            return -1L;
                                        }
                                        return mediaPlayer.getLongOption(63, -1L);
                                    case 64:
                                        if (mediaPlayer == null) {
                                            return -1L;
                                        }
                                        return mediaPlayer.getLongOption(468, -1L);
                                    default:
                                        return super.getLongOption(i);
                                }
                            }
                            long j = this.mRenderStartTime;
                            TTVideoEngineLog.i(logcatTag(), "get mRenderStartTime:" + j);
                            return j;
                        }
                        long j2 = this.mPlayStartTime;
                        TTVideoEngineLog.i(logcatTag(), "get mPlayStartTime:" + j2);
                        return j2;
                    }
                    return this.mVideoPreloadSize;
                }
                if (mediaPlayer == null) {
                    return -1L;
                }
                return mediaPlayer.getLongOption(46, 0L);
            }
            if (mediaPlayer == null) {
                return -1L;
            }
            long longOption = mediaPlayer.getLongOption(240, 0L);
            TTVideoEngineLog.i(logcatTag(), "get value of KeyIsLastBufferSizeU64: " + longOption);
            return longOption;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return -1L;
        }
    }

    String _doGetStringOption(int i) {
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        String str = "";
        try {
            if (i != 80) {
                if (i != 82) {
                    if (i != 462) {
                        if (i != 477) {
                            if (i != 716) {
                                if (i != 957) {
                                    return super.getStringOption(i);
                                }
                                if (mediaPlayer == null) {
                                    return "";
                                }
                                return mediaPlayer.getStringOption(1002);
                            }
                            if (mediaPlayer == null) {
                                return "";
                            }
                            return mediaPlayer.getStringOption(473);
                        }
                        IVideoEventLogger iVideoEventLogger = this.mLogger;
                        if (iVideoEventLogger == null) {
                            return "";
                        }
                        return iVideoEventLogger.getStringOption(47);
                    }
                    Map<String, IpInfo> map = this.urlIPMap;
                    if (map == null) {
                        return "";
                    }
                    for (Map.Entry<String, IpInfo> entry : map.entrySet()) {
                        String key = entry.getKey();
                        IpInfo value = entry.getValue();
                        if (key != null && value != null) {
                            HashMap hashMap = new HashMap();
                            hashMap.put("ip", value.ip);
                            hashMap.put("dns", value.dns);
                            hashMap.put("dns_cache_open", Integer.valueOf(value.isDNSCacheOpen));
                            hashMap.put("server_dns_open", Integer.valueOf(value.isServerDNSOpen));
                            hashMap.put("url_desc", value.urlDesc);
                            str = hashMap.toString();
                        }
                    }
                    return str;
                }
                if (TTVideoEngine.isForceUsePluginPlayer()) {
                    return MediaPlayerWrapper.getPluginVersion();
                }
                return TTPlayerConfiger.getValue(14, "");
            }
            if (mediaPlayer == null) {
                return "";
            }
            return mediaPlayer.getStringOption(142);
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return "";
        }
    }

    void _doParseDNSComplete(String str) {
        String replaceFirst;
        DNSParser dNSParser;
        IpInfo ipInfo;
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_doParseDNSComplete should stop");
            return;
        }
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setDNSParseTime(System.currentTimeMillis(), 0);
        }
        String host = Uri.parse(this.mURLInfo.hostURL).getHost();
        TTVideoEngineLog.i(logcatTag(), "dns success, host:" + host + ", ip:" + str);
        String str2 = "";
        if (!TextUtils.isEmpty(host)) {
            try {
            } catch (Exception e) {
                TTVideoEngineLog.e(logcatTag(), e.toString());
            }
            if (this.mURLInfo.hostURL != null) {
                replaceFirst = this.mURLInfo.hostURL.replaceFirst(host, str);
                dNSParser = this.mDNSParser;
                if (dNSParser != null) {
                    str2 = dNSParser.getTypeStr();
                }
                String str3 = str2;
                ipInfo = this.urlIPMap.get(this.mURLInfo.hostURL);
                if (ipInfo == null) {
                    ipInfo.ip = str;
                    ipInfo.dns = str3;
                } else {
                    this.urlIPMap.put(this.mURLInfo.hostURL, new IpInfo(str, str3, this.mDNSParser.getIsUseDNSCache() ? 1 : 0, this.mDNSParser.getIsUseServerDNS() ? 1 : 0, ""));
                }
                _updateVU();
                _logFirstURL(this.mURLInfo.hostURL);
                _logFirstHost(host);
                _logFirstIP(str);
                _playVideo(host, replaceFirst);
            }
        }
        replaceFirst = "";
        dNSParser = this.mDNSParser;
        if (dNSParser != null) {
        }
        String str32 = str2;
        ipInfo = this.urlIPMap.get(this.mURLInfo.hostURL);
        if (ipInfo == null) {
        }
        _updateVU();
        _logFirstURL(this.mURLInfo.hostURL);
        _logFirstHost(host);
        _logFirstIP(str);
        _playVideo(host, replaceFirst);
    }

    void _doSetVideoModel(IVideoModel iVideoModel) {
        String videoRefStr = iVideoModel.getVideoRefStr(2);
        if (TextUtils.isEmpty(videoRefStr)) {
            TTVideoEngineLog.i(logcatTag(), "_doSetVideoModel vid is empty");
            return;
        }
        if (!iVideoModel.equals(this.mVideoModel) && (!TTVideoEngineUtils.isFlagOn(EngineGlobalConfig.getInstance().getEngineOptimizeFlag(), 1L) || this.mEngineHasUsed)) {
            TTVideoEngineLog.i(logcatTag(), "_doSetVideoModel VideoModel is new");
            _ShutdownOldSource();
            this.mIsLocal = false;
            this.mFirstURL = true;
            this.mFirstIP = true;
            this.mFirstHost = true;
            this.mState = 0;
            this.mUserStopped = false;
            this.mLastPlaybackTime = 0;
            this.mFetcher = null;
            this.mAPIString = null;
        }
        this.mEngineHasUsed = true;
        this.mStarted = false;
        this.mVideoModel = iVideoModel;
        this.mKeyseed = iVideoModel.getVideoRefStr(218);
        String videoRefStr2 = this.mVideoModel.getVideoRefStr(217);
        this.mFallbackAPI = videoRefStr2;
        if (!TextUtils.isEmpty(videoRefStr2)) {
            this.mLogger.setIntOption(172, 1);
        }
        this.mVideoModelVersion = this.mVideoModel.getVideoRefInt(9);
        this.mVideoModel.setUpResolution(this.mResolutionMap);
        this.mVideoID = videoRefStr;
        boolean hasFormat = this.mVideoModel.hasFormat(IVideoModel.Format.DASH);
        this.mIsDashSource = hasFormat;
        this.mDashEnabled = hasFormat;
        this.mEngineConfig.setIntOption(17, this.mIsDashSource ? 1 : 0);
        mdlFetcherStore();
        this.mIsFeedInfo = true;
        this.mBufferingStartT = 0L;
        this.mLogger.setSourceType(4, this.mVideoID);
        this.mLogger.setFeed(iVideoModel);
        this.mFileKey = null;
        TTVideoEngineLog.i(logcatTag(), "set video model, fallback api:" + this.mFallbackAPI + ",keyseed:" + this.mKeyseed);
        if (this.mEnableTmpLog == 1) {
            showLongLog(this.mVideoModel.toMediaInfoJsonString());
        }
    }

    void _play(boolean z) {
        TTAVPreloaderItem tTAVPreloaderItem;
        TTVideoEngineLog.i(logcatTag(), "_play, mState:" + this.mState + ", byPlay:" + z + ", this:" + this);
        this.mStarted = true;
        this.mPausedBeforePrepared = false;
        if (z) {
            setSpeedTest();
        }
        _initUsingHandle();
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            if (z) {
                iVideoEventLogger.setLoggerTimes(64);
                if (this.mPlayStartTime < 0) {
                    this.mPlayStartTime = SystemClock.elapsedRealtime();
                    TTVideoEngineLog.i(logcatTag(), "mPlayStartTime:" + this.mPlayStartTime + ", curT:" + System.currentTimeMillis());
                }
            } else {
                iVideoEventLogger.setIntOption(31, 1);
                this.mLogger.setLoggerTimes(65);
            }
            this.mLogger.play(z);
        }
        int i = this.mState;
        if (i != 0) {
            if (i != 1) {
                if (i != 3) {
                    if (i != 4) {
                        return;
                    }
                } else {
                    _replayOrResume();
                    return;
                }
            } else if (this.mVideoModel == null) {
                if (!this.mIsFetchingInfo) {
                    _prepareToPlay();
                    return;
                }
                return;
            } else {
                if (this.mIsPreloaderItem && (tTAVPreloaderItem = this.mPreloaderItem) != null) {
                    _logBeginToPlay(tTAVPreloaderItem.mVideoID);
                } else {
                    _logBeginToPlay(this.mVideoID);
                }
                _parseIPAddress(this.mVideoModel);
                return;
            }
        }
        _prepareToPlay();
    }

    @Override
    public String getDubbedMemUrl(List<DubbedInfo> list) {
        JSONArray jSONArray;
        DubbedInfo dubbedInfo;
        JSONArray jSONArray2;
        JSONArray jSONArray3;
        TTVideoEngineImpl tTVideoEngineImpl = this;
        if (list != null) {
            try {
                if (list.size() > 0) {
                    JSONObject jSONObject = new JSONObject();
                    JSONArray jSONArray4 = new JSONArray();
                    JSONArray jSONArray5 = new JSONArray();
                    for (DubbedInfo dubbedInfo2 : list) {
                        if (dubbedInfo2 != null) {
                            if (!TextUtils.isEmpty(dubbedInfo2.mFileKey)) {
                                jSONArray = jSONArray5;
                                jSONArray2 = jSONArray4;
                                String _mdlUrl = _mdlUrl(dubbedInfo2.mFileKey, null, tTVideoEngineImpl.getConfigInt(161, tTVideoEngineImpl.mLimitMDLCacheSize), dubbedInfo2.getUrls(), Resolution.Undefine, null, null, null, null, 0L, null);
                                if (!TextUtils.isEmpty(_mdlUrl)) {
                                    dubbedInfo = dubbedInfo2;
                                    dubbedInfo.mMainUrl = _mdlUrl;
                                    dubbedInfo.mBackupUrl1 = _mdlUrl;
                                } else {
                                    dubbedInfo = dubbedInfo2;
                                }
                            } else {
                                jSONArray = jSONArray5;
                                dubbedInfo = dubbedInfo2;
                                jSONArray2 = jSONArray4;
                            }
                            JSONObject bashJsonObject = dubbedInfo.toBashJsonObject();
                            if (bashJsonObject == null) {
                                jSONArray4 = jSONArray2;
                                jSONArray5 = jSONArray;
                            } else {
                                if (dubbedInfo.mMediaType == 0) {
                                    jSONArray2.put(bashJsonObject);
                                } else if (dubbedInfo.mMediaType == 1) {
                                    jSONArray3 = jSONArray;
                                    jSONArray3.put(bashJsonObject);
                                    jSONArray5 = jSONArray3;
                                    jSONArray4 = jSONArray2;
                                }
                                jSONArray3 = jSONArray;
                                jSONArray5 = jSONArray3;
                                jSONArray4 = jSONArray2;
                            }
                            tTVideoEngineImpl = this;
                        }
                    }
                    jSONObject.put("dynamic_video_list", jSONArray4);
                    jSONObject.put("dynamic_audio_list", jSONArray5);
                    return "mem://bash/url_index:0/segment_format:1/" + jSONObject.toString();
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return null;
    }

    @Override
    protected void onMediaPlayerCompletion(MediaPlayer mediaPlayer) {
        TTVideoEngineLog.i(logcatTag(), "receive onCompletion,this:" + this);
        this.mLogger.watchFinish();
        if (!this.mLooping) {
            this.mIsPlayComplete = true;
            updatePlaybackState(0);
            if (this.mPlayDuration != null) {
                this.mPlayDuration.stop();
                this.mLogger.addWatchedDuration(this.mPlayDuration.getPlayedDuration());
            }
            _updateCurrentPlaybackPosition(this.mDuration, true);
            this.mLogger.curPlayBackTime(this.mDuration);
            _updateLogger();
            this.mLogger.movieFinish(3);
            this.mHasFirstFrameShown = false;
            this.mHasFetchedSubtitle = false;
            this.mPlayStartTime = -1L;
            this.mRenderStartTime = -1L;
            this.mHasAudioFirstFrameShown = false;
            this.mSeamSwitchingResolution = false;
            changeResolutionSwitchingState(false);
            this.mLastPlaybackTime = 0;
            this.mRetrying = false;
            this.mStarted = false;
            this.mHasComplete = true;
            this.mSeeking = false;
            _updateTextureState(3);
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                videoSurface.setIntOption(33, 0);
            }
        } else {
            this.mLogger.loopAgain();
        }
        notifyCompletion();
        if (mediaPlayer.isOSPlayer()) {
            this.mPrepared = false;
        }
        this.mStartTime = 0;
    }

    @Override
    public void setEffect(Bundle bundle) {
        TTVideoEngineLog.d(logcatTag(), "setEffect:" + bundle.toString() + " TextureSurface:" + this.mTextureSurface);
        if (bundle != null && bundle.getInt("action") == 21 && bundle.getInt("effect_type") == 5) {
            setSRInitConfigWithBundle(bundle);
        } else if (bundle != null && bundle.getInt("effect_type") == 1) {
            bundle.putBoolean("HasFirstFrameShown", this.mHasFirstFrameShown);
            this.mTRSrategy.setEffect(bundle, this.mTextureSurface);
        } else {
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                videoSurface.setEffect(bundle);
            } else {
                this.mEffectBundle.offer(bundle);
            }
        }
        this.mLogger.setEffect(bundle);
        if (bundle != null) {
            try {
                if (bundle.containsKey("effect_type")) {
                    this.effectTypeSet.add(Integer.valueOf(bundle.getInt("effect_type")));
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    public class AnonymousClass7 extends Handler {
        @Override
        public void handleMessage(Message message) {
            String str;
            String str2;
            super.handleMessage(message);
            if (message.what == 10) {
                String str3 = (String) message.obj;
                long j = message.arg1;
                int i = message.arg2;
                String str4 = TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.get(UGCMonitor.TYPE_VIDEO);
                String str5 = TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.get("audio");
                if (TTVideoEngineImpl.this.mState == 5) {
                    return;
                }
                if (!TextUtils.isEmpty(str5) && str5.equals(str3)) {
                    if (TTVideoEngineImpl.this.mLogger != null) {
                        TTVideoEngineImpl.this.mLogger.setDashAudioCacheSize(j);
                        TTVideoEngineImpl.this.mLogger.setIntOption(183, i);
                    }
                } else if (!TextUtils.isEmpty(str4) && str4.equals(str3) && TTVideoEngineImpl.this.mLogger != null) {
                    TTVideoEngineImpl.this.mLogger.setDashVideoCacheSize(j);
                    TTVideoEngineImpl.this.mLogger.setIntOption(182, i);
                }
                String str6 = "";
                if (TTVideoEngineImpl.this.mUsingDataLoaderPlayFilePaths != null && TTVideoEngineImpl.this.mUsingDataLoaderPlayFilePaths.contains(str3)) {
                    TTVideoEngineImpl.this.mVideoPreloadSize += j;
                    if (TTVideoEngineImpl.this.mLogger != null) {
                        TTVideoEngineImpl.this.mLogger.setVideoCacheSize(TTVideoEngineImpl.this.mVideoPreloadSize);
                        TTVideoEngineImpl.this.mLogger.setIntOption(181, i);
                    }
                    String logcatTag = TTVideoEngineImpl.this.logcatTag();
                    StringBuilder sb = new StringBuilder();
                    sb.append("using mdl cache, key :");
                    sb.append(str3);
                    sb.append(" size = ");
                    sb.append(j);
                    sb.append(" vid = ");
                    if (TextUtils.isEmpty(TTVideoEngineImpl.this.mVideoID)) {
                        str2 = "";
                    } else {
                        str2 = TTVideoEngineImpl.this.mVideoID;
                    }
                    sb.append(str2);
                    sb.append(" groupid = ");
                    if (!TextUtils.isEmpty(TTVideoEngineImpl.this.mMDLGroupId)) {
                        str6 = TTVideoEngineImpl.this.mMDLGroupId;
                    }
                    sb.append(str6);
                    sb.append(" miss reason = ");
                    sb.append(i);
                    TTVideoEngineLog.i(logcatTag, sb.toString());
                    if ((TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.size() < 2 || TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.containsValue(str3)) && TTVideoEngineImpl.this.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
                        videoEngineInfos.setKey("mdlfilepathhitcachesize");
                        videoEngineInfos.mUsingMDLPlayFilePath = str3;
                        videoEngineInfos.mHitCacheSize = j;
                        TTVideoEngineImpl.this.notifyEngineInfo(videoEngineInfos, true);
                        return;
                    }
                    return;
                }
                if (TTVideoEngineImpl.this.mUsingDataLoaderPlayTaskKeys != null && TTVideoEngineImpl.this.mUsingDataLoaderPlayTaskKeys.contains(str3)) {
                    TTVideoEngineImpl.this.mVideoPreloadSize += j;
                    if (TTVideoEngineImpl.this.mLogger != null) {
                        TTVideoEngineImpl.this.mLogger.setVideoCacheSize(TTVideoEngineImpl.this.mVideoPreloadSize);
                    }
                    String logcatTag2 = TTVideoEngineImpl.this.logcatTag();
                    StringBuilder sb2 = new StringBuilder();
                    sb2.append("using mdl cache, key :");
                    sb2.append(str3);
                    sb2.append(" size = ");
                    sb2.append(j);
                    sb2.append(" vid = ");
                    if (TextUtils.isEmpty(TTVideoEngineImpl.this.mVideoID)) {
                        str = "";
                    } else {
                        str = TTVideoEngineImpl.this.mVideoID;
                    }
                    sb2.append(str);
                    sb2.append(" groupid = ");
                    if (!TextUtils.isEmpty(TTVideoEngineImpl.this.mMDLGroupId)) {
                        str6 = TTVideoEngineImpl.this.mMDLGroupId;
                    }
                    sb2.append(str6);
                    sb2.append(" miss reason = ");
                    sb2.append(i);
                    TTVideoEngineLog.i(logcatTag2, sb2.toString());
                    if ((TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.size() < 2 || TTVideoEngineImpl.this.mBashDashDefaultMDLKeys.containsValue(str3)) && TTVideoEngineImpl.this.mVideoEngineInfoListener != null) {
                        VideoEngineInfos videoEngineInfos2 = new VideoEngineInfos();
                        videoEngineInfos2.setKey("mdlhitcachesize");
                        videoEngineInfos2.mUsingMDLPlayTaskKey = str3;
                        videoEngineInfos2.mHitCacheSize = j;
                        TTVideoEngineImpl.this.notifyEngineInfo(videoEngineInfos2, true);
                        return;
                    }
                    return;
                }
                return;
            }
            if (message.what == 33) {
                TTVideoEngineImpl.this._doResetByPool();
            }
        }

        AnonymousClass7(Looper looper) {
            super(looper);
        }
    }

    private i _initABRModule(IVideoModel iVideoModel) {
        boolean z;
        float f;
        float f2;
        float f3;
        float f4;
        DefaultABRModule defaultABRModule = null;
        if (iVideoModel != null && (this.mEnableABR != 0 || this.mStandAlongAbrStartUp != 0)) {
            if (!isSupportSeamlessSwitch(iVideoModel) && this.mStandAlongAbrStartUp <= 0) {
                return null;
            }
            if (this.mEnableABR != 1 && !this.mABRUsed) {
                z = false;
            } else {
                z = true;
            }
            this.mABRUsed = z;
            TTVideoEngineLog.d(logcatTag(), "[ABR] init ABR, algorithm type:" + TTVideoEngine.sABRAlgorithmType);
            c.b(getConfigInt(501, this.mABRSwitchSensitivity));
            c.b(getConfigFloat(527, this.mABRStallPenaltyParameter));
            c.c(getConfigFloat(528, this.mABRSwitchPenaltyParameter));
            c.d(getConfigFloat(529, this.mABRBandwidthParameter));
            defaultABRModule = new DefaultABRModule();
            defaultABRModule.a(new MyPlayStateSupplier(this));
            defaultABRModule.a(34, getConfigInt(334, this.mScreenWidth));
            defaultABRModule.a(35, getConfigInt(335, this.mScreenHeight));
            defaultABRModule.a(6, this.mPlayerViewWidth);
            defaultABRModule.a(7, this.mPlayerViewHeight);
            defaultABRModule.a(26, this.mPlayStartTimestamp);
            float f5 = 0.0f;
            if (StrategyCenter.sNetAbrSpeedPredictor != null) {
                Map<String, String> b2 = StrategyCenter.sNetAbrSpeedPredictor.b(VideoRef.TYPE_VIDEO);
                if (b2 != null && b2.get("download_speed") != null) {
                    f5 = Float.parseFloat(b2.get("download_speed"));
                }
                f3 = StrategyCenter.sNetAbrSpeedPredictor.a(0);
                f4 = StrategyCenter.sNetAbrSpeedPredictor.e();
                f2 = StrategyCenter.sNetAbrSpeedPredictor.a(VideoRef.TYPE_VIDEO, 1, true);
                f = StrategyCenter.sNetAbrSpeedPredictor.a(VideoRef.TYPE_VIDEO, this.mABRStartupSpeedType, false);
            } else {
                f = 0.0f;
                f2 = 0.0f;
                f3 = 0.0f;
                f4 = 0.0f;
            }
            defaultABRModule.a(25, f5);
            defaultABRModule.a(23, f3);
            defaultABRModule.a(24, f4);
            defaultABRModule.a(27, f2);
            defaultABRModule.a(28, f);
            defaultABRModule.a(21, TTNetWorkListener.getInstance().getCurrentAccessType());
            setMediaInfo2Abr(defaultABRModule, iVideoModel);
        }
        return defaultABRModule;
    }

    private void _logFirstURL(String str) {
        String str2;
        VideoInfo videoInfo;
        if (TextUtils.isEmpty(str)) {
            TTVideoEngineLog.d(logcatTag(), "log first url . url is null");
            return;
        }
        String[] strArr = null;
        if (this.mFirstURL) {
            int i = 0;
            this.mFirstURL = false;
            String str3 = "";
            if (str.startsWith("mem://bash") && (videoInfo = this.currentVideoInfo) != null) {
                if (videoInfo.getMediatype() == VideoRef.TYPE_VIDEO) {
                    if (this.mEnableTmpLog == 1) {
                        showLongLog("brian parse first url, resolution:" + _resolutionToString(this.currentResolution));
                    }
                    str2 = this.dashVideoUrlMap.get(this.currentResolution);
                    if (str2 == null || str2.isEmpty()) {
                        str2 = str;
                    }
                    for (Map.Entry<Integer, String> entry : this.dashAudioUrlMap.entrySet()) {
                        if (i == 0) {
                            try {
                                i = entry.getKey().intValue();
                            } catch (Exception e) {
                                TTVideoEngineLog.d(logcatTag(), e.getMessage());
                            }
                        } else if (i > entry.getKey().intValue()) {
                            i = entry.getKey().intValue();
                        }
                    }
                    if (i > 0) {
                        str3 = this.dashAudioUrlMap.get(Integer.valueOf(i));
                    }
                    this.mLogger.setInitialURL(str2, str3);
                    IVideoEventLogger iVideoEventLogger = this.mLogger;
                    if (!TextUtils.isEmpty(this.mInitialUrlBeforeMdlProxy)) {
                        str2 = this.mInitialUrlBeforeMdlProxy;
                    }
                    iVideoEventLogger.initContentReporterIfNeeded(str2);
                    this.mInitialUrlBeforeMdlProxy = null;
                } else if (this.currentVideoInfo.getMediatype() == VideoRef.TYPE_AUDIO) {
                    str3 = this.dashAudioUrlMap.get(Integer.valueOf(this.currentVideoInfo.getValueInt(3)));
                }
            }
            str2 = str;
            this.mLogger.setInitialURL(str2, str3);
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (!TextUtils.isEmpty(this.mInitialUrlBeforeMdlProxy)) {
            }
            iVideoEventLogger2.initContentReporterIfNeeded(str2);
            this.mInitialUrlBeforeMdlProxy = null;
        }
        VideoInfo videoInfo2 = this.currentVideoInfo;
        if (videoInfo2 != null) {
            strArr = videoInfo2.getValueStrArr(16);
        } else {
            IVideoModel iVideoModel = this.mVideoModel;
            if (iVideoModel != null) {
                strArr = iVideoModel.allVideoURLs(this.currentResolution, this.currentParams);
            }
        }
        if (strArr != null && strArr.length > 0) {
            int intValue = this.urlIndexMap.get(this.currentResolution).intValue();
            if (intValue < strArr.length) {
                this.mLogger.setCurURL(strArr[intValue]);
                TTVideoEngineLog.i(logcatTag(), "find curUrl:" + strArr[intValue]);
                return;
            }
            this.mLogger.setCurURL(str);
            TTVideoEngineLog.i(logcatTag(), "set curUrl:" + str);
            return;
        }
        this.mLogger.setCurURL(str);
        TTVideoEngineLog.i(logcatTag(), "set curUrl:" + str);
    }

    private void _setupMediaCodec(MediaPlayer mediaPlayer) {
        TTVideoEngineLog.i("TTVideoEngine", "start to setup mediacodec");
        if (!this.mEnableSetupMediaCodec) {
            TTVideoEngineLog.d("TTVideoEngine", "disable setup mediacodec");
            return;
        }
        if (mediaPlayer == null) {
            TTVideoEngineLog.i("TTVideoEngine", "async player is null");
            return;
        }
        if (this.mHardwareDecodeEnablePlayer2 <= 0) {
            TTVideoEngineLog.d("TTVideoEngine", "not be hardware decoder");
            return;
        }
        if (getConfigInt(332, this.mUseCodecPool) <= 0) {
            TTVideoEngineLog.d("TTVideoEngine", "codec pool is not used");
            return;
        }
        if (getConfigInt(1125, this.mCodecPoolVersion) != 2) {
            TTVideoEngineLog.d("TTVideoEngine", "codec pool version is not 2.0");
            return;
        }
        mediaPlayer.setIntOption(59, 1);
        mediaPlayer.setIntOption(400, 1);
        mediaPlayer.setIntOption(1344, 2);
        mediaPlayer.setIntOption(181, 1);
        mediaPlayer.setIntOption(182, this.mCodecId);
        mediaPlayer.setIntOption(88, getConfigInt(IVideoLayerCommand.VIDEO_HOST_CMD_CLICK_PLAY, this.mMediaCodecRender));
        mediaPlayer.setIntOption(285, getConfigInt(490, this.mCodecFrcLevel));
        mediaPlayer.setIntOption(574, getConfigInt(578, this.mEnableVC1BlockList));
        mediaPlayer.setIntOption(575, getConfigInt(579, this.mEnableHChipAdaptiveWorkAround));
        mediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_PRE_RENDER_BUFFERING_UPDATE_PRECENTAGE, getConfigInt(580, this.mEnableMChipSkipAdaptiveWorkAround));
        mediaPlayer.setIntOption(164, getConfigInt(572, this.mEnableMediaCodecRealtime));
        mediaPlayer.setIntOption(254, getConfigInt(333, this.mNeedAdaptiveWorkaround));
        mediaPlayer.setIntOption(1055, getConfigInt(854, this.mEnableHWDropFrameWhenVOIsInDropState));
        mediaPlayer.setIntOption(1056, getConfigInt(855, this.mEnableHWDropFrameWhenAVOutSyncing));
        mediaPlayer.setIntOption(1072, getConfigInt(1210, this.mEnableMediaCodecFairMutex));
        if (getConfigInt(979, this.mMCMaxHeight) <= 0 || getConfigInt(978, this.mMCMaxWidth) <= 0) {
            this.mEngineConfig.setIntOption(979, 1080);
            this.mEngineConfig.setIntOption(978, 1920);
        }
        mediaPlayer.setIntOption(1009, getConfigInt(979, this.mMCMaxHeight));
        mediaPlayer.setIntOption(1008, getConfigInt(978, this.mMCMaxWidth));
        if (this.mMaxCodecNumsInPool != -1 || this.mEngineConfig.isKeySet(986)) {
            mediaPlayer.setIntOption(1041, getConfigInt(986, this.mMaxCodecNumsInPool));
        }
        if (this.mDiscardCodecStrategy1 != -1 || this.mEngineConfig.isKeySet(1126)) {
            mediaPlayer.setIntOption(1345, getConfigInt(1126, this.mDiscardCodecStrategy1));
        }
        if (this.mDiscardCodecStrategy2 != -1 || this.mEngineConfig.isKeySet(1127)) {
            mediaPlayer.setIntOption(1346, getConfigInt(1127, this.mDiscardCodecStrategy2));
        }
        if (this.mCodecHistoryLength != -1 || this.mEngineConfig.isKeySet(1128)) {
            mediaPlayer.setIntOption(1347, getConfigInt(1128, this.mCodecHistoryLength));
        }
        if (this.mCodecMaxUsedCount != -1 || this.mEngineConfig.isKeySet(1129)) {
            mediaPlayer.setIntOption(1348, getConfigInt(1129, this.mCodecMaxUsedCount));
        }
        if (this.mDummySurfaceForbid != -1 || this.mEngineConfig.isKeySet(976)) {
            mediaPlayer.setIntOption(1034, getConfigInt(976, this.mDummySurfaceForbid));
        }
        if (this.mSettingCodecName != -1 || this.mEngineConfig.isKeySet(956)) {
            mediaPlayer.setIntOption(1003, getConfigInt(956, this.mSettingCodecName));
            for (int i = 0; i < this.mPrivCodecName.size(); i++) {
                try {
                    mediaPlayer.setStringOption(1002, this.mPrivCodecName.get(i));
                } catch (IndexOutOfBoundsException unused) {
                    TTVideoEngineLog.w("TTVideoEngine", "failed to set codec name");
                    mediaPlayer.setIntOption(1003, 0);
                }
            }
        }
        if (this.mMediaCodecAsyncModeEnable != -1 || this.mEngineConfig.isKeySet(955)) {
            mediaPlayer.setIntOption(1000, getConfigInt(955, this.mMediaCodecAsyncModeEnable));
        }
        if (this.mCodecFramesDrop != -1 || this.mEngineConfig.isKeySet(856)) {
            mediaPlayer.setIntOption(1057, getConfigInt(856, this.mCodecFramesDrop));
        }
        if (this.mEnableMediaCodecDeathCheck != -1 || this.mEngineConfig.isKeySet(1111)) {
            mediaPlayer.setIntOption(1326, getConfigInt(1111, this.mEnableMediaCodecDeathCheck));
        }
        if (this.mMediaCodecDeathCheckInterval != -1 || this.mEngineConfig.isKeySet(1112)) {
            mediaPlayer.setIntOption(1327, getConfigInt(1112, this.mMediaCodecDeathCheckInterval));
        }
        if (this.mMediaCodecDeathTimeout != -1 || this.mEngineConfig.isKeySet(1113)) {
            mediaPlayer.setIntOption(1328, getConfigInt(1113, this.mMediaCodecDeathTimeout));
        }
        if (this.mEnableMediaCodecPipeline != -1 || this.mEngineConfig.isKeySet(1118)) {
            mediaPlayer.setIntOption(1333, getConfigInt(1118, this.mEnableMediaCodecPipeline));
        }
        if (this.mFrameNumsInMediaCodec != -1 || this.mEngineConfig.isKeySet(1119)) {
            mediaPlayer.setIntOption(1334, getConfigInt(1119, this.mFrameNumsInMediaCodec));
        }
        if (this.mQueryAdaptivePlayback != -1 || this.mEngineConfig.isKeySet(998)) {
            mediaPlayer.setIntOption(1313, getConfigInt(998, this.mQueryAdaptivePlayback));
        }
        int i2 = this.mUseQcomVpp;
        if (i2 == 1) {
            mediaPlayer.setIntOption(212, i2);
            mediaPlayer.setIntOption(213, this.mQcomVppLevel);
        }
        if (this.mEnableVideoCodecPixelAlign == 1 || this.mEngineConfig.isKeySet(339)) {
            mediaPlayer.setIntOption(280, getConfigInt(339, this.mEnableVideoCodecPixelAlign));
        }
        OptionHolder optionHolder = this.mOptionHolder;
        if (optionHolder != null) {
            mediaPlayer.setIntOption(42039, getConfigInt(42039, optionHolder.getIntOption(42039, 0)));
        }
        ((MediaPlayerWrapper) mediaPlayer).setupMediaCodec();
        this.mEnableSetupMediaCodec = false;
        TTVideoEngineLog.i(logcatTag(), "success to setup mediacodec");
    }

    int _doGetIntOption(int i) {
        long wiredPlayedDuration;
        int i2;
        VideoInfo videoInfo;
        if (this.mConfigCenterVersion > 0) {
            return _doGetIntOption2(i);
        }
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        int i3 = 0;
        i3 = 0;
        i3 = 0;
        i3 = 0;
        try {
            if (i != 0) {
                if (i != 4) {
                    if (i != 58) {
                        if (i != 59) {
                            if (i != 83) {
                                if (i != 84) {
                                    if (i != 301) {
                                        if (i != 302) {
                                            if (i != 424) {
                                                if (i != 425) {
                                                    if (i != 700) {
                                                        if (i != 701) {
                                                            switch (i) {
                                                                case 4:
                                                                    break;
                                                                case ConstantsAPI.COMMAND_OPEN_BUSINESS_VIEW:
                                                                    i3 = this.mReuseSocket;
                                                                    break;
                                                                case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
                                                                case 494:
                                                                    i3 = this.mEnableABR;
                                                                    break;
                                                                case 33:
                                                                    i3 = this.mBashEnabled;
                                                                    break;
                                                                case IVideoEventLogger.LOGGER_OPTION_IS_DEGRADE_RELEASE:
                                                                    if (this.mSeamSwitchingResolution) {
                                                                        i3 = this.mLastPlaybackTime;
                                                                        break;
                                                                    } else {
                                                                        i3 = _getPlayerTime();
                                                                        break;
                                                                    }
                                                                case 160:
                                                                    i3 = this.mDataLoaderEnable;
                                                                    break;
                                                                case 199:
                                                                    i3 = this.mUseTextureRender;
                                                                    break;
                                                                case 313:
                                                                    i3 = this.mCheckHijack;
                                                                    break;
                                                                case 343:
                                                                    if (mediaPlayer != null) {
                                                                        i3 = mediaPlayer.getIntOption(643, 0);
                                                                        break;
                                                                    }
                                                                    i3 = -1;
                                                                    break;
                                                                case 371:
                                                                    if (mediaPlayer != null) {
                                                                        i3 = mediaPlayer.getIntOption(540, -1);
                                                                        break;
                                                                    }
                                                                    i3 = -1;
                                                                    break;
                                                                case 499:
                                                                    i3 = this.mEnableBarrageMask;
                                                                    break;
                                                                case 512:
                                                                    i3 = this.mEnableAIBarrage;
                                                                    break;
                                                                case 525:
                                                                    i3 = this.mABRSpeedPredictOutType;
                                                                    break;
                                                                case 530:
                                                                    i3 = this.mCurrentSubId;
                                                                    break;
                                                                case 533:
                                                                    i3 = this.mEnableSub;
                                                                    break;
                                                                case 596:
                                                                    i3 = this.mSeekMode;
                                                                    break;
                                                                case 650:
                                                                    i3 = this.mOverlayMode;
                                                                    break;
                                                                case 655:
                                                                    if (mediaPlayer != null) {
                                                                        i3 = mediaPlayer.getIntOption(541, 0);
                                                                        break;
                                                                    }
                                                                    i3 = -1;
                                                                    break;
                                                                case 660:
                                                                    i2 = this.mSRNotUseReason;
                                                                    if (i2 >= 0) {
                                                                        VideoSurface videoSurface = this.mTextureSurface;
                                                                        if (videoSurface == null) {
                                                                            if (this.mStarted) {
                                                                                i3 = -7893;
                                                                                break;
                                                                            } else {
                                                                                i3 = -7897;
                                                                                break;
                                                                            }
                                                                        } else if (videoSurface.getIntOption(10) != 1) {
                                                                            v vVar = this.mTextureRenderer;
                                                                            if (vVar != null && vVar.a(0)) {
                                                                                i3 = -7894;
                                                                                break;
                                                                            } else {
                                                                                i3 = -7889;
                                                                                break;
                                                                            }
                                                                        } else if (this.mTextureSurface.getIntOption(6) != 1) {
                                                                            i3 = -7899;
                                                                            break;
                                                                        } else {
                                                                            break;
                                                                        }
                                                                    }
                                                                    i3 = i2;
                                                                    break;
                                                                case 667:
                                                                    IVideoModel iVideoModel = this.mVideoModel;
                                                                    if (iVideoModel != null && (videoInfo = iVideoModel.getVideoInfo(this.currentResolution, 0, (Map<Integer, String>) null)) != null) {
                                                                        i2 = videoInfo.getValueInt(41);
                                                                        i3 = i2;
                                                                        break;
                                                                    }
                                                                    break;
                                                                case 1071:
                                                                    if (this.mTextureSurface != null) {
                                                                        break;
                                                                    } else {
                                                                        if (mediaPlayer != null) {
                                                                            i3 = mediaPlayer.getIntOption(139, -1);
                                                                            break;
                                                                        }
                                                                        i3 = -1;
                                                                        break;
                                                                    }
                                                                case 1403:
                                                                    IVideoEventLogger iVideoEventLogger = this.mLogger;
                                                                    if (iVideoEventLogger != null) {
                                                                        i3 = iVideoEventLogger.getIntOption(49);
                                                                        break;
                                                                    }
                                                                    i3 = -1;
                                                                    break;
                                                                case 1405:
                                                                    i3 = this.mAllowAllExtensions;
                                                                    break;
                                                                default:
                                                                    switch (i) {
                                                                        case MotionEventCompat.AXIS_GENERIC_9:
                                                                            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                                                                            if (iVideoEventLogger2 != null) {
                                                                                i3 = iVideoEventLogger2.getCurDecoderBufferCount();
                                                                                break;
                                                                            }
                                                                            i3 = -1;
                                                                            break;
                                                                        case 41:
                                                                            IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                                                                            if (iVideoEventLogger3 != null) {
                                                                                wiredPlayedDuration = iVideoEventLogger3.getCurDecoderBufferAccuT();
                                                                                i3 = (int) wiredPlayedDuration;
                                                                                break;
                                                                            }
                                                                            i3 = -1;
                                                                            break;
                                                                        case MotionEventCompat.AXIS_GENERIC_11:
                                                                            if (mediaPlayer != null) {
                                                                                i3 = mediaPlayer.getIntOption(153, -1);
                                                                                break;
                                                                            }
                                                                            i3 = -1;
                                                                            break;
                                                                        case MotionEventCompat.AXIS_GENERIC_12:
                                                                            if (this.mVideoCodecType < 0 && mediaPlayer != null) {
                                                                                this.mVideoCodecType = mediaPlayer.getIntOption(157, -1);
                                                                            }
                                                                            i3 = this.mVideoCodecType;
                                                                            break;
                                                                        case MotionEventCompat.AXIS_GENERIC_13:
                                                                            if (this.mAudioCodecType < 0 && mediaPlayer != null) {
                                                                                this.mAudioCodecType = mediaPlayer.getIntOption(158, -1);
                                                                            }
                                                                            i3 = this.mAudioCodecType;
                                                                            break;
                                                                        case MotionEventCompat.AXIS_GENERIC_14:
                                                                            if (this.mVideoCodecID < 0 && mediaPlayer != null) {
                                                                                this.mVideoCodecID = mediaPlayer.getIntOption(141, -1);
                                                                            }
                                                                            i3 = this.mVideoCodecID;
                                                                            break;
                                                                        case 46:
                                                                            if (this.mAudioCodecID < 0 && mediaPlayer != null) {
                                                                                this.mAudioCodecID = mediaPlayer.getIntOption(140, -1);
                                                                            }
                                                                            i3 = this.mAudioCodecID;
                                                                            break;
                                                                        default:
                                                                            switch (i) {
                                                                                case b.f2360b:
                                                                                    if (mediaPlayer != null) {
                                                                                        i3 = mediaPlayer.getIntOption(989, 0);
                                                                                        break;
                                                                                    }
                                                                                    i3 = -1;
                                                                                    break;
                                                                                case 257:
                                                                                    i3 = this.mEnablePlaySpeedExtend;
                                                                                    break;
                                                                                case 258:
                                                                                    i3 = this.mEnableMasterM3u8Optimize;
                                                                                    break;
                                                                                default:
                                                                                    i3 = super.getIntOption(i);
                                                                                    break;
                                                                            }
                                                                    }
                                                            }
                                                        } else {
                                                            if (mediaPlayer != null) {
                                                                i3 = mediaPlayer.getIntOption(569, -1);
                                                            }
                                                            i3 = -1;
                                                        }
                                                    } else {
                                                        if (mediaPlayer != null) {
                                                            i3 = mediaPlayer.getIntOption(961, -1);
                                                        }
                                                        i3 = -1;
                                                    }
                                                } else {
                                                    i3 = this.mHijackRetryBackupDNSType;
                                                }
                                            } else {
                                                i3 = this.mHijackRetryMainDNSType;
                                            }
                                        } else {
                                            i3 = this.mForbidP2P;
                                        }
                                    } else {
                                        i3 = this.mP2PCDNType;
                                    }
                                } else {
                                    if (this.mPlayDuration != null) {
                                        wiredPlayedDuration = this.mPlayDuration.getWirelessPlayedDuration(this.mContext);
                                        i3 = (int) wiredPlayedDuration;
                                    }
                                    i3 = -1;
                                }
                            } else {
                                if (this.mPlayDuration != null) {
                                    wiredPlayedDuration = this.mPlayDuration.getWiredPlayedDuration();
                                    i3 = (int) wiredPlayedDuration;
                                }
                                i3 = -1;
                            }
                        } else {
                            if (this.mAudioCodecProfile == -1 && mediaPlayer != null) {
                                this.mAudioCodecProfile = mediaPlayer.getIntOption(402, -1);
                            }
                            i3 = this.mAudioCodecProfile;
                        }
                    } else {
                        if (this.mVideoCodecProfile == -1 && mediaPlayer != null) {
                            this.mVideoCodecProfile = mediaPlayer.getIntOption(403, -1);
                        }
                        i3 = this.mVideoCodecProfile;
                    }
                }
                i3 = this.mLayoutType;
            } else {
                if (mediaPlayer != null) {
                    i3 = mediaPlayer.getIntOption(24, -1);
                }
                i3 = -1;
            }
            return i3;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return -1;
        }
    }

    int _doGetIntOption2(int i) {
        long wiredPlayedDuration;
        int i2;
        VideoInfo videoInfo;
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        int i3 = 0;
        try {
            if (i != 0) {
                if (i != 4) {
                    if (i != 58) {
                        if (i != 59) {
                            if (i != 83) {
                                if (i != 84) {
                                    if (i != 700) {
                                        if (i != 701) {
                                            switch (i) {
                                                case 4:
                                                    break;
                                                case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
                                                case 494:
                                                    i3 = this.mEnableABR;
                                                    break;
                                                case IVideoEventLogger.LOGGER_OPTION_IS_DEGRADE_RELEASE:
                                                    if (this.mSeamSwitchingResolution) {
                                                        i3 = this.mLastPlaybackTime;
                                                        break;
                                                    } else {
                                                        i3 = _getPlayerTime();
                                                        break;
                                                    }
                                                case 199:
                                                    i3 = this.mUseTextureRender;
                                                    break;
                                                case b.f2360b:
                                                    if (mediaPlayer != null) {
                                                        i3 = mediaPlayer.getIntOption(989, 0);
                                                        break;
                                                    }
                                                    i3 = -1;
                                                    break;
                                                case 301:
                                                    i3 = this.mP2PCDNType;
                                                    break;
                                                case 343:
                                                    if (mediaPlayer != null) {
                                                        i3 = mediaPlayer.getIntOption(643, 0);
                                                        break;
                                                    }
                                                    i3 = -1;
                                                    break;
                                                case 371:
                                                    if (mediaPlayer != null) {
                                                        i3 = mediaPlayer.getIntOption(540, -1);
                                                        break;
                                                    }
                                                    i3 = -1;
                                                    break;
                                                case 530:
                                                    i3 = this.mCurrentSubId;
                                                    break;
                                                case 533:
                                                    i3 = this.mEnableSub;
                                                    break;
                                                case 596:
                                                    i3 = this.mSeekMode;
                                                    break;
                                                case 655:
                                                    if (mediaPlayer != null) {
                                                        i3 = mediaPlayer.getIntOption(541, 0);
                                                        break;
                                                    }
                                                    i3 = -1;
                                                    break;
                                                case 660:
                                                    i2 = this.mSRNotUseReason;
                                                    if (i2 >= 0) {
                                                        VideoSurface videoSurface = this.mTextureSurface;
                                                        if (videoSurface == null) {
                                                            if (this.mStarted) {
                                                                i3 = -7893;
                                                                break;
                                                            } else {
                                                                i3 = -7897;
                                                                break;
                                                            }
                                                        } else if (videoSurface.getIntOption(10) != 1) {
                                                            v vVar = this.mTextureRenderer;
                                                            if (vVar != null && vVar.a(0)) {
                                                                i3 = -7894;
                                                                break;
                                                            } else {
                                                                i3 = -7889;
                                                                break;
                                                            }
                                                        } else if (this.mTextureSurface.getIntOption(6) != 1) {
                                                            i3 = -7899;
                                                            break;
                                                        } else {
                                                            break;
                                                        }
                                                    }
                                                    i3 = i2;
                                                    break;
                                                case 667:
                                                    IVideoModel iVideoModel = this.mVideoModel;
                                                    if (iVideoModel != null && (videoInfo = iVideoModel.getVideoInfo(this.currentResolution, 0, (Map<Integer, String>) null)) != null) {
                                                        i2 = videoInfo.getValueInt(41);
                                                        i3 = i2;
                                                        break;
                                                    }
                                                    break;
                                                case 1071:
                                                    if (this.mTextureSurface != null) {
                                                        break;
                                                    } else {
                                                        if (mediaPlayer != null) {
                                                            i3 = mediaPlayer.getIntOption(139, -1);
                                                            break;
                                                        }
                                                        i3 = -1;
                                                        break;
                                                    }
                                                case 1403:
                                                    IVideoEventLogger iVideoEventLogger = this.mLogger;
                                                    if (iVideoEventLogger != null) {
                                                        i3 = iVideoEventLogger.getIntOption(49);
                                                        break;
                                                    }
                                                    i3 = -1;
                                                    break;
                                                default:
                                                    switch (i) {
                                                        case MotionEventCompat.AXIS_GENERIC_9:
                                                            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                                                            if (iVideoEventLogger2 != null) {
                                                                i3 = iVideoEventLogger2.getCurDecoderBufferCount();
                                                                break;
                                                            }
                                                            i3 = -1;
                                                            break;
                                                        case 41:
                                                            IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                                                            if (iVideoEventLogger3 != null) {
                                                                wiredPlayedDuration = iVideoEventLogger3.getCurDecoderBufferAccuT();
                                                                i3 = (int) wiredPlayedDuration;
                                                                break;
                                                            }
                                                            i3 = -1;
                                                            break;
                                                        case MotionEventCompat.AXIS_GENERIC_11:
                                                            if (mediaPlayer != null) {
                                                                i3 = mediaPlayer.getIntOption(153, -1);
                                                                break;
                                                            }
                                                            i3 = -1;
                                                            break;
                                                        case MotionEventCompat.AXIS_GENERIC_12:
                                                            if (this.mVideoCodecType < 0 && mediaPlayer != null) {
                                                                this.mVideoCodecType = mediaPlayer.getIntOption(157, -1);
                                                            }
                                                            i3 = this.mVideoCodecType;
                                                            break;
                                                        case MotionEventCompat.AXIS_GENERIC_13:
                                                            if (this.mAudioCodecType < 0 && mediaPlayer != null) {
                                                                this.mAudioCodecType = mediaPlayer.getIntOption(158, -1);
                                                            }
                                                            i3 = this.mAudioCodecType;
                                                            break;
                                                        case MotionEventCompat.AXIS_GENERIC_14:
                                                            if (this.mVideoCodecID < 0 && mediaPlayer != null) {
                                                                this.mVideoCodecID = mediaPlayer.getIntOption(141, -1);
                                                            }
                                                            i3 = this.mVideoCodecID;
                                                            break;
                                                        case 46:
                                                            if (this.mAudioCodecID < 0 && mediaPlayer != null) {
                                                                this.mAudioCodecID = mediaPlayer.getIntOption(140, -1);
                                                            }
                                                            i3 = this.mAudioCodecID;
                                                            break;
                                                        default:
                                                            i3 = super.getIntOption(i);
                                                            break;
                                                    }
                                            }
                                        } else {
                                            if (mediaPlayer != null) {
                                                i3 = mediaPlayer.getIntOption(569, -1);
                                            }
                                            i3 = -1;
                                        }
                                    } else {
                                        if (mediaPlayer != null) {
                                            i3 = mediaPlayer.getIntOption(961, -1);
                                        }
                                        i3 = -1;
                                    }
                                } else {
                                    if (this.mPlayDuration != null) {
                                        wiredPlayedDuration = this.mPlayDuration.getWirelessPlayedDuration(this.mContext);
                                        i3 = (int) wiredPlayedDuration;
                                    }
                                    i3 = -1;
                                }
                            } else {
                                if (this.mPlayDuration != null) {
                                    wiredPlayedDuration = this.mPlayDuration.getWiredPlayedDuration();
                                    i3 = (int) wiredPlayedDuration;
                                }
                                i3 = -1;
                            }
                        } else {
                            if (this.mAudioCodecProfile == -1 && mediaPlayer != null) {
                                this.mAudioCodecProfile = mediaPlayer.getIntOption(402, -1);
                            }
                            i3 = this.mAudioCodecProfile;
                        }
                    } else {
                        if (this.mVideoCodecProfile == -1 && mediaPlayer != null) {
                            this.mVideoCodecProfile = mediaPlayer.getIntOption(403, -1);
                        }
                        i3 = this.mVideoCodecProfile;
                    }
                }
                i3 = this.mLayoutType;
            } else {
                if (mediaPlayer != null) {
                    i3 = mediaPlayer.getIntOption(24, -1);
                }
                i3 = -1;
            }
            return i3;
        } catch (Throwable th) {
            TTVideoEngineLog.d(th);
            return -1;
        }
    }

    @Override
    protected void onMediaPlayerPrepared(MediaPlayer mediaPlayer) {
        MediaPlayer mediaPlayer2;
        boolean z;
        VideoSurface videoSurface;
        if (this.mShouldStop || (mediaPlayer2 = this.mMediaPlayer) == null) {
            return;
        }
        TTVideoEngineLog.i(logcatTag(), "receive onPrepared");
        int intOption = mediaPlayer2.getIntOption(141, -1);
        if (intOption == 33 && !FeatureManager.hasPermission("bytevc2")) {
            receivedError(new Error("kTTVideoErrorDomainLicenseCheck", -30001, -310003));
            return;
        }
        int intOption2 = mediaPlayer2.getIntOption(44, -1);
        TTVideoEngineLog.d(logcatTag(), "onPrepared mediaFormat " + intOption2 + ", videoCodecID " + intOption);
        if (intOption2 == 5 && !FeatureManager.hasPermission("dash")) {
            receivedError(new Error("kTTVideoErrorDomainLicenseCheck", -30001, -310001));
            return;
        }
        if (intOption2 == 6 && !FeatureManager.hasPermission("bash")) {
            receivedError(new Error("kTTVideoErrorDomainLicenseCheck", -30001, -310002));
            return;
        }
        this.mErrorCount = 0;
        this.mError = null;
        this.mDuration = mediaPlayer.getDuration();
        this.mPrepared = true;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.prepareEnd();
            this.mLogger.setDuration(this.mDuration);
        }
        setDisplayVideoSize(getVideoWidth(), getVideoHeight());
        StrategyManager.instance().onPrepared(this);
        notifyPrepared();
        if (mediaPlayer2 == null) {
            TTVideoEngineLog.e(logcatTag(), "onPrepared mediaplayer is null!");
            return;
        }
        _dumpSurface("onPrepared");
        if (getConfigInt(681, this.mSkipStartWhenPrepared ? 1 : 0) == 1) {
            z = true;
        } else {
            z = false;
        }
        TTVideoEngineLog.i(logcatTag(), "mPausedBeforePrepared:" + this.mPausedBeforePrepared + ", mShouldPlay:" + this.mShouldPlay + ", mIsStartPlayAutomatically:" + this.mIsStartPlayAutomatically + ", mIsPreDecodeAutoPause:" + this.mIsPreDecodeAutoPause + ", skip start:" + z + ", isOsPlayer:" + isOSPlayer());
        if (mediaPlayer != null && !z && ((!this.mPausedBeforePrepared && this.mShouldPlay) || (!isOSPlayer() && !this.mIsStartPlayAutomatically && this.mIsPreDecodeAutoPause))) {
            mediaPlayer.start();
        }
        if (mediaPlayer != null && this.mSeamSwitchingResolution && !this.mShouldPlay) {
            mediaPlayer.start();
            mediaPlayer.pause();
            _updateTextureState(2);
        }
        if (!TextUtils.isEmpty(this.mSubPathInfo) && this.mSeamSwitchingResolution && this.mEnableSubThread > 0) {
            mediaPlayer2.setIntOption(618, this.mEnableSub);
            mediaPlayer2.setStringOption(TTVideoEngineInterface.PLAYER_OPTION_IS_DEGRADE_RELEASE, this.mSubPathInfo);
            TTVideoEngineLog.d(logcatTag(), "sub option: " + this.mEnableSub + " url:" + this.mSubPathInfo);
        }
        if (this.mPlaybackParams != null && isOSPlayer() && Build.VERSION.SDK_INT >= 23) {
            mediaPlayer.setPlaybackParams(this.mPlaybackParams);
            this.mLogger.setPlaybackParams(this.mPlaybackParams);
        }
        int intOption3 = mediaPlayer.getIntOption(62, -100);
        int intOption4 = mediaPlayer.getIntOption(61, -100);
        if (intOption3 == 0) {
            this.mLogger.setIntOption(12, 1);
        } else {
            this.mLogger.setIntOption(12, 0);
        }
        if (intOption4 == 0) {
            this.mLogger.setIntOption(13, 1);
        } else {
            this.mLogger.setIntOption(13, 0);
        }
        TTVideoEngineLog.i(logcatTag(), "videoEnabled:" + intOption3 + ",audioEnabled:" + intOption4);
        if (intOption3 == 0 && this.mEnableTextureRenderNoRenderCheck == 1 && (videoSurface = this.mTextureSurface) != null) {
            this.mEnableTextureRenderNoRenderCheck = 0;
            videoSurface.setIntOption(34, 0);
        }
        long longOption = mediaPlayer2.getLongOption(524, -1L);
        long longOption2 = mediaPlayer2.getLongOption(525, -1L);
        this.mLogger.setLongOption(98, longOption);
        this.mLogger.setLongOption(99, longOption2);
        if (getConfigInt(656, this.mEnableHeartBeat ? 1 : 0) == 1 && !this.mHeartBeatStarted) {
            this.mLooperThread.postEngineMessage(24);
            this.mHeartBeatStarted = true;
        }
        if (mediaPlayer.isOSPlayer() && this.mRadioModeEnable == 1 && !this.mHasFirstFrameShown) {
            TTVideoEngineLog.i(logcatTag(), "OSPlayer in radioMode enter renderStart");
            _renderStart();
        }
    }

    @Override
    protected void receivedError(Error error) {
        boolean z;
        String str;
        boolean z2;
        boolean z3;
        IVideoModel iVideoModel;
        IntertrustDrmHelper intertrustDrmHelper;
        this.mAllowedExpiredModel = false;
        _updateLogTime();
        if (this.mUserStopped) {
            this.mState = 0;
            return;
        }
        int i = this.mPlayAPIVersion;
        int _getPlayerTime = _getPlayerTime();
        if (!this.mRetrying) {
            int i2 = this.mStartTime;
            if (i2 != 0) {
                this.mLastPlaybackTime = i2;
                this.mStartTime = 0;
            } else if (isInHousePlayer() || (!isInHousePlayer() && this.mPrepared && !this.mSeamSwitchingResolution)) {
                if (this.mDuration > 0 && _getPlayerTime - this.mDuration > -1000) {
                    this.mLastPlaybackTime = 0;
                } else {
                    this.mLastPlaybackTime = _getPlayerTime;
                }
            }
        }
        if (this.mMediaPlayer != null && (this.mMediaPlayer.isOSPlayer() || this.mMediaPlayer.getPlayerType() == 3 || this.mMediaPlayer.getPlayerType() == 4 || this.mMediaPlayer.getPlayerType() == 5)) {
            z = true;
        } else {
            z = false;
        }
        int i3 = 2;
        if (!isInHousePlayer() && getConfigInt(34, this.mDrmType) == 2) {
            z = false;
        }
        if (this.mMediaPlayer != null && (this.mMediaPlayer.getPlayerType() == 0 || this.mMediaPlayer.getPlayerType() == 2)) {
            this.mMediaPlayer.release();
            this.mMediaPlayer = null;
            this.mIsStartPlayAutomatically = true;
        }
        this.mErrorCount++;
        this.mAccumulatedErrorCount++;
        this.mState = 4;
        TTVideoEngineLog.i(logcatTag(), "videoEngine failed:" + error.toString());
        if (error.domain.equals("kTTVideoErrorDomainIntertrustDRM") && (intertrustDrmHelper = this.mIntertrustDrmHelper) != null) {
            intertrustDrmHelper.stop();
        }
        if (error.code == -9939) {
            _notifyError(error);
            return;
        }
        if (error.code == -9987) {
            TTVideoEngineLog.e(logcatTag(), "can't decrypt video");
            _notifyError(error);
            return;
        }
        if (error.code == -9988) {
            TTVideoEngineLog.e(logcatTag(), "decode encryptionkey error, not need to retry");
            _notifyError(error);
            return;
        }
        if (error.code == -9990) {
            TTVideoEngineLog.e(logcatTag(), "invalid request, no need to retry");
            _notifyError(error);
            return;
        }
        if (this.mErrorCount >= 3) {
            TTVideoEngineLog.e(logcatTag(), "videoEngine retry failed");
            _notifyError(error);
            return;
        }
        if (this.mAccumulatedErrorCount >= getConfigInt(28, this.mMaxAccumulatedCountSetByUser)) {
            TTVideoEngineLog.e(logcatTag(), "videoEngine retry failed:reach maxAccumulatedErrorCount");
            _notifyError(error);
            return;
        }
        if (error.code == -9966) {
            TTVideoEngineLog.e(logcatTag(), "invalid url");
            _notifyError(error);
            return;
        }
        if (error.code == -499897) {
            if (this.mIsDirectURL) {
                TTVideoEngineLog.e(logcatTag(), "directUrl 403");
                this.mLogger.setIntOption(142, 1);
                _notifyError(error);
                return;
            }
            TTVideoEngineLog.e(logcatTag(), String.format(Locale.getDefault(), "-499897 happen, enable MDL:%d, MDL running:%d, mdlFallbackApiRetry option:%d", Integer.valueOf(getConfigInt(160, this.mDataLoaderEnable)), Integer.valueOf(DataLoaderHelper.getDataLoader().isRunning() ? 1 : 0), Integer.valueOf(this.mFallbackApiRetry)));
            this.mLogger.setIntOption(142, 2);
        }
        String currentURL = this.mURLInfo.getCurrentURL();
        if ((error.domain.equals("kTTVideoErrorDomainVideoOSPlayer") || error.equals("kTTVideoErrorDomainVideoExoPlayer") || error.code == -499975) && !TextUtils.isEmpty(currentURL) && currentURL.startsWith("mdl")) {
            if (this.mIsDirectURL && this.mDirectURL.startsWith("mdl")) {
                DataLoaderHelper.getDataLoader().setIntValue(1004, -1);
                this.mDirectURL = DataLoaderHelper.getDataLoader()._getProxyUrl(this.mDirectURL);
                TTVideoEngineLog.i(logcatTag(), "mdl failed: mIsDirectURL: " + this.mIsDirectURL + ", mDirectUrlSrc: " + this.mDirectUrlSrc);
            } else if (!TextUtils.isEmpty(currentURL) && currentURL.startsWith("mdl")) {
                DataLoaderHelper.getDataLoader().setIntValue(1004, -1);
                this.mURLInfo.setHostURL(DataLoaderHelper.getDataLoader()._getProxyUrl(currentURL));
                TTVideoEngineLog.i(logcatTag(), "mdl failed: urlInfo: " + currentURL);
            } else if (error.domain.equals("kTTVideoErrorDomainVideoOSPlayer") || error.domain.equals("kTTVideoErrorDomainVideoExoPlayer")) {
                DataLoaderHelper.getDataLoader().setIntValue(1004, -1);
            }
        }
        this.mRetrying = true;
        if (error.domain.equals("kTTVideoErrorDomainVideoOwnPlayer")) {
            this.mRetryingNotHandleError = true;
        }
        int retryStrategy = error.getRetryStrategy();
        if (this.mConfigCenterVersion > 0) {
            str = this.mEngineConfig.getStringOption(1000);
        } else {
            str = this.mCodecType;
        }
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(17) == 1) {
                z2 = true;
            } else {
                z2 = false;
            }
        } else {
            z2 = this.mDashEnabled;
        }
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(33) == 1) {
                z3 = true;
            } else {
                z3 = false;
            }
        } else {
            z3 = this.mBashEnabled;
        }
        if ((str.equals("bytevc1") || str.equals("bytevc2") || z2 || z3 || this.mHttpsEnabled) && z) {
            if (this.mConfigCenterVersion > 0) {
                this.mEngineConfig.setStringOption(1000, "h264");
            } else {
                this.mCodecType = "h264";
            }
            this.mDashEnabled = false;
            this.mEngineConfig.setIntOption(17, 0);
            this.mBashEnabled = false;
            this.mEngineConfig.setIntOption(33, 0);
            this.mEnableHttps = false;
            this.mEngineConfig.setIntOption(312, 0);
            this.mRetryEnableHttps = false;
            this.mForceCodec = "h264";
            retryStrategy = 1;
        }
        int clearByErrcode = clearByErrcode(error, z);
        if (clearByErrcode == 10) {
            return;
        }
        if (clearByErrcode != 11) {
            retryStrategy = clearByErrcode;
        }
        if (error.code == -499699 || error.code == -499698) {
            if (getConfigInt(37, this.mDrmRetry ? 1 : 0) != 1) {
                _notifyError(error);
                return;
            } else {
                this.mDrmType = 0;
                this.mEngineConfig.setIntOption(34, 0);
                retryStrategy = 3;
            }
        }
        if (this.mErrorCount == 2) {
            if (this.mPlayAPIVersion == 2 && !TextUtils.isEmpty(this.mAuthorization)) {
                this.mPlayAPIVersion = 1;
            }
            retryStrategy = 1;
        }
        if (this.mIsLocal || this.mIsDirectURL || ((z3 && this.mBashRetryRestartPlayer) || ((iVideoModel = this.mVideoModel) != null && iVideoModel.getVideoRefBool(253)))) {
            retryStrategy = 3;
        }
        if (this.mIsPlayItem) {
            this.mIsPlayItem = false;
            retryStrategy = 1;
        }
        TTVideoEngineLog.i(logcatTag(), "retry strategy:" + retryStrategy);
        if (i != this.mPlayAPIVersion) {
            TTVideoEngineLog.i(logcatTag(), "APIVersion rollback from PLAY_API_VERSION_" + i + " to PLAY_API_VERSION_" + this.mPlayAPIVersion + " errorCount:" + this.mErrorCount);
        }
        String str2 = this.mURLInfo.hostURL;
        if (!TextUtils.isEmpty(str2) && str2.startsWith("mem://bash")) {
            String.format("mem://bash/url_index:%d", this.urlIndexMap.get(this.currentResolution));
        }
        if (retryStrategy == 3 && !this.mIsLocal && error.code == -2139062143) {
            this.mMediaPlayer = null;
        }
        if (this.mIsPreloaderItem) {
            if (this.mVideoModel == null) {
                VideoInfoFetcher videoInfoFetcher = this.mFetcher;
                if (videoInfoFetcher != null) {
                    videoInfoFetcher.cancel();
                }
                i3 = 1;
            }
            this.mIsPreloaderItem = false;
        } else {
            i3 = retryStrategy;
        }
        if (i3 != 0) {
            this.mLogger.movieShouldRetry(error, i3, i);
        }
        if (i3 == 1) {
            if (this.mLooperThread.checkSendMainLooper()) {
                this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_ENABEL_HARDWARE_DECODE_AUDIO, 0, 0, error, this.mAPIString);
            } else {
                this.mListenerCompact.onVideoURLRouteFailed(error, this.mAPIString);
            }
        }
        _retry(i3, error);
    }

    void _doSetPlayerSurface(Surface surface, int i) {
        _doSetPlayerSurfaceWithoutLock(surface, i);
    }

    @Override
    protected void onMediaPlayerSeekComplete(MediaPlayer mediaPlayer, boolean z) {
        _seekComplete(z);
    }

    @Override
    public void setCustomHeaderSync(String str, String str2) {
        _doSetCustomHeader(str, str2);
    }

    @Override
    public void setSrMaxTexureSize(int i, int i2) {
        setSrMaxTextureSize(i, i2);
    }

    private String _generatePlayUrl(String str, Map<String, String> map) {
        return _generatePlayUrl(str, map, null);
    }

    @Override
    public void setCacheInfoLists(String[] strArr, long[] jArr) {
        DataLoaderHelper.getDataLoader().setCacheInfoLists(strArr, jArr);
    }

    @Override
    public void setCustomInfo(IVideoEventLogger.VideoEventCustomInfo videoEventCustomInfo, Object obj) {
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setCustomInfo(videoEventCustomInfo, obj);
        }
    }

    @Override
    public void setDirectUrlUseDataLoader(String[] strArr, String str) {
        setDirectUrlUseDataLoader(strArr, str, this.mVideoID);
    }

    @Override
    public void setExpectedParams(Resolution resolution, Map<Integer, String> map) {
        this.expectedResolution = resolution;
        this.expectedParams = map;
    }

    @Override
    public void setExternLogListener(ExternVideoLoggerListener externVideoLoggerListener, String str) {
        this.mExternVideoLoggerListener = externVideoLoggerListener;
        this.mExternLogKey = str;
    }

    @Override
    public void setLoggerIntOption(int i, int i2) {
        this.mLogger.setIntOption(i, i2);
    }

    @Override
    public void setLoggerLongOption(int i, long j) {
        this.mLogger.setLongOption(i, j);
    }

    @Override
    public void setQcomVpp(boolean z, int i) {
        this.mUseQcomVpp = z ? 1 : 0;
        this.mQcomVppLevel = i;
    }

    private void setDisplayVideoSize(int i, int i2) {
        DisplayMode displayMode = this.mDisplayMode;
        if (displayMode != null && this.mUseTextureRender == 0 && i > 0 && i2 > 0) {
            displayMode.setVideoSize(i, i2);
        }
    }

    void _doSetDirectURL(String str, String str2) {
        _doSetDirectURL(str, new String[]{str});
        this.mFileKey = str2;
    }

    @Override
    public boolean clearSurface(Surface surface, boolean z) {
        try {
            return v.a().a(surface, z);
        } catch (Exception unused) {
            return false;
        }
    }

    public int lambda$setupTextureRender$2$TTVideoEngineImpl(VideoSurface videoSurface, Surface surface) {
        ListenerCompact listenerCompact = this.mListenerCompact;
        if (listenerCompact != null) {
            return listenerCompact.onSetSurface(this.mEngineWrapper, videoSurface, surface);
        }
        return 0;
    }

    @Override
    public void setDirectUrlUseDataLoader(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        setDirectUrlUseDataLoader(str, str2, this.mVideoID);
    }

    @Override
    public void setDisplayMode(View view, int i) {
        TTVideoEngineLog.d(logcatTag(), "setDisplayMode TOB only");
    }

    void _doSetObjectOption(int i, Object obj) {
        if (i == 441 && obj != null && (obj instanceof AudioProcessor)) {
            this.mAudioProcessor = (AudioProcessor) obj;
            if (this.mMediaPlayer != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(this.mAudioProcessor);
            }
        }
    }

    void _doSetTraitObject(int i, TraitObject traitObject) {
        this.mTraitObjManager.put(i, traitObject);
        if (this.mMediaPlayer != null) {
            ((MediaPlayerWrapper) this.mMediaPlayer).setTraitObject(i, traitObject);
        }
    }

    @Override
    protected void notifySARChanged(int i, int i2) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_FORBID_P2P_WHEN_SEEK, i, i2, null);
        } else {
            this.mListenerCompact.onSARChanged(i, i2);
        }
    }

    @Override
    protected void notifyVideoSizeChanged(int i, int i2) {
        if (this.mLooperThread.checkSendMainLooper()) {
            this.mLooperThread.postMainLooperMessage(402, i, i2, null);
        } else {
            this.mListenerCompact.onVideoSizeChanged(this.mEngineWrapper, i, i2);
        }
    }

    @Override
    protected void onMediaPlayerBufferingUpdate(MediaPlayer mediaPlayer, int i) {
        if (this.mIsLocal) {
            i = 100;
        }
        this.mLoadedProgress = i;
        setPlayInfo(2, i);
        notifyBufferingUpdate(i);
    }

    @Override
    public void setAsyncInit(boolean z, int i) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(50, z ? 1 : 0, i);
        } else {
            _doSetAsyncInit(z, i);
        }
    }

    @Override
    public void setCustomHeader(String str, String str2) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(57, 0, 0, str, str2);
        } else {
            _doSetCustomHeader(str, str2);
        }
    }

    @Override
    public void setExtraSurface(Surface surface, int i) {
        synchronized (this.mExtraSurfaceQueue) {
            this.mExtraSurfaceQueue.offer(new Pair<>(surface, Integer.valueOf(i)));
            _setExtraSurface();
        }
    }

    @Override
    public void setIntOption(int i, int i2) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(IVideoLayerCommand.VIDEO_HOST_CMD_GOBACK, i, i2);
        } else {
            _doSetIntOption(i, i2);
        }
    }

    @Override
    public void setLongOption(int i, long j) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(102, i, 0, Long.valueOf(j));
        } else {
            _doSetLongOption(i, j);
        }
    }

    @Override
    public void setObjectOption(int i, Object obj) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(109, i, 0, obj);
        } else {
            _doSetObjectOption(i, obj);
        }
    }

    @Override
    public void setStringOption(int i, String str) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(108, i, 0, str);
        } else {
            _doSetStringOption(i, str);
        }
    }

    @Override
    public void setTraitObject(int i, TraitObject traitObject) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_PLAYER_SPADE, i, 0, traitObject);
        } else {
            _doSetTraitObject(i, traitObject);
        }
    }

    private void _isEnableEffect(int i, int i2) {
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            TTVideoEngineLog.d(logcatTag(), "_isEnableEffect:" + i2 + ",type:" + i);
            Bundle bundle = new Bundle();
            bundle.putInt("action", 19);
            bundle.putInt("effect_type", i);
            bundle.putInt("int_value", i2);
            videoSurface.setEffect(bundle);
        }
    }

    private void _updateCurrentPlaybackPosition(int i, boolean z) {
        if (getConfigInt(602, this.mPosUpdateInterval) > 0 && this.mCurPosition != i && i >= 0) {
            this.mCurPosition = i;
            ListenerCompact listenerCompact = this.mListenerCompact;
            if (z && listenerCompact != null) {
                if (this.mLooperThread.checkSendMainLooper()) {
                    this.mLooperThread.postMainLooperMessage(425, i, 0, null);
                } else {
                    listenerCompact.onCurrentPlaybackTimeUpdate(this.mEngineWrapper, i);
                }
            }
        }
    }

    private String[] addMdlFlag(String[] strArr, String str) {
        if (getConfigInt(302, this.mForbidP2P) == 0) {
            return strArr;
        }
        for (int i = 0; i < strArr.length; i++) {
            if (!TextUtils.isEmpty(strArr[i])) {
                strArr[i] = TTHelper.appendQueryString(strArr[i], "p2p=0");
            }
        }
        return strArr;
    }

    private int clearByErrcode(Error error, boolean z) {
        switch (error.code) {
            case -1094995529:
            case -499985:
            case -499978:
            case -499977:
                if (getConfigInt(603, this.mEnableClearMDLCache) > 0) {
                    clearMdlCache();
                }
                return 11;
            case -499972:
            case -499970:
                return clearHijackIpCacheByErrcode(error, z);
            default:
                return 11;
        }
    }

    public void lambda$setDisplayMode$0(View view, int i) {
        TTVideoEngineLog.d(logcatTag(), "setDisplayMode " + i);
        _doSetIntOption(4, i);
        DisplayMode displayMode = this.mDisplayMode;
        if (displayMode != null) {
            displayMode.setDisplayView(view);
            displayMode.setDisplayMode(i);
        }
    }

    private boolean isSupportFileCache(String str, IVideoModel iVideoModel) {
        if (iVideoModel != null && (iVideoModel.hasFormat(IVideoModel.Format.DASH) || iVideoModel.getSource() == IVideoModel.Source.LIVE)) {
            return false;
        }
        if (!TextUtils.isEmpty(str)) {
            if (FormatProvider.FormatProviderHolder.isM3u8(str) || FormatProvider.FormatProviderHolder.isMpd(str)) {
                return false;
            }
            return true;
        }
        return true;
    }

    void _doSetCustomHeader(String str, String str2) {
        Map<String, String> map;
        if (!TextUtils.isEmpty(str) && (map = this.mHeaders) != null) {
            map.put(str.substring(0, 1).toUpperCase() + str.substring(1), str2);
        }
    }

    void _doSetPlayerSurfaceWithoutLock(Surface surface, int i) {
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        if (mediaPlayer != null) {
            if (surface == null) {
                mediaPlayer.setSurface(null);
                return;
            }
            if (i == 1) {
                mediaPlayer.setSurface(surface);
                this.mLogger.setPlayerSurface(surface.toString());
                return;
            }
            Surface surface2 = this.mTextureSurface;
            if (surface2 == null) {
                surface2 = surface;
            }
            mediaPlayer.setSurface(surface2);
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                surface = videoSurface;
            }
            iVideoEventLogger.setPlayerSurface(surface.toString());
        }
    }

    void _doSetSurfaceTimeOut(Surface surface, int i) {
        this.mSurface = surface;
        if (surface != null && this.mLogger != null && !this.mHasFirstFrameShown) {
            this.mLogger.setSurface(surface.toString());
        }
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        if (mediaPlayer != null) {
            setSurfaceHookTimeOut(this.mSurface, i);
        }
    }

    @Override
    public void configParams(Resolution resolution, Map<Integer, String> map) {
        TTVideoEngineLog.i(logcatTag(), "configParams res:" + resolution + ", params:" + map);
        if (resolution == null) {
            return;
        }
        _configResolution(resolution, map);
    }

    protected void notifyEngineInfo(VideoEngineInfos videoEngineInfos, boolean z) {
        if (this.mVideoEngineInfoListener == null) {
            return;
        }
        if (this.mLooperThread.checkSendMainLooper()) {
            if (z) {
                this.mLooperThread.postMainLooperMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_AJ_MEDIACODEC, 0, 0, videoEngineInfos);
                return;
            } else {
                this.mLooperThread.postEngineMessage(TTVideoEngineInterface.PLAYER_OPTION_USE_AJ_MEDIACODEC, 0, 0, videoEngineInfos);
                return;
            }
        }
        this.mVideoEngineInfoListener.onVideoEngineInfos(videoEngineInfos);
    }

    @Override
    public void seekTo(int i, SeekCompletionListener seekCompletionListener) {
        TTVideoEngineLog.i(logcatTag(), "seek to time:" + i);
        this.mSeekCompletionListener = seekCompletionListener;
        if (this.mMediaPlayer != null && this.mStarted) {
            _updateCurrentPlaybackPosition(i, false);
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(7, i);
        } else {
            _seekTo(i, false);
        }
    }

    @Override
    public void setAutoRangeRead(int i, int i2) {
        TTVideoEngineLog.i(logcatTag(), "set auto range read = " + i + ", " + i2);
        this.mReadCacheMode = i;
        this.mAutoRangeOffset = i2;
    }

    @Override
    public void setBarrageMaskUrlUseDataLoader(String str, String str2) {
        TTVideoEngineLog.i(logcatTag(), "setBarrageMaskUrl " + str);
        this.mBarrageMaskUrl = str;
        this.mMaskFileHash = str2;
        StrategyHelper.buildMaskInfo(this.mMediaInfoMap, str, str2);
    }

    @Override
    public void setBufferThresholdControl(int i, int i2) {
        TTVideoEngineLog.i(logcatTag(), "setBufferThresholdControl= " + i + ", " + i2);
        if (i > 0 && i2 > 0) {
            if (DataLoaderHelper.getDataLoader().getIntValue(1150) == 1) {
                i = 0;
                i2 = 0;
            }
            this.mDangerBufferThreshold = i;
            this.mSecureBufferThreshold = i2;
        }
    }

    @Override
    public void setDirectURL(String str, String str2) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(19, 0, 0, str, str2);
        } else {
            _doSetDirectURL(str, str2);
        }
    }

    @Override
    public void setDirectUrlUseDataLoaderByFilePath(String str, String str2) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(21, 0, 0, str, str2);
        } else {
            setDirectUrlUseDataLoaderByFilePath(new String[]{str}, str2);
        }
    }

    @Override
    public void setGearStrategyListener(IGearStrategyListener iGearStrategyListener, Object obj) {
        TTVideoEngineLog.i(logcatTag(), "[GearStrategy]setGearStrategyListener listener=" + iGearStrategyListener + " userData=" + obj);
        this.mGearStrategyConfig.setGearStrategyListener(iGearStrategyListener).setUserData(obj);
    }

    @Override
    public void setPlayAPIVersion(int i, String str) {
        TTVideoEngineLog.i(logcatTag(), "setPlayAPIVersion:" + i);
        this.mPlayAPIVersion = i;
        this.mAuthorization = str;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setPlayAPIVersion(i, str);
        }
    }

    @Override
    public void setSrMaxTextureSize(int i, int i2) {
        this.mMaxTextureWidth = i;
        this.mMaxTextureHeight = i2;
        TTVideoEngineLog.i(logcatTag(), "[SRLog]setSrMaxTextureSize:" + this.mMaxTextureWidth + "," + this.mMaxTextureHeight);
    }

    @Override
    public void setSurfaceHolder(SurfaceHolder surfaceHolder, boolean z) {
        TTVideoEngineLog.i(logcatTag(), "setSurfaceHolder = " + surfaceHolder + ", this:" + this);
        if (surfaceHolder == null) {
            this.mLastSetSurfaceNullTime = System.currentTimeMillis();
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(55, z ? 1 : 0, 0, surfaceHolder);
        } else {
            _doSetSurfaceHolder(surfaceHolder, z);
        }
    }

    @Override
    public void setTestSpeedEnable(int i, TestNetSpeedListener testNetSpeedListener) {
        if (!FeatureManager.hasPermission("net_speed")) {
            return;
        }
        this.mTestNetSpeed = i;
        this.mTestNetSpeedListener = testNetSpeedListener;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(52, i);
        } else {
            _doSetTestSpeedEnable(i);
        }
    }

    private boolean _isUrlExpired(VideoInfo videoInfo, IVideoModel iVideoModel) {
        if (videoInfo == null || iVideoModel == null || getConfigInt(450, this.mAllowedExpiredModel ? 1 : 0) > 0) {
            return false;
        }
        if (iVideoModel.getVideoRefLong(220) > 0 && TimeService.isUpdated() && TimeService.currentTimeMillis() - (iVideoModel.getVideoRefLong(220) * 1000) > -30000) {
            return true;
        }
        if (videoInfo.getValueLong(30) <= 0 || !TimeService.isUpdated() || TimeService.currentTimeMillis() - (videoInfo.getValueLong(30) * 1000) <= -30000) {
            return false;
        }
        return true;
    }

    private void _playVideo(String str, String str2) {
        TTVideoEngineLog.i(logcatTag(), "start to play video, host:" + str + ", ip:" + str2);
        if (this.mShouldStop) {
            TTVideoEngineLog.w(logcatTag(), "_playVideo should stop");
            return;
        }
        if (!TextUtils.isEmpty(str2)) {
            this.mURLInfo.setIpURL(str2);
            if (!TextUtils.isEmpty(str)) {
                this.currentHost = str;
                this.mHeaders.put("Host", String.format(" %s", str));
            }
            _playInternal(this.mURLInfo.ipURL, this.mHeaders);
            return;
        }
        _playInternal(this.mURLInfo.hostURL, this.mHeaders);
    }

    private void _selectTrack(int i, int i2) {
        MediaPlayer.TrackInfo[] trackInfo;
        int i3;
        int i4;
        if (this.mMediaPlayer == null || (trackInfo = this.mMediaPlayer.getTrackInfo()) == null) {
            return;
        }
        if (i2 == VideoRef.TYPE_VIDEO) {
            i3 = 1;
        } else {
            i3 = 2;
        }
        int length = trackInfo.length;
        int i5 = 0;
        while (true) {
            if (i5 < length) {
                MediaPlayer.TrackInfo trackInfo2 = trackInfo[i5];
                if (trackInfo2.getTrackType() == i3) {
                    MediaFormat format = trackInfo2.getFormat();
                    if (format.getInteger("bitrate") == i) {
                        i4 = format.getInteger("track-id");
                        break;
                    }
                }
                i5++;
            } else {
                i4 = -1;
                break;
            }
        }
        if (i4 != -1) {
            this.mMediaPlayer.selectTrack(i4);
        }
    }

    private void _setHDRInfoToTexturerender(MediaPlayer mediaPlayer, int i) {
        boolean z;
        VideoSurface videoSurface = this.mTextureSurface;
        if (mediaPlayer != null && videoSurface != null) {
            videoSurface.setIntOption(8, i);
            if (TTVideoEngineConfig.setEGLBitDepth > 8) {
                int intOption = mediaPlayer.getIntOption(1082, -1);
                TTVideoEngineLog.d(logcatTag(), "bitDepth:" + intOption);
                videoSurface.setIntOption(130, intOption);
            }
            if (getConfigInt(652, this.mRenderHDR2SDR) == 1) {
                if (i != 1 && i != 2) {
                    z = false;
                } else {
                    z = true;
                }
                Bundle bundle = new Bundle();
                bundle.putInt("effect_type", 4);
                if (z) {
                    bundle.putInt("action", 21);
                    bundle.putInt("hdr_type", i);
                    bundle.putInt("use_effect", 1);
                } else {
                    bundle.putInt("action", 19);
                    bundle.putInt("use_effect", 0);
                }
                videoSurface.setEffect(bundle);
            }
        }
    }

    private void _singleURLParseAndPlay(String str, Map<String, String> map) {
        this.mURLInfo.setHostURL(str);
        boolean _isDashSource = _isDashSource(str);
        this.mIsDashSource = _isDashSource;
        this.mDashEnabled = _isDashSource;
        this.mEngineConfig.setIntOption(17, this.mIsDashSource ? 1 : 0);
        if (!_usePlayerDNS(true) && !this.mIsLocal) {
            if (TTHelper.isIP(str)) {
                _playInternal(str, map);
                return;
            }
            if (str.indexOf("http") == 0) {
                this.urlIPMap.put(this.mURLInfo.hostURL, new IpInfo("", "", getConfigInt(18, this.mUseDNSCache ? 1 : 0), getConfigInt(403, this.mIsUseServerDns ? 1 : 0), "single"));
                this.mURLs = new String[]{str};
                _updateVU();
                _parseDNS(str);
                return;
            }
            _playInternal(str, map);
            return;
        }
        _playInternal(str, map);
    }

    private int clearHijackIpCacheByErrcode(Error error, boolean z) {
        IVideoModel iVideoModel;
        if (getConfigInt(427, this.mHijackRetry ? 1 : 0) != 1) {
            _notifyError(error);
            return 10;
        }
        this.mLogger.setHijackCode(error.code);
        int configInt = getConfigInt(424, this.mHijackRetryMainDNSType);
        int configInt2 = getConfigInt(425, this.mHijackRetryBackupDNSType);
        TTVideoEngine.setDNSType(configInt, configInt2);
        TTVideoEngine.removeCacheFile(this.mVideoModel);
        DataLoaderHelper.getDataLoader().clearNetinfoCache();
        DataLoaderHelper.getDataLoader().setIntValue(90, configInt);
        DataLoaderHelper.getDataLoader().setIntValue(91, configInt2);
        if (this.mHijackRetryCount == 0 && !z && (iVideoModel = this.mVideoModel) != null && iVideoModel.getVideoRefBool(106)) {
            this.mHijackRetryCount++;
            this.mRetryEnableHttps = true;
            return 2;
        }
        this.mHijackRetryCount = 0;
        _notifyError(error);
        return 10;
    }

    private boolean doOpenSR(int i, int i2) {
        TTVideoEngineLog.i(logcatTag(), "[SRLog]doOpenSR open=" + i + " reason=" + i2 + " mTextureSurface=" + this.mTextureSurface + " mHasFirstFrameShown=" + this.mHasFirstFrameShown);
        this.mTextureSrOpen = i;
        if (i == 0) {
            this.mSRNotUseReason = i2;
        }
        VideoSurface videoSurface = this.mTextureSurface;
        boolean z = false;
        if (videoSurface == null) {
            return false;
        }
        try {
            if (1 == i) {
                if (!this.mHasFirstFrameShown) {
                    return false;
                }
                this.mTextureSurface.setSuperResolutionMode(this.mTextureSrOpen);
            } else {
                videoSurface.setSuperResolutionMode(i);
            }
            z = true;
            return true;
        } catch (Exception e) {
            TTVideoEngineLog.i(logcatTag(), "[SRLog]doOpenSR catch exception e=" + e);
            return z;
        }
    }

    private void setFloatOption2(int i, float f) {
        if (i != 359) {
            if (i != 526) {
                if (i != 535) {
                    if (i != 651) {
                        if (i != 722) {
                            if (i != 723) {
                                super.setFloatOption(i, f);
                            } else {
                                IVideoEventLogger iVideoEventLogger = this.mLogger;
                                if (iVideoEventLogger != null) {
                                    iVideoEventLogger.setVrDisplayFrameRate(f);
                                }
                            }
                        } else {
                            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                            if (iVideoEventLogger2 != null) {
                                iVideoEventLogger2.setVrDisplayDistance(f);
                            }
                        }
                    } else {
                        VideoSurface videoSurface = this.mTextureSurface;
                        if (videoSurface != null) {
                            videoSurface.setFloatOption(4, f);
                        }
                    }
                } else {
                    this.mNetworkSpeedReportSamplingRate = f;
                    this.mLogger.setFloatOption(20, f);
                }
            } else {
                this.mABRStartupBandwidthParameter = f;
            }
        } else {
            this.mSpeedXDropFPSLimit = f;
        }
        TTVideoEngineLog.i(logcatTag(), "set float option key:" + i + ",value:" + f);
    }

    void _doSetAsyncInit(boolean z, int i) {
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        this.mAsyncInitEnable = z ? 1 : 0;
        if (this.mVideoModel != null) {
            i = -1;
        }
        this.mCodecId = i;
        TTVideoEngineLog.i(logcatTag(), "setAsyncInit enable:" + this.mAsyncInitEnable + " codecid:" + this.mCodecId);
        if (mediaPlayer != null && this.mHardwareDecodeEnablePlayer2 == 1) {
            mediaPlayer.setIntOption(181, this.mAsyncInitEnable);
            mediaPlayer.setIntOption(182, this.mCodecId);
            this.mLogger.useAsyncInit(this.mAsyncInitEnable, this.mCodecId);
        }
    }

    void _doSetDirectURL(String str, String[] strArr) {
        if ((!Arrays.equals(this.mOriginalUrls, strArr)) && (!TTVideoEngineUtils.isFlagOn(EngineGlobalConfig.getInstance().getEngineOptimizeFlag(), 1L) || this.mEngineHasUsed)) {
            TTVideoEngineLog.i(logcatTag(), "set direct url:" + str);
            _ShutdownOldSource();
            this.mState = 0;
            this.mFirstURL = true;
            this.mFirstIP = true;
            this.mFirstHost = true;
            this.mUserStopped = false;
            this.mLastPlaybackTime = 0;
            this.mAPIString = null;
        }
        this.mEngineHasUsed = true;
        this.mStarted = false;
        this.mIsDirectURL = true;
        this.mDirectURL = str;
        this.mDirectUrlSrc = str;
        this.mOriginalUrls = strArr;
        this.mBufferingStartT = 0L;
        this.mFileKey = null;
        Resolution resolution = Resolution.Undefine;
        this.currentResolution = resolution;
        this.mLogger.configResolution(_resolutionToString(resolution), "");
        this.mLogger.setSourceType(1, "");
    }

    void _doSetLongOption2(int i, long j) {
        if (i != 440) {
            if (i != 725) {
                super.setLongOption(i, j);
            } else {
                IVideoEventLogger iVideoEventLogger = this.mLogger;
                if (iVideoEventLogger != null) {
                    iVideoEventLogger.setVrHeadMovementDelay(j);
                }
            }
        } else if (j > 0) {
            NativeAudioProcessor nativeAudioProcessor = new NativeAudioProcessor();
            this.mAudioProcessor = nativeAudioProcessor;
            nativeAudioProcessor.setNativeWrapper(j);
            if (this.mMediaPlayer != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(this.mAudioProcessor);
            }
        }
        TTVideoEngineLog.i(logcatTag(), "set long option key:" + i + ",value:" + j);
    }

    void _seekTo(int i, boolean z) {
        int _getPlayerTime;
        TTVideoEngineLog.i(logcatTag(), "_seekTo:" + i);
        MediaPlayer mediaPlayer = this.mMediaPlayer;
        if (mediaPlayer != null && this.mStarted) {
            if (z) {
                _getPlayerTime = this.mLastPlaybackTime;
            } else {
                _getPlayerTime = _getPlayerTime();
            }
            this.mSeeking = true;
            this.mSeekingStartTime = SystemClock.currentThreadTimeMillis();
            this.mLastPlaybackTime = i;
            setPlayInfo(6, 1L);
            if (this.mSeekMode != 0 && isPlayerSupportSeekMode()) {
                if (mediaPlayer instanceof MediaPlayerWrapper) {
                    ((MediaPlayerWrapper) mediaPlayer).seekTo(i, this.mSeekMode);
                }
            } else {
                mediaPlayer.seekTo(i);
            }
            setPlayInfo(1, i);
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                videoSurface.setIntOption(33, 0);
            }
            this.mLogger.seekTo(_getPlayerTime, i, z);
            return;
        }
        _seekComplete(false);
    }

    @Override
    public void openTextureSR(boolean z, boolean z2) {
        TTVideoEngineLog.i(logcatTag(), "[SRLog]openTextureSR =  sr = " + z + ", open =" + z2 + " srStrategyMode=" + this.mSRStrategy.getSRStrategyMode());
        if (!FeatureManager.hasPermission("super_resolution") || this.mSRStrategy.getSRStrategyMode() == 0) {
            return;
        }
        this.mSRStrategy.setSRStrategyMode(1);
        this.mUseSRTexture = z;
        this.mTextureSrOpen = z2 ? 1 : 0;
        int i = 0;
        if (!z || !z2) {
            i = -7890;
        }
        if (this.mDynamicControlSR) {
            doOpenSR(z2 ? 1 : 0, i);
        }
    }

    @Override
    public void setPlayAuthToken(String str, int i) {
        TTVideoEngineLog.d(logcatTag(), "setPlayAPIVersion:" + i);
        this.mPlayAPIVersion = i;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setPlayAPIVersion(i, str);
        }
        String base64Decode = TTHelper.base64Decode(str);
        if (!TextUtils.isEmpty(base64Decode)) {
            try {
                String optString = new JSONObject(base64Decode).optString("GetPlayInfoToken");
                this.mAuthorization = optString;
                if (TextUtils.isEmpty(optString)) {
                    this.mAuthorization = base64Decode;
                }
            } catch (JSONException e) {
                e.printStackTrace();
                this.mAuthorization = base64Decode;
            }
        }
    }

    @Override
    public void setSurfaceSync(Surface surface, long j) {
        TTVideoEngineLog.i(logcatTag(), "setSurfaceSync = " + surface + ",timeout:" + j + "this:" + this + ",setSurfaceDirectly:" + this.mSetSurfaceDirectly);
        if (this.mSetSurfaceDirectly > 0) {
            MediaPlayer mediaPlayer = this.mAsyncPlayer;
            if (mediaPlayer == null) {
                mediaPlayer = this.mMediaPlayer;
            }
            if (mediaPlayer != null && mediaPlayer.getPlayerType() == 1) {
                if (surface == null) {
                    this.mLastSetSurfaceNullTime = System.currentTimeMillis();
                }
                _doSetSurfaceTimeOut(surface, (int) j);
                return;
            }
        }
        _setSurfaceSync(surface, j, true);
    }

    @Override
    public void setVolume(float f, float f2) {
        TTVideoEngineLog.i(logcatTag(), "setVolume left:" + f + " right:" + f2);
        this.mLeftVolume = f;
        this.mRightVolume = f2;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(9, 0, 0, Float.valueOf(f), Float.valueOf(f2));
        } else {
            setPlayerVolume(f, f2);
        }
    }

    private void _retry(int i, Error error) {
        String str;
        String str2;
        if (i != 0) {
            if (i != 1) {
                if (i != 2) {
                    if (i != 3) {
                        if (i == 12 && !this.mCodecStrategyAdapter.interceptFallbackRetry(error)) {
                            _notifyError(error);
                            return;
                        }
                        return;
                    }
                    if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 1 && getConfigInt(1130, this.mEngineRetryNotify) == 1) {
                        this.mMediaPlayer.setIntOption(1349, 1);
                    }
                    if (!this.mIsLocal && !this.mIsDirectURL) {
                        boolean z = this.mIsPreloaderItem;
                        if (!z && !this.mIsPlayItem) {
                            _playInternal(this.mURLInfo.getCurrentURL(), this.mHeaders);
                            return;
                        }
                        if (z) {
                            str2 = this.mPreloaderItem.mUrl;
                        } else {
                            str2 = this.mPlayItem.playURL;
                        }
                        _singleURLParseAndPlay(str2, this.mHeaders);
                        return;
                    }
                    if (this.mIsLocal) {
                        str = this.mLocalURL;
                    } else {
                        str = this.mDirectURL;
                    }
                    _singleURLParseAndPlay(str, this.mHeaders);
                    return;
                }
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 1 && getConfigInt(1130, this.mEngineRetryNotify) == 1) {
                    this.mMediaPlayer.setIntOption(1349, 1);
                }
                _tryNextURL();
                return;
            }
            resetFallbackApi(error);
            if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 1 && getConfigInt(1130, this.mEngineRetryNotify) == 1) {
                this.mMediaPlayer.setIntOption(1349, 1);
            }
            _fetchVideoInfo();
            return;
        }
        _notifyError(error);
    }

    private void setMediaBuffer2Abr(i iVar, IVideoModel iVideoModel) {
        List<VideoInfo> videoInfoList;
        long cacheFileSize;
        if (iVideoModel != null) {
            if ((this.mStandAlongAbrStartUp != 0 || this.mEnableABR != 0) && (videoInfoList = iVideoModel.getVideoInfoList()) != null && videoInfoList.size() != 0) {
                for (VideoInfo videoInfo : videoInfoList) {
                    if (videoInfo != null) {
                        String valueStr = videoInfo.getValueStr(15);
                        if (getConfigInt(584, this.mQuickGetFileCache ? 1 : 0) == 1) {
                            cacheFileSize = TTVideoEngine.quickGetCacheFileSize(valueStr);
                        } else {
                            cacheFileSize = TTVideoEngine.getCacheFileSize(valueStr);
                        }
                        iVar.a(videoInfo.getMediatype(), valueStr, videoInfo.getValueInt(3), cacheFileSize, videoInfo.getValueInt(38));
                    }
                }
                iVar.a(34, getConfigInt(334, this.mScreenWidth));
                iVar.a(35, getConfigInt(335, this.mScreenHeight));
                iVar.a(6, this.mPlayerViewWidth);
                iVar.a(7, this.mPlayerViewHeight);
                iVar.a(75, this.mTag);
                iVar.a(76, this.mSubTag);
                JSONObject vodJsonObject = SettingsHelper.helper().getVodJsonObject("abr_params");
                if (vodJsonObject != null) {
                    this.mAbrUserQualitySensitivity = (float) vodJsonObject.optDouble("user_quality_sensitivity");
                    this.mAbrUserEnterFullScreen = vodJsonObject.optInt("user_enter_full_screen");
                    iVar.a(72, this.mAbrUserQualitySensitivity);
                    iVar.a(73, this.mAbrUserEnterFullScreen);
                    TTVideoEngineLog.i(logcatTag(), "standalong abr start up set mAbrUserQualitySensitivity=" + this.mAbrUserQualitySensitivity + " mAbrUserEnterFullScreen=" + this.mAbrUserEnterFullScreen);
                }
            }
        }
    }

    private void setSurfaceHookTimeOut(Surface surface, int i) {
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        TTVideoEngineLog.i(logcatTag(), "setSurfaceHook, player:" + mediaPlayer + ", surface:" + surface + ", texturesurface:" + this.mTextureSurface + ", this:" + this + ", timeoutMs:" + i);
        if (this.mEnableSurfaceHashmapJudgement > 0) {
            _judgeSurfaceHashMap(surface);
        }
        if (mediaPlayer != null) {
            this.mLogger.setSurfaceSourceType("external");
            this.mLogger.setSurfaceBegin();
            if ((getConfigInt(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME, this.mFirstFrameOpenTexture) == 1 && this.mSurfaceHolder == null && !this.mPlayerFirstFrame) || (getConfigInt(587, this.mEnableForceDisableOESRender ? 1 : 0) == 1 && getConfigInt(588, this.mForceDisableOESRender ? 1 : 0) == 1)) {
                if (i <= 0) {
                    _doSetPlayerSurface(surface, 1);
                } else {
                    _doSetPlayerSurfaceTimeOut(surface, 1, i);
                }
            } else {
                String logcatTag = logcatTag();
                StringBuilder sb = new StringBuilder();
                sb.append("set surface to player = ");
                Surface surface2 = this.mTextureSurface;
                if (surface2 == null) {
                    surface2 = surface;
                }
                sb.append(surface2);
                TTVideoEngineLog.i(logcatTag, sb.toString());
                if (i <= 0) {
                    Surface surface3 = this.mTextureSurface;
                    if (surface3 == null) {
                        surface3 = surface;
                    }
                    _doSetPlayerSurface(surface3, 0);
                } else {
                    Surface surface4 = this.mTextureSurface;
                    if (surface4 == null) {
                        surface4 = surface;
                    }
                    _doSetPlayerSurfaceTimeOut(surface4, 0, i);
                }
                VideoSurface videoSurface = this.mTextureSurface;
                if (videoSurface != null && this.mTextureRenderer != null) {
                    videoSurface.updateRenderSurface(surface);
                    this.mLogger.useTextureRender(1);
                }
            }
            if (this.mEnableSurfaceHashmapJudgement > 0 && surface != null) {
                this.mSurfaceRecord = surface;
            }
            this.mLogger.setSurfaceEnd();
        }
    }

    void _configResolution(Resolution resolution, Map<Integer, String> map) {
        int i;
        int i2;
        boolean z;
        Map<Integer, String> map2;
        if (resolution == Resolution.Auto && !FeatureManager.hasPermission("abr")) {
            return;
        }
        if (this.mSRStrategy.getSRStrategyMode() == 0 && this.mHasFirstFrameShown) {
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                i2 = videoSurface.getIntOption(6);
            } else {
                i2 = 0;
            }
            if (this.currentResolution == resolution && (((map2 = this.currentParams) == null && map == null) || (map2 != null && map2.equals(map)))) {
                z = false;
            } else {
                z = true;
            }
            if (true == z || 1 == i2) {
                this.mSRStrategy.updateConfig(SRStrategyConfig.newConfig().resolutionChanged(true));
                this.mTextureSrOpen = 0;
                this.mSRNotUseReason = -7879;
                doOpenSR(0, -7879);
            }
        }
        if (getConfigInt(503, this.mABRSwitchMode) == 0) {
            if (resolution == Resolution.Auto) {
                i = 1;
            } else {
                i = 0;
            }
            setIntOption(494, i);
        }
        if (resolution != Resolution.Auto) {
            if (this.mState != 0 && this.mState != 1 && !this.mIsPlayComplete) {
                if (this.mState == 3) {
                    if (this.mLooperThread.checkEngineLooperThread(false)) {
                        this.mLooperThread.postEngineMessage(8, 0, 0, resolution, map);
                        return;
                    } else {
                        _switchToResolution(resolution, map);
                        return;
                    }
                }
                return;
            }
            this.lastResolution = resolution;
            this.currentResolution = resolution;
            this.currentParams = map;
            if (TextUtils.isEmpty(this.mDirectURL) && TextUtils.isEmpty(this.mLocalURL)) {
                this.mLogger.configResolution(_resolutionToString(resolution), _resolutionToString(resolution));
            }
        }
    }

    void _doSetLongOption(int i, long j) {
        if (this.mConfigCenterVersion > 0) {
            _doSetLongOption2(i, j);
            return;
        }
        if (ConfigItemFactory.isCommonPlayerOption(i)) {
            this.mOptionHolder.setLongOption(i, j);
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setLongOption(i, j);
            }
        }
        if (i != 440) {
            if (i != 709) {
                if (i != 725) {
                    super.setLongOption(i, j);
                } else {
                    IVideoEventLogger iVideoEventLogger = this.mLogger;
                    if (iVideoEventLogger != null) {
                        iVideoEventLogger.setVrHeadMovementDelay(j);
                    }
                }
            } else {
                this.mPrecisePausePts = j;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setLongOption(668, j);
                }
            }
        } else if (j > 0) {
            NativeAudioProcessor nativeAudioProcessor = new NativeAudioProcessor();
            this.mAudioProcessor = nativeAudioProcessor;
            nativeAudioProcessor.setNativeWrapper(j);
            if (this.mMediaPlayer != null) {
                ((MediaPlayerWrapper) this.mMediaPlayer).setAudioProcessor(this.mAudioProcessor);
            }
        }
        TTVideoEngineLog.i(logcatTag(), "set long option key:" + i + ",value:" + j);
    }

    void _doSetStringOption2(int i, String str) {
        if (i != 532) {
            if (i != 549) {
                if (i != 659) {
                    if (i != 715) {
                        if (i != 957) {
                            if (i != 1205) {
                                super.setStringOption(i, str);
                            } else {
                                IVideoEventLogger iVideoEventLogger = this.mLogger;
                                if (iVideoEventLogger != null) {
                                    iVideoEventLogger.setStringOption(128, str);
                                    if ("get existing from EnginePool".equals(str) || "new by EnginePool".equals(str)) {
                                        this.mLogger.addFeature("from_engpool", 1);
                                    }
                                }
                            }
                        } else if (!this.mPrivCodecName.contains(str)) {
                            this.mPrivCodecName.add(str);
                        }
                    } else {
                        this.mLogger.setStringOption(113, str);
                    }
                } else {
                    this.mClassLoaderState = str;
                }
            } else {
                this.mSubVersions = str;
            }
        } else {
            this.mSubLanIds = str;
        }
        TTVideoEngineLog.i(logcatTag(), "set string option key:" + i + " value:" + str);
    }

    void _doSetSurfaceHolder(SurfaceHolder surfaceHolder, boolean z) {
        if (z && this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        SurfaceHolder surfaceHolder2 = this.mSurfaceHolder;
        TTVideoEngineSurfaceCallback tTVideoEngineSurfaceCallback = this.mSurfaceCallback;
        if (tTVideoEngineSurfaceCallback != null && surfaceHolder2 != null) {
            TTVideoEngineLog.d(logcatTag(), "remove callback:" + this.mSurfaceCallback + ", surfaceholder:" + surfaceHolder + ", mSurface:" + this.mSurface + ", mSurfaceHolder:" + this.mSurfaceHolder);
            tTVideoEngineSurfaceCallback.reset();
            surfaceHolder2.removeCallback(tTVideoEngineSurfaceCallback);
            this.mSurfaceCallback = null;
        }
        this.mSurfaceHolder = surfaceHolder;
        if (getConfigInt(951, this.mSurfaceHolderByKernel) != 0) {
            MediaPlayer mediaPlayer = this.mMediaPlayer;
            if (mediaPlayer != null) {
                this.mLogger.setSurfaceSourceType("external");
                this.mLogger.setSurfaceBegin();
                mediaPlayer.setDisplay(surfaceHolder);
                this.mLogger.setSurfaceEnd();
                if (surfaceHolder != null) {
                    this.mLogger.setSurface(surfaceHolder.toString());
                    return;
                }
                return;
            }
            return;
        }
        if (surfaceHolder == null) {
            setSurfaceHook(null);
            return;
        }
        Surface surface = surfaceHolder.getSurface();
        addSurfaceCallback(surfaceHolder);
        setSurfaceHook(surface);
        if (surface != null) {
            this.mLogger.setSurface("SurfaceHolderWithSurface@" + surface.toString());
        }
        setSurfaceDimensionsToTextureRender();
    }

    @Override
    public ArrayList<HashMap<String, Object>> crosstalkHappen(ArrayList<TTVideoEngine> arrayList, HashMap<String, TTVideoEngineMonitor.TTVideoEngineLivePlayerInfo> hashMap) {
        ArrayList arrayList2 = new ArrayList();
        ArrayList<HashMap<String, Object>> arrayList3 = new ArrayList<>();
        boolean z = false;
        HashMap<String, Object> generateCrosstalkMap = generateCrosstalkMap(this.mTag, this.mSubTag, 0, null);
        arrayList3.add(generateCrosstalkMap);
        String generateCrosstalkStr = generateCrosstalkStr(generateCrosstalkMap);
        if (!TextUtils.isEmpty(generateCrosstalkStr)) {
            arrayList2.add(generateCrosstalkStr);
        }
        Iterator<TTVideoEngine> it2 = arrayList.iterator();
        while (it2.hasNext()) {
            TTVideoEngine next = it2.next();
            if (!next.equals(this.mEngineWrapper)) {
                HashMap<String, Object> generateCrosstalkMap2 = generateCrosstalkMap(next.getTag(), next.getSubTag(), 0, null);
                arrayList3.add(generateCrosstalkMap2);
                String generateCrosstalkStr2 = generateCrosstalkStr(generateCrosstalkMap2);
                if (!TextUtils.isEmpty(generateCrosstalkStr2)) {
                    arrayList2.add(generateCrosstalkStr2);
                }
            }
        }
        if (hashMap != null && hashMap.size() > 0) {
            for (String str : hashMap.keySet()) {
                TTVideoEngineMonitor.TTVideoEngineLivePlayerInfo tTVideoEngineLivePlayerInfo = hashMap.get(str);
                if (tTVideoEngineLivePlayerInfo != null) {
                    String generateCrosstalkStr3 = generateCrosstalkStr(generateCrosstalkMap(tTVideoEngineLivePlayerInfo.mTag, tTVideoEngineLivePlayerInfo.mSubTag, 1, str));
                    if (!TextUtils.isEmpty(generateCrosstalkStr3)) {
                        arrayList2.add(generateCrosstalkStr3);
                    }
                }
            }
            z = true;
        }
        if (!z && arrayList2.size() >= 2) {
            this.mLogger.crosstalkHappen(arrayList2.size(), arrayList2);
        }
        return arrayList3;
    }

    @Override
    public void setDirectUrlUseDataLoaderByFilePath(String[] strArr, String str) {
        if (strArr != null && strArr.length != 0 && !TextUtils.isEmpty(strArr[0])) {
            this.mInitialUrlBeforeMdlProxy = strArr[0];
            if (TextUtils.isEmpty(str)) {
                setDirectURL(strArr[0]);
                this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.EmptyFilepath.ordinal());
                return;
            }
            if (getConfigInt(160, this.mDataLoaderEnable) == 0) {
                setDirectURL(strArr[0]);
                this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.OptionNotSet.ordinal());
                return;
            }
            _resetUsingDataLoaderField();
            String keyFromFilePath = TTHelper.keyFromFilePath(this.mContext, str);
            String _mdlUrl = _mdlUrl(keyFromFilePath, this.mVideoID, getConfigInt(161, this.mLimitMDLCacheSize), strArr, Resolution.Undefine, this.mDecryptionKey, null, str, null, 0L, null);
            if (!this.mFileHashs.contains(keyFromFilePath)) {
                this.mFileHashs.add(keyFromFilePath);
            }
            if (TextUtils.isEmpty(_mdlUrl)) {
                setDirectURL(strArr[0]);
                return;
            } else {
                setDirectURL(_mdlUrl);
                return;
            }
        }
        TTVideoEngineLog.e(logcatTag(), "invalid urls list, it is empty");
    }

    @Override
    public void setPlayInfo(int i, long j) {
        if (getConfigInt(160, this.mDataLoaderEnable) > 0) {
            if (TextUtils.isEmpty(this.mTraceId)) {
                TTVideoEngineLog.t(logcatTag(), "trace id null, not allow setplayinfo");
                return;
            }
            int i2 = -1;
            switch (i) {
                case 0:
                    i2 = 22;
                    break;
                case 1:
                    i2 = 23;
                    break;
                case 2:
                    i2 = 24;
                    break;
                case 3:
                    i2 = 25;
                    break;
                case 4:
                    i2 = 26;
                    break;
                case 5:
                    MediaPlayer mediaPlayer = this.mMediaPlayer;
                    if (mediaPlayer == null) {
                        TTVideoEngineLog.t("MDL-SETPLAYINFO", "mediaplayer is null not allow set PLAY_INFO_CURRENT_BUFFER");
                        return;
                    }
                    if (j == -1) {
                        j = mediaPlayer.getLongOption(73, -1L);
                        long longOption = mediaPlayer.getLongOption(72, -1L);
                        if (j >= 0 && longOption >= 0) {
                            j = Math.min(j, longOption);
                        } else if (longOption >= 0) {
                            j = longOption;
                        }
                    }
                    i2 = 27;
                    break;
                    break;
                case 6:
                    i2 = 28;
                    break;
            }
            if (this.mEnableSetPlayInfoToP2P != 0 && getConfigInt(302, this.mForbidP2P) != 1) {
                DataLoaderHelper.getDataLoader().setPlayInfo(i2, this.mTraceId, this.mVideoID, j);
            } else {
                DataLoaderHelper.getDataLoader().setPlayInfoOnlyForPreload(i2, this.mTraceId, this.mVideoID, j);
            }
            if (!TTVideoEngineUtils.isFlagOn(EngineGlobalConfig.getInstance().getEngineOptimizeFlag(), 8L)) {
                TTVideoEngineLog.t("MDL-SETPLAYINFO", "set play info into mdl key:" + i2 + "value:" + j + "traceid:" + this.mTraceId);
            }
        }
    }

    @Override
    protected void updateLoadState(int i, int i2) {
        IVideoEventLogger iVideoEventLogger;
        IVideoEventLogger iVideoEventLogger2;
        if (this.mLoadState != i) {
            TTVideoEngineLog.i(logcatTag(), "load state changed, prev:" + this.mLoadState + ", current:" + i);
            if (i == 2) {
                if (this.mHasFirstFrameShown && !this.mSeeking && this.mLoadState != 3) {
                    int _getPlayerTime = _getPlayerTime();
                    this.mBufferingType = i2;
                    int i3 = -1;
                    IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                    if (iVideoEventLogger3 != null) {
                        iVideoEventLogger3.movieStalled(i2, _getPlayerTime);
                        i3 = this.mLogger.getMovieStalledType();
                    }
                    if (i2 == 0) {
                        setPlayInfo(3, i3);
                    }
                    this.mBufferingStartT = SystemClock.elapsedRealtime();
                }
                if (this.mHasFirstFrameShown && this.mSeeking && (iVideoEventLogger2 = this.mLogger) != null) {
                    iVideoEventLogger2.setIntOption(155, i2 + 1);
                    this.mLogger.setLoggerTimes(170);
                }
            }
            if (i == 1 && this.mHasFirstFrameShown && this.mSeeking && (iVideoEventLogger = this.mLogger) != null) {
                iVideoEventLogger.setLoggerTimes(171);
            }
            this.mLoadState = i;
            notifyLoadStateChanged(this.mLoadState);
            if (i == 2 && this.mMediaPlayer != null) {
                long longOption = this.mMediaPlayer.getLongOption(665, 0L);
                if (longOption > 0) {
                    HashMap hashMap = new HashMap();
                    hashMap.put("diff", Long.valueOf(longOption));
                    this.mLogger.onAVBadInterlaced(longOption);
                    if (this.mLooperThread.checkSendMainLooper()) {
                        this.mLooperThread.postMainLooperMessage(420, 0, 0, hashMap);
                    } else {
                        this.mListenerCompact.onAVBadInterlaced(hashMap);
                    }
                }
            }
        }
    }

    private void _setDataSource(String str, Map<String, String> map) throws IOException {
        String str2;
        if (this.mEnableTmpLog == 1) {
            showLongLog("setDatasource before url:" + str);
        }
        String _generatePlayUrl = _generatePlayUrl(str, map);
        if (this.mRetryEnableHttps) {
            _generatePlayUrl = TTHelper.buildHttpsUrl(_generatePlayUrl);
        }
        if (this.mEnableTmpLog == 1) {
            showLongLog("setDatasource after url:" + _generatePlayUrl);
        }
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setCustomP2PCDNType(this.mP2PCDNType);
        }
        if (!this.mPrepared) {
            long currentTimeMillis = System.currentTimeMillis();
            IVideoEventLogger iVideoEventLogger2 = this.mLogger;
            if (iVideoEventLogger2 != null) {
                this.mTraceId = iVideoEventLogger2.getTraceID();
            } else {
                this.mTraceId = TTHelper.genTrackID(AppInfo.mDeviceId, currentTimeMillis);
            }
            if (!TextUtils.isEmpty(this.mTraceId)) {
                map.put("X-Tt-Traceid", this.mTraceId);
                this.mHeaders.put("X-Tt-Traceid", this.mTraceId);
                TTVideoEngineLog.i(logcatTag(), "X-Tt-Traceid:" + this.mTraceId);
            }
            if (!TextUtils.isEmpty(this.mMDLGroupId)) {
                map.put("X-Tt-GroupId", this.mMDLGroupId);
                this.mLogger.setStringOption(156, this.mMDLGroupId);
                TTVideoEngineLog.i(logcatTag(), "X-Tt-GroupId:" + this.mMDLGroupId);
            }
            int i = this.mFallbackApiRetry;
            if (!this.mIsDirectURL && i != 0) {
                this.mHeaders.put("X-Tt-Fapi", String.valueOf(i));
                this.mHeaders.put("Engine-ID", String.valueOf(this.mEngineHash));
                this.mLogger.setIntOption(34, i);
            }
            int configInt = getConfigInt(857, this.mNetSpeedInterval);
            if (TTVideoEngine.sABRSpeedPredictInputType == 1) {
                TTVideoEngineLog.d(logcatTag(), "HEADER_IS_SPEEDTEST single data, interval:" + TTVideoEngine.sTestSpeedInterval);
                this.mHeaders.put("X-SpeedTest-TimeInternal", String.valueOf(TTVideoEngine.sTestSpeedInterval));
            } else if (TTVideoEngine.sABRSpeedPredictInputType == 0 && this.mEnableNetLevel > 0 && configInt > 0) {
                TTVideoEngineLog.d(logcatTag(), "enableNetLevel, interval: " + configInt);
                this.mHeaders.put("X-SpeedTest-TimeInternal", String.valueOf(configInt));
            }
            Map<String, String> map2 = this.mHeaders;
            if (TextUtils.isEmpty(this.mTag)) {
                str2 = "default";
            } else {
                str2 = this.mTag;
            }
            map2.put("X-Tt-Tag", str2);
            int i2 = this.mUseVdpDisk;
            if (this.mConfigCenterVersion > 0) {
                i2 = this.mEngineConfig.getIntOption(801);
                if (i2 == 1) {
                    i2 = 0;
                } else if (i2 == 0) {
                    i2 = 1;
                }
            }
            if (i2 == 0 || i2 == 1) {
                this.mHeaders.put("X-Tt-VdpIo", String.valueOf(i2));
            }
            if (!TextUtils.isEmpty(this.mSubTag)) {
                this.mHeaders.put("X-Tt-SubTag", this.mSubTag);
            }
        }
        if (map != null) {
            TTVideoEngineLog.i(logcatTag(), "setDataSource X-Tt-Traceid:" + map.get("X-Tt-Traceid"));
        }
        if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 0 && getConfigInt(4022, this.mOSPlayerIgnoreHeaders ? 1 : 0) != 0) {
            map.clear();
        }
        this.mMediaPlayer.setDataSource(this.mContext, Uri.parse(_generatePlayUrl), map);
    }

    private void _stop(boolean z, int i) {
        if (getConfigInt(982, this.mPlayDurationExcludePlayerMethod ? 1 : 0) == 1 && this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        resetTexture();
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        TTVideoEngineLog.i(logcatTag(), "_stop, mState:" + this.mState + ", this:" + this);
        int i2 = this.mState;
        if (i2 != 0) {
            if (i2 != 1) {
                if (i2 != 2) {
                    if (i2 != 3) {
                        if (i2 == 4) {
                            this.mUserStopped = true;
                            VideoInfoFetcher videoInfoFetcher = this.mFetcher;
                            if (videoInfoFetcher != null) {
                                videoInfoFetcher.cancel();
                            }
                            DNSParser dNSParser = this.mDNSParser;
                            if (dNSParser != null) {
                                dNSParser.cancel();
                            }
                        }
                    } else {
                        this.mUserStopped = true;
                    }
                } else {
                    this.mUserStopped = true;
                    DNSParser dNSParser2 = this.mDNSParser;
                    if (dNSParser2 != null) {
                        dNSParser2.cancel();
                    }
                }
            } else {
                this.mUserStopped = true;
                VideoInfoFetcher videoInfoFetcher2 = this.mFetcher;
                if (videoInfoFetcher2 != null) {
                    videoInfoFetcher2.cancel();
                }
            }
        } else {
            this.mUserStopped = true;
        }
        _updateLogger();
        if (mediaPlayer != null && z && (mediaPlayer.getPlayerType() != 0 || (mediaPlayer.getPlayerType() == 0 && this.mPrepared))) {
            mediaPlayer.stop();
        }
        if (getConfigInt(982, this.mPlayDurationExcludePlayerMethod ? 1 : 0) != 1 && this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(33, 0);
        }
        IntertrustDrmHelper intertrustDrmHelper = this.mIntertrustDrmHelper;
        if (intertrustDrmHelper != null) {
            intertrustDrmHelper.stop();
        }
        if (this.mLogger != null) {
            if (mediaPlayer != null) {
                int currentPosition = mediaPlayer.getCurrentPosition();
                _updateCurrentPlaybackPosition(currentPosition, false);
                this.mLogger.curPlayBackTime(currentPosition);
                if (this.mState == 3) {
                    this.mLogger.setHijackCode(mediaPlayer.getIntOption(l.g, -1));
                }
            }
            if (this.mPlaybackState != 0 && this.mPlayDuration != null) {
                this.mLogger.addWatchedDuration(this.mPlayDuration.getPlayedDuration());
            }
            this.mLogger.stop(i);
        }
        updatePlaybackState(0);
        this.mHasFirstFrameShown = false;
        this.mHasFetchedSubtitle = false;
        this.mRenderStartTime = -1L;
        this.mPlayStartTime = -1L;
        this.mHasAudioFirstFrameShown = false;
        this.mPlayTime = 0L;
        this.mDecodedVideoFirstFrame = false;
        this.mPlayerFirstFrame = false;
        this.mTextureFirstFrame = false;
        this.mSeeking = false;
        if (i != 6) {
            if (this.mSurfaceCallback != null) {
                if (this.mSurfaceHolder != null) {
                    this.mSurfaceHolder.removeCallback(this.mSurfaceCallback);
                }
                TTVideoEngineLog.i(logcatTag(), "remove surface callback:" + this.mSurfaceCallback);
                this.mSurfaceCallback.reset();
                this.mSurfaceCallback = null;
            }
            this.mSkipStartWhenPrepared = false;
            this.mEngineConfig.remove(681);
            _updateTextureState(3);
            _isEnableEffect(8, 0);
            this.mEnableTextureRenderNativeWindow = 0;
            this.mEnableFrameCallbackInRenderThread = 0;
        }
    }

    private void setMediaInfo2Abr(i iVar, IVideoModel iVideoModel) {
        HashMap hashMap;
        HashMap hashMap2;
        List<VideoInfo> videoInfoList = iVideoModel.getVideoInfoList();
        if (videoInfoList != null && videoInfoList.size() != 0) {
            List<q> arrayList = new ArrayList<>();
            List<k> arrayList2 = new ArrayList<>();
            for (VideoInfo videoInfo : videoInfoList) {
                if (videoInfo != null) {
                    if (videoInfo.getMediatype() == VideoRef.TYPE_VIDEO) {
                        com.bytedance.vcloud.abrmodule.g gVar = new com.bytedance.vcloud.abrmodule.g();
                        String valueStr = videoInfo.getValueStr(15);
                        gVar.f34316a = valueStr;
                        gVar.g = videoInfo.getValueInt(3);
                        gVar.f34317b = videoInfo.getValueStr(8);
                        gVar.j = videoInfo.getValueInt(44);
                        int valueInt = videoInfo.getValueInt(1);
                        int valueInt2 = videoInfo.getValueInt(2);
                        gVar.d = valueInt;
                        gVar.e = valueInt2;
                        gVar.f = -1;
                        gVar.f34318c = 5000;
                        if (!TextUtils.isEmpty(valueStr)) {
                            arrayList.add(gVar);
                        }
                        boolean booleanValue = this.mSRStrategy.videoInfoSupportSR(videoInfo, videoInfoList).booleanValue();
                        int resolutionIndex = SRStrategy.getResolutionIndex(videoInfo);
                        gVar.h = booleanValue ? 1 : 0;
                        gVar.i = resolutionIndex;
                    } else {
                        com.bytedance.vcloud.abrmodule.a aVar = new com.bytedance.vcloud.abrmodule.a();
                        String valueStr2 = videoInfo.getValueStr(15);
                        aVar.f34301a = valueStr2;
                        aVar.e = videoInfo.getValueInt(3);
                        aVar.f34302b = videoInfo.getValueStr(8);
                        aVar.f = videoInfo.getValueInt(44);
                        aVar.d = -1;
                        aVar.f34303c = 5000;
                        if (!TextUtils.isEmpty(valueStr2)) {
                            arrayList2.add(aVar);
                        }
                    }
                }
            }
            iVar.a(arrayList, arrayList2);
            String configString = getConfigString(538, this.mABR4GMaxResolutionQuality);
            Resolution valueOf = Resolution.valueOf(getConfigInt(502, this.mABR4GMaxResolutionIndex));
            HashMap hashMap3 = null;
            if (valueOf != null || !TextUtils.isEmpty(configString)) {
                if (!TextUtils.isEmpty(configString)) {
                    hashMap = new HashMap();
                    hashMap.put(32, configString);
                } else {
                    hashMap = null;
                }
                if (iVideoModel.getVideoInfo(valueOf, (Map<Integer, String>) hashMap, true) != null) {
                    iVar.a(2, r3.getValueInt(3));
                }
            }
            Resolution valueOf2 = Resolution.valueOf(getConfigInt(536, this.mWifiDefaultResolutionIndex));
            String configString2 = getConfigString(539, this.mWifiDefaultResolutionQuality);
            if (valueOf2 != null || !TextUtils.isEmpty(configString2)) {
                if (!TextUtils.isEmpty(configString2)) {
                    hashMap2 = new HashMap();
                    hashMap2.put(32, configString2);
                } else {
                    hashMap2 = null;
                }
                if (iVideoModel.getVideoInfo(valueOf2, (Map<Integer, String>) hashMap2, true) != null) {
                    iVar.a(12, r3.getValueInt(3));
                }
            }
            Resolution valueOf3 = Resolution.valueOf(getConfigInt(537, this.mStartupMaxBitRateIndex));
            String configString3 = getConfigString(540, this.mStartupMaxBitRateQuality);
            if (valueOf3 != null || !TextUtils.isEmpty(configString3)) {
                if (!TextUtils.isEmpty(configString3)) {
                    hashMap3 = new HashMap();
                    hashMap3.put(32, configString3);
                }
                if (iVideoModel.getVideoInfo(valueOf3, (Map<Integer, String>) hashMap3, true) != null) {
                    iVar.a(13, r3.getValueInt(3));
                }
            }
            iVar.a(66, iVideoModel.getVideoRefInt(3));
            String videoRefStr = iVideoModel.getVideoRefStr(237);
            if (!TextUtils.isEmpty(videoRefStr)) {
                iVar.a(69, videoRefStr);
            }
            iVar.a(82, this.mABREnableAggressivePortraitLowBit);
        }
    }

    void _doSetStringOption(int i, String str) {
        if (this.mConfigCenterVersion > 0) {
            _doSetStringOption2(i, str);
            return;
        }
        if (ConfigItemFactory.isCommonPlayerOption(i)) {
            this.mOptionHolder.setStringOption(i, str);
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setStringOption(i, str);
            }
        }
        if (i != 355) {
            if (i != 549) {
                if (i != 659) {
                    if (i != 662) {
                        if (i != 715) {
                            if (i != 957) {
                                if (i != 1000) {
                                    if (i != 1205) {
                                        if (i != 360) {
                                            if (i != 361) {
                                                if (i != 531) {
                                                    if (i != 532) {
                                                        switch (i) {
                                                            case 538:
                                                                this.mABR4GMaxResolutionQuality = str;
                                                                break;
                                                            case 539:
                                                                this.mWifiDefaultResolutionQuality = str;
                                                                break;
                                                            case 540:
                                                                this.mStartupMaxBitRateQuality = str;
                                                                break;
                                                            default:
                                                                switch (i) {
                                                                    case 545:
                                                                        this.mDowngradeResolutionQuality = str;
                                                                        break;
                                                                    case 546:
                                                                        this.mSubIds = str;
                                                                        break;
                                                                    case 547:
                                                                        this.mSubFormat = str;
                                                                        break;
                                                                    default:
                                                                        switch (i) {
                                                                            case 1410:
                                                                                this.mPlayLoadConfig = str;
                                                                                break;
                                                                            case 1411:
                                                                                this.mPlayRangeConfig = str;
                                                                                break;
                                                                            case 1412:
                                                                                this.mPlayBufferConfig = str;
                                                                                break;
                                                                            default:
                                                                                super.setStringOption(i, str);
                                                                                break;
                                                                        }
                                                                }
                                                        }
                                                    } else {
                                                        this.mSubLanIds = str;
                                                    }
                                                } else {
                                                    this.mSubHostName = str;
                                                }
                                            } else {
                                                this.mAEGraphConfig = str;
                                            }
                                        } else {
                                            this.mVolumeInfoJson = str;
                                        }
                                    } else {
                                        IVideoEventLogger iVideoEventLogger = this.mLogger;
                                        if (iVideoEventLogger != null) {
                                            iVideoEventLogger.setStringOption(128, str);
                                            if ("get existing from EnginePool".equals(str) || "new by EnginePool".equals(str)) {
                                                this.mLogger.addFeature("from_engpool", 1);
                                            }
                                        }
                                    }
                                } else {
                                    this.mSettedKeys.add(Integer.valueOf(i));
                                    this.mCodecType = str;
                                }
                            } else if (!this.mPrivCodecName.contains(str)) {
                                this.mPrivCodecName.add(str);
                            }
                        } else {
                            this.mLogger.setStringOption(113, str);
                        }
                    } else {
                        this.mCheckInfoString = str;
                    }
                } else {
                    this.mClassLoaderState = str;
                }
            } else {
                this.mSubVersions = str;
            }
        } else {
            this.mAEConfigJson = str;
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setStringOption(1158, str);
            }
        }
        TTVideoEngineLog.i(logcatTag(), "set string option key:" + i + " value:" + str);
    }

    @Override
    public void setFloatOption(int i, float f) {
        if (this.mConfigCenterVersion > 0) {
            setFloatOption2(i, f);
            return;
        }
        if (ConfigItemFactory.isCommonPlayerOption(i)) {
            this.mOptionHolder.setFloatOption(i, f);
            if (this.mMediaPlayer != null) {
                this.mMediaPlayer.setFloatOption(i, f);
            }
        }
        if (i != 359) {
            if (i != 535) {
                if (i != 651) {
                    if (i != 722) {
                        if (i != 723) {
                            switch (i) {
                                case 325:
                                    this.mAEPreGain = f;
                                    break;
                                case 326:
                                    this.mAEThreshold = f;
                                    break;
                                case 327:
                                    this.mAERatio = f;
                                    break;
                                case 328:
                                    this.mAEPredelay = f;
                                    break;
                                default:
                                    boolean z = true;
                                    switch (i) {
                                        case 344:
                                            this.mTarLoudness = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(645, f);
                                                break;
                                            }
                                            break;
                                        case 345:
                                            this.mHasSetAESrcLoudness = true;
                                            this.mSrcLoudness = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(644, f);
                                                break;
                                            }
                                            break;
                                        case 346:
                                            this.mHasSetAESrcPeak = true;
                                            this.mSrcPeak = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(646, f);
                                                break;
                                            }
                                            break;
                                        case 347:
                                            if (f <= 0.0f) {
                                                z = false;
                                            }
                                            this.mAEForbidCompressor = z;
                                            break;
                                        case 348:
                                            this.mReleaseTime = f;
                                            break;
                                        case 349:
                                            this.mLookAheadTime = f;
                                            break;
                                        case 350:
                                            this.mLuRange = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(1153, f);
                                                break;
                                            }
                                            break;
                                        case 351:
                                            this.mLuStart = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(1154, f);
                                                break;
                                            }
                                            break;
                                        case 352:
                                            this.mLuEnd = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(1155, f);
                                                break;
                                            }
                                            break;
                                        case 353:
                                            this.mMaxMomLu = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(1156, f);
                                                break;
                                            }
                                            break;
                                        case 354:
                                            this.mMaxShortermLu = f;
                                            if (this.mMediaPlayer != null) {
                                                this.mMediaPlayer.setFloatOption(1157, f);
                                                break;
                                            }
                                            break;
                                        default:
                                            switch (i) {
                                                case 526:
                                                    this.mABRStartupBandwidthParameter = f;
                                                    break;
                                                case 527:
                                                    this.mABRStallPenaltyParameter = f;
                                                    break;
                                                case 528:
                                                    this.mABRSwitchPenaltyParameter = f;
                                                    break;
                                                case 529:
                                                    this.mABRBandwidthParameter = f;
                                                    break;
                                                default:
                                                    super.setFloatOption(i, f);
                                                    break;
                                            }
                                    }
                            }
                        } else {
                            IVideoEventLogger iVideoEventLogger = this.mLogger;
                            if (iVideoEventLogger != null) {
                                iVideoEventLogger.setVrDisplayFrameRate(f);
                            }
                        }
                    } else {
                        IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                        if (iVideoEventLogger2 != null) {
                            iVideoEventLogger2.setVrDisplayDistance(f);
                        }
                    }
                } else {
                    VideoSurface videoSurface = this.mTextureSurface;
                    if (videoSurface != null) {
                        videoSurface.setFloatOption(4, f);
                    }
                }
            } else {
                this.mNetworkSpeedReportSamplingRate = f;
                this.mLogger.setFloatOption(20, f);
            }
        } else {
            this.mSpeedXDropFPSLimit = f;
        }
        TTVideoEngineLog.i(logcatTag(), "set float option key:" + i + ",value:" + f);
    }

    protected void _switchToResolution(Resolution resolution, Map<Integer, String> map) {
        int i;
        int i2;
        String str;
        Map<Integer, String> map2;
        if (this.currentResolution == resolution && (((map2 = this.currentParams) == null && map == null) || (map2 != null && map2.equals(map)))) {
            TTVideoEngineLog.e(logcatTag(), "switch to the same resolution:" + _resolutionToString(resolution) + ", drop");
            return;
        }
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel == null) {
            return;
        }
        if (this.currentResolution != resolution && this.mListenerCompact != null) {
            VideoInfo videoInfo = iVideoModel.getVideoInfo(resolution, iVideoModel.getVideoRefInt(7), map, false);
            IVideoModel iVideoModel2 = this.mVideoModel;
            VideoInfo videoInfo2 = iVideoModel2.getVideoInfo(this.currentResolution, iVideoModel2.getVideoRefInt(7), this.currentParams, false);
            if (videoInfo2 != null && videoInfo != null) {
                if (videoInfo.getValueInt(3) == videoInfo2.getValueInt(3)) {
                    notifyStreamChanged(this.mVideoModel.getVideoRefInt(7));
                }
            }
        }
        this.lastResolution = this.currentResolution;
        this.mLastSwitchResolutionTime = System.currentTimeMillis();
        this.currentResolution = resolution;
        this.currentParams = map;
        TTVideoEngineLog.i(logcatTag(), "will switch to resolution:" + _resolutionToString(this.currentResolution) + ", from resolution:" + _resolutionToString(this.lastResolution));
        if (map != null) {
            for (Map.Entry<Integer, String> entry : map.entrySet()) {
                TTVideoEngineLog.i(logcatTag(), "will switch to params, Key = " + entry.getKey() + ",Value = " + entry.getValue());
            }
        }
        boolean isSupportSeamlessSwitch = isSupportSeamlessSwitch(this.mVideoModel);
        if (isSupportSeamlessSwitch && this.mPlaybackState != 2) {
            int i3 = VideoRef.TYPE_VIDEO;
            if (this.mVideoModel.hasData()) {
                if (map == null) {
                    map = new HashMap<>();
                }
                if (this.mConfigCenterVersion > 0) {
                    str = this.mEngineConfig.getStringOption(1000);
                } else {
                    str = this.mCodecType;
                }
                if (str.equals("bytevc2") && this.mVideoModel.getVideoRefBool(228)) {
                    map.put(8, "bytevc2");
                } else if (str.equals("bytevc1") && this.mVideoModel.getVideoRefBool(l.g)) {
                    map.put(8, "bytevc1");
                } else if (this.mVideoModel.getVideoRefBool(203)) {
                    map.put(8, "h264");
                }
                VideoInfo _videoInfoForResolution = _videoInfoForResolution(this.currentResolution, this.mVideoModel.getVideoRefInt(7), map);
                if (_videoInfoForResolution != null) {
                    i2 = _videoInfoForResolution.getValueInt(3);
                    i = _videoInfoForResolution.getMediatype();
                } else {
                    i = i3;
                    i2 = 0;
                }
                if (this.mVideoEngineInfoListener != null) {
                    ArrayList arrayList = new ArrayList();
                    if (this.mVideoModel.hasFormat(IVideoModel.Format.DASH)) {
                        String dynamicType = this.mVideoModel.getDynamicType();
                        if (!TextUtils.isEmpty(dynamicType) && dynamicType.equals("segment_base")) {
                            VideoInfo _videoInfoForResolution2 = _videoInfoForResolution(this.currentResolution, VideoRef.TYPE_VIDEO, map);
                            VideoInfo _videoInfoForResolution3 = _videoInfoForResolution(this.currentResolution, VideoRef.TYPE_AUDIO, map);
                            if (_videoInfoForResolution2 != null) {
                                arrayList.add(_videoInfoForResolution2);
                            }
                            if (_videoInfoForResolution3 != null) {
                                arrayList.add(_videoInfoForResolution3);
                            }
                        }
                    } else if (_videoInfoForResolution != null) {
                        arrayList.add(_videoInfoForResolution);
                    }
                    if (arrayList.size() > 0) {
                        VideoEngineInfos videoEngineInfos = new VideoEngineInfos();
                        videoEngineInfos.setKey("usingUrlInfos");
                        videoEngineInfos.setUrlInfos(arrayList);
                        notifyEngineInfo(videoEngineInfos, true);
                    }
                }
            } else {
                i = i3;
                i2 = 0;
            }
            if (this.mMediaPlayer != null && isInHousePlayer()) {
                this.mLogger.switchResolution(_resolutionToString(this.currentResolution), _resolutionToString(this.lastResolution), false);
                changeResolutionSwitchingState(true);
                this.mMediaPlayer.switchStream(i2, i);
                return;
            }
        }
        if (!this.mSeamSwitchingResolution) {
            this.mSeamSwitchingResolution = true;
            this.mLogger.switchResolution(_resolutionToString(this.currentResolution), _resolutionToString(this.lastResolution), true);
            changeResolutionSwitchingState(true);
            if (!isSupportSeamlessSwitch && this.mPlayDuration != null) {
                this.mPlayDuration.stop();
            }
            this.mLastPlaybackTime = _getPlayerTime();
        }
        if (this.mMediaPlayer != null) {
            this.mMediaPlayer.pause();
        }
        _parseIPAddress(this.mVideoModel);
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.setIntOption(33, 0);
        }
    }

    void _doSetIntOption2(int i, int i2) {
        int i3 = 0;
        boolean z = false;
        boolean z2 = false;
        boolean z3 = false;
        boolean z4 = false;
        boolean z5 = false;
        int i4 = 0;
        boolean z6 = false;
        boolean z7 = false;
        boolean z8 = false;
        boolean z9 = false;
        switch (i) {
            case 4:
                this.mLayoutType = i2;
                if (this.mTextureSurface != null) {
                    setTextureLayoutMode(i2);
                } else if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(36, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5:
                if ((i2 == 1 || i2 == 2) && !FeatureManager.hasPermission("vr_panorama")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mRenderType = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(56, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 6:
                if (i2 != 0) {
                    _doSetStringOption2(1000, "bytevc1");
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 7:
                this.mHasSetHardWare = true;
                MediaPlayer mediaPlayer = this.mAsyncPlayer;
                if (mediaPlayer == null) {
                    mediaPlayer = this.mMediaPlayer;
                }
                this.mHardwareDecodeEnablePlayer2 = i2;
                this.mSettedKeys.add(Integer.valueOf(i));
                TTVideoEngineLog.i(logcatTag(), "hardware enable = " + this.mHardwareDecodeEnablePlayer2);
                if (mediaPlayer != null) {
                    mediaPlayer.setIntOption(59, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 12:
                if (DataLoaderHelper.getDataLoader().getIntValue(12) != 200) {
                    i3 = i2;
                }
                this.mNetworkTimeout = i3;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(9, 1000000 * i3);
                }
                this.mLogger.setIntOption(25, i3);
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 20:
                this.mDisableAccurateStart = i2;
                this.mLogger.setDisableAccurateStart(i2);
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(133, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 21:
                if (i2 == 1) {
                    this.mUseVideoModelCache = true;
                    this.mVideoModelCache = VideoModelCache.getInstance();
                    VideoModelDBManager.getInstance(this.mContext);
                } else {
                    this.mUseVideoModelCache = false;
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 22:
                VideoModelCache videoModelCache = this.mVideoModelCache;
                if (videoModelCache != null) {
                    videoModelCache.setTimeOutInSec(i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 23:
                VideoModelCache videoModelCache2 = this.mVideoModelCache;
                if (videoModelCache2 != null) {
                    videoModelCache2.setCacheNb(i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case ConstantsAPI.COMMAND_LAUNCH_WX_MINIPROGRAM_WITH_TOKEN:
            case 494:
                if (!FeatureManager.hasPermission("abr")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mEnableABR = i2;
                if (i2 > 0) {
                    if (this.mABRModule == null) {
                        this.mABRModule = _initABRModule(this.mVideoModel);
                    }
                    if (this.mABRModule != null && isSupportSeamlessSwitch(this.mVideoModel)) {
                        this.mABRModule.c(TTVideoEngine.sABRAlgorithmType, this.mEngineConfig.getIntOption(500));
                        this.mLogger.setIsEnableABR(1);
                    }
                } else {
                    i iVar = this.mABRModule;
                    if (iVar != null) {
                        iVar.c();
                        this.mLogger.setIsEnableABR(0);
                    }
                }
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(172, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 31:
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(59, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 199:
                this.mUseTextureRender = i2;
                DisplayMode displayMode = this.mDisplayMode;
                if (displayMode != null) {
                    if (i2 == 0) {
                        z9 = true;
                    }
                    displayMode.setEnable(z9);
                }
                if (i2 == 1) {
                    MediaPlayer mediaPlayer2 = this.mAsyncPlayer;
                    if (mediaPlayer2 == null) {
                        mediaPlayer2 = this.mMediaPlayer;
                    }
                    if (mediaPlayer2 != null && this.mTextureSurface == null && (this.mEngineConfig.getIntOption(4014) <= 0 || this.mHardwareDecodeEnablePlayer2 != 0 || this.mRenderType != 5)) {
                        setupTextureRender();
                        VideoSurface videoSurface = this.mTextureSurface;
                        if (videoSurface != null) {
                            videoSurface.updateTexDimension(getVideoWidth(), getVideoHeight());
                        }
                        if (this.mSurfaceHolder != null) {
                            setSurfaceHook(this.mSurfaceHolder.getSurface());
                        } else if (this.mSurface != null) {
                            setSurfaceHook(this.mSurface);
                        }
                    }
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 201:
                this.mTestNetSpeedDiff = i2;
                if (i2 < 500) {
                    this.mTestNetSpeedDiff = 500;
                    TTVideoEngineLog.e("TTVideoEngine", "setIntOption: netspeed diff is less than 500ms,set it to 500ms");
                }
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(66, this.mTestNetSpeedDiff);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case l.i:
                IVideoEventLogger iVideoEventLogger = this.mLogger;
                if (iVideoEventLogger != null) {
                    iVideoEventLogger.didSentEvent(i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 301:
                if (!FeatureManager.hasPermission("pcdn")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mP2PCDNType = i2;
                DataLoaderHelper.getDataLoader().checkLoaderType(this.mP2PCDNType);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 320:
            case 472:
                this.mOutputLog = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(223, i2);
                }
                DataLoaderHelper.getDataLoader().setIntValue(512, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 322:
                this.mNotifyBufferingDirectly = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(TTVideoEngineInterface.PLAYER_OPTION_SET_SUPER_RES_FXAA, i2);
                }
                this.mLogger.setIntOption(26, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 341:
                this.mPlayerViewWidth = i2;
                i iVar2 = this.mABRModule;
                if (iVar2 != null) {
                    iVar2.a(6, i2);
                }
                IVideoEventLogger iVideoEventLogger2 = this.mLogger;
                if (iVideoEventLogger2 != null) {
                    iVideoEventLogger2.setPlayerViewSize(i2, 0);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 342:
                this.mPlayerViewHeight = i2;
                i iVar3 = this.mABRModule;
                if (iVar3 != null) {
                    iVar3.a(7, i2);
                }
                IVideoEventLogger iVideoEventLogger3 = this.mLogger;
                if (iVideoEventLogger3 != null) {
                    iVideoEventLogger3.setPlayerViewSize(0, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 372:
                if (i2 != 0) {
                    z8 = true;
                }
                this.mCloseRenderStartMsgOnSwitchResolutionDone = z8;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case TTVideoEngineInterface.PLAYER_OPTION_USE_THREAD_POOL:
                TTPlayerConfiger.setValue(24, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 430:
                this.mVoiceType = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(378, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 432:
                if (i2 != 0) {
                    _doSetStringOption2(1000, "bytevc2");
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 442:
                this.mAsyncSetAudioProcessor = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 460:
                this.mHardwareDropNonRef = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(252, i2);
                }
                this.mLogger.setIntOption(32, this.mHardwareDropNonRef);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 470:
                if (i2 == 1) {
                    z7 = true;
                }
                TTVideoEngineConfig.openPerformanceUtils = z7;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 471:
                this.mFallbackApiRetry = i2;
                if (i2 == 1) {
                    AVMDLURLFetcherBridge.setNewFetcherMaker(FetcherMakerNew.getInstance());
                } else {
                    AVMDLURLFetcherBridge.setNewFetcherMaker(null);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 480:
                if (!FeatureManager.hasPermission("audio_only")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mRadioModeEnable = i2;
                this.mLastSwitchRadioModeTime = System.currentTimeMillis();
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(261, i2);
                }
                this.mLogger.setIntOption(45, i2);
                this.mLogger.setIntOption(11, i2);
                if (shouldStartTextureRenderCheck()) {
                    this.mTextureSurface.setIntOption(33, 1);
                } else {
                    VideoSurface videoSurface2 = this.mTextureSurface;
                    if (videoSurface2 != null && i2 == 1) {
                        videoSurface2.setIntOption(33, 0);
                    }
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 504:
                this.mABRSwitchCSModel = i2;
                c.c(i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 505:
                this.mABRStartupModel = i2;
                c.e(i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 506:
                this.mABRFixedLevel = i2;
                c.d(i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case MediaPlayer.MEDIA_PLAYER_OPTION_LICENSE_DIR:
                if (!FeatureManager.hasPermission("subtitle_mask")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mEnableMaskThread = i2;
                IVideoEventLogger iVideoEventLogger4 = this.mLogger;
                if (iVideoEventLogger4 != null) {
                    iVideoEventLogger4.setIntOption(46, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 521:
                this.mStandAlongAbrStartUp = i2;
                if (i2 > 0 && this.mEnableABR == 0) {
                    TTVideoEngine.sABRAlgorithmType = 4;
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 522:
                if (i2 != 0) {
                    z6 = true;
                }
                this.mEnableSpeedReport = z6;
                this.mLogger.setIntOption(18, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 523:
                TTVideoEngine.sReportSpeedInfoMaxWindowSize = i2;
                this.mLogger.setIntOption(19, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 530:
                this.mCurrentSubId = i2;
                if (this.mMediaPlayer != null && this.mLogger != null) {
                    this.mMediaPlayer.setIntOption(619, i2);
                    this.mLogger.addSubtitleSwitchTime();
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 533:
                this.mEnableSub = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(618, i2);
                }
                IVideoEventLogger iVideoEventLogger5 = this.mLogger;
                if (iVideoEventLogger5 != null) {
                    iVideoEventLogger5.setIntOption(49, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 534:
                if (!FeatureManager.hasPermission("subtitle_mask")) {
                    TTVideoEngineLog.e(logcatTag(), "set int option failed key:" + i + " value:" + i2);
                    return;
                }
                this.mEnableSubThread = i2;
                IVideoEventLogger iVideoEventLogger6 = this.mLogger;
                if (iVideoEventLogger6 != null) {
                    iVideoEventLogger6.setIntOption(47, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 574:
                this.mABRStartupSpeedType = i2;
                GracieSelector.setSpeedType(i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 596:
                if (isPlayerSupportSeekMode()) {
                    this.mSeekMode = i2;
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 604:
                if (i2 > 0) {
                    i4 = 1;
                }
                this.mEnableNetLevel = i4;
                IVideoEventLogger iVideoEventLogger7 = this.mLogger;
                if (iVideoEventLogger7 != null) {
                    iVideoEventLogger7.setIntOption(22, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 605:
                IVideoEventLogger iVideoEventLogger8 = this.mLogger;
                if (iVideoEventLogger8 != null) {
                    iVideoEventLogger8.setIntOption(23, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 612:
                if (i2 != 0) {
                    z5 = true;
                }
                this.mIsPreDecodeAutoPause = z5;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case TTVideoEngineInterface.PLAYER_OPTION_IS_DEGRADE_RELEASE:
                IVideoEventLogger iVideoEventLogger9 = this.mLogger;
                if (iVideoEventLogger9 != null) {
                    iVideoEventLogger9.setIntOption(52, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 618:
                IVideoEventLogger iVideoEventLogger10 = this.mLogger;
                if (iVideoEventLogger10 != null) {
                    iVideoEventLogger10.setIntOption(126, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 621:
                this.mLogger.setIntOption(177, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 654:
                this.mSyncUpdateSurface = i2;
                VideoSurface videoSurface3 = this.mTextureSurface;
                if (videoSurface3 != null) {
                    videoSurface3.setIntOption(9, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 673:
                if (i2 == 1) {
                    z4 = true;
                }
                this.mEnableOutletDropLimit = z4;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(149, i2);
                }
                this.mLogger.setIntOption(97, this.mEnableOutletDropLimit ? 1 : 0);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case TTVideoEngineInterface.PLAYER_OPTION_OPERA_EVENT_REPORT_LEVEL:
                this.mLogger.setIntOption(100, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 708:
                this.mEnableTextureRenderNoRenderCheck = i2;
                VideoSurface videoSurface4 = this.mTextureSurface;
                if (videoSurface4 != null) {
                    videoSurface4.setIntOption(34, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 710:
                this.mEnableTmpLog = i2;
                this.mLogger.setIntOption(112, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 724:
                IVideoEventLogger iVideoEventLogger11 = this.mLogger;
                if (iVideoEventLogger11 != null) {
                    iVideoEventLogger11.setVrScreenRefreshRate(i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 740:
                TTVideoEngineConfig.setSurfaceTimeoutForCreated = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 741:
                TTVideoEngineConfig.setSurfaceTimeoutForDestroy = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 743:
                if (i2 == 1) {
                    z3 = true;
                }
                this.mFetchWithAbilityOption = z3;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1072:
                TTVideoEngineConfig.setEGLBitDepth = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1074:
                this.mLogger.setDuration(i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1133:
                if (i2 > 0) {
                    z2 = true;
                }
                this.mEnableSetupMediaCodec = z2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1135:
                this.mSetSurfaceDirectly = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1206:
                IVideoEventLogger iVideoEventLogger12 = this.mLogger;
                if (iVideoEventLogger12 != null) {
                    iVideoEventLogger12.setIntOption(129, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1207:
                IVideoEventLogger iVideoEventLogger13 = this.mLogger;
                if (iVideoEventLogger13 != null) {
                    iVideoEventLogger13.setIntOption(130, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1208:
                IVideoEventLogger iVideoEventLogger14 = this.mLogger;
                if (iVideoEventLogger14 != null) {
                    iVideoEventLogger14.setIntOption(131, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1225:
                if (i2 == 1) {
                    z = true;
                }
                this.mBashRetryRestartPlayer = z;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1413:
                this.mABREnableAggressivePortraitLowBit = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1502:
                this.mOutputLog = i2;
                if (this.mMediaPlayer != null) {
                    this.mMediaPlayer.setIntOption(223, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1503:
                this.mEnableTextureRenderNativeWindow = i2;
                VideoSurface videoSurface5 = this.mTextureSurface;
                if (videoSurface5 != null) {
                    videoSurface5.setIntOption(150, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 1600:
                this.mEnableFrameCallbackInRenderThread = i2;
                VideoSurface videoSurface6 = this.mTextureSurface;
                if (videoSurface6 != null) {
                    videoSurface6.setIntOption(149, i2);
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4006:
                if (this.mMediaPlayer != null) {
                    if (i2 == 0) {
                        this.mMediaPlayer.setIntOption(4006, this.mEngineConfig.getIntOption(4008));
                    } else {
                        this.mMediaPlayer.setIntOption(4006, this.mEngineConfig.getIntOption(4007));
                    }
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4011:
                this.mDecoderRenderVC2PreCreateRender = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4012:
                TTPlayerConfiger.setValue(34, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4013:
                TTPlayerConfiger.setValue(35, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4015:
                TTPlayerConfiger.setValue(36, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4019:
                this.mVC2DynamicControl = i2;
                if (((i2 & 8) == 8 && this.mHardwareDecodeEnablePlayer2 <= 0) || (this.mVC2DynamicControl & 8) != 8) {
                    if ((this.mVC2DynamicControl & 2) == 2) {
                        this.mEngineConfig.setIntOption(685, 1);
                    }
                    if ((this.mVC2DynamicControl & 4) == 4) {
                        TTPlayerConfiger.setValue(34, 1);
                    }
                }
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4020:
                TTPlayerConfiger.setValue(39, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4021:
                TTPlayerConfiger.setValue(40, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4025:
                this.mEnableSurfaceHashmapJudgement = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4100:
                TTPlayerConfiger.setValue(41, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4101:
                TTPlayerConfiger.setValue(42, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 4200:
                this.mDisableThreadPoolUsing = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5001:
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                    this.mMediaPlayer.setIntOption(5001, i2);
                }
                this.mExoRenderReadyMs = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5002:
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                    this.mMediaPlayer.setIntOption(5002, i2);
                }
                this.mExoConsecutiveFailNum = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5003:
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                    this.mMediaPlayer.setIntOption(5003, i2);
                }
                this.mExoCodecReusable = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5004:
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                    this.mMediaPlayer.setIntOption(5004, i2);
                }
                this.mExoCodecAsyncInitEnable = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            case 5005:
                if (this.mMediaPlayer != null && this.mMediaPlayer.getPlayerType() == 5) {
                    this.mMediaPlayer.setIntOption(5005, i2);
                }
                this.mExoAllowMediaCodecHelper = i2;
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
            default:
                super.setIntOption(i, i2);
                i3 = i2;
                TTVideoEngineLog.i(logcatTag(), "set int op key:" + i + " value:" + i3);
                return;
        }
    }

    @Override
    public void setDirectUrlUseDataLoader(String str, String str2, String str3) {
        if (TextUtils.isEmpty(str)) {
            return;
        }
        setDirectUrlUseDataLoader(new String[]{str}, str2, str3);
    }

    private void _setSurfaceSync(final Surface surface, long j, boolean z) {
        if (surface == null) {
            this.mLastSetSurfaceNullTime = System.currentTimeMillis();
        }
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            if (!this.mLooperThread.sendEngineMessage(54, j, 0, 0, surface) && surface != null) {
                this.mSetValidSurfaceTimeout = 1;
                return;
            }
            return;
        }
        if (z) {
            EngineThreadPool.addExecuteTaskSync(new Runnable() {
                @Override
                public final void run() {
                    TTVideoEngineImpl.this.lambda$_setSurfaceSync$4$TTVideoEngineImpl(surface);
                }
            }, j);
        } else {
            lambda$_setSurfaceSync$4$TTVideoEngineImpl(surface);
        }
    }

    void _doSetPlayerSurfaceTimeOut(Surface surface, int i, int i2) {
        MediaPlayer mediaPlayer = this.mAsyncPlayer;
        if (mediaPlayer == null) {
            mediaPlayer = this.mMediaPlayer;
        }
        if (mediaPlayer != null) {
            if (surface == null) {
                ((MediaPlayerWrapper) mediaPlayer).setSurfaceTimeOut(null, i2);
                return;
            }
            if (i == 1) {
                ((MediaPlayerWrapper) mediaPlayer).setSurfaceTimeOut(surface, i2);
                this.mLogger.setPlayerSurface(surface.toString());
                return;
            }
            MediaPlayerWrapper mediaPlayerWrapper = (MediaPlayerWrapper) mediaPlayer;
            Surface surface2 = this.mTextureSurface;
            if (surface2 == null) {
                surface2 = surface;
            }
            mediaPlayerWrapper.setSurfaceTimeOut(surface2, i2);
            IVideoEventLogger iVideoEventLogger = this.mLogger;
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null) {
                surface = videoSurface;
            }
            iVideoEventLogger.setPlayerSurface(surface.toString());
        }
    }

    @Override
    protected void notifyBufferStart(int i, int i2, int i3) {
        if (this.mLooperThread.checkSendMainLooper()) {
            HashMap hashMap = new HashMap();
            hashMap.put("bufferStartAction", Integer.valueOf(i3));
            hashMap.put("traceid", this.mTraceId);
            this.mLooperThread.postMainLooperMessage(415, i, i2, hashMap);
            return;
        }
        this.mListenerCompact.onBufferStart(i, i2, i3);
    }

    @Override
    protected void onMediaPlayerSARChanged(MediaPlayer mediaPlayer, int i, int i2) {
        TTVideoEngineLog.i(logcatTag(), "onSARChanged = " + i + ", " + i2);
        notifySARChanged(i, i2);
    }

    @Override
    public void setDataSource(FileDescriptor fileDescriptor, long j, long j2) {
        this.mPipeOffset = j;
        this.mPipeLength = j2;
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(12, 0, 0, fileDescriptor);
        } else {
            _doSetDataSource(fileDescriptor);
        }
    }

    @Override
    public void setPlayerSurface(Surface surface, int i, int i2) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            if (i2 == 1) {
                this.mLooperThread.sendEngineMessage(56, getConfigInt(950, (int) this.mSendEngineMsgTimeout), i, 0, surface);
                return;
            } else {
                this.mLooperThread.postEngineMessage(56, i, 0, surface);
                return;
            }
        }
        _doSetPlayerSurface(surface, i);
    }

    private VideoInfo _videoInfoForResolution(Resolution resolution, int i, Map<Integer, String> map) {
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null && iVideoModel.hasData()) {
            VideoInfo videoInfo = this.mVideoModel.getVideoInfo(resolution, i, map, true);
            if (videoInfo != null) {
                int videoRefInt = this.mVideoModel.getVideoRefInt(7);
                if (videoRefInt == VideoRef.TYPE_AUDIO && videoInfo.getMediatype() == VideoRef.TYPE_AUDIO) {
                    this.currentResolution = videoInfo.getResolution();
                    this.mCurrentQualityDesc = videoInfo.getValueStr(32);
                } else if (videoRefInt == VideoRef.TYPE_VIDEO && videoInfo.getMediatype() == VideoRef.TYPE_VIDEO) {
                    this.currentResolution = videoInfo.getResolution();
                    this.mCurrentQualityDesc = videoInfo.getValueStr(32);
                }
                this.mLogger.setCurrentQualityDesc(this.mCurrentQualityDesc);
                this.mLogger.configResolution(_resolutionToString(this.currentResolution), "");
            }
            return videoInfo;
        }
        return null;
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("_playInternal")
    public static void com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop__playInternal(TTVideoEngineImpl tTVideoEngineImpl, String str, Map map) {
        LogWrapper.info("AudioCore-TTVideoEngineAops", "_playInternal ,url = " + str, new Object[0]);
        if (!TextUtils.isEmpty(str) && str.startsWith("mdl://") && qn.a().e) {
            tTVideoEngineImpl.setIntOption(12, qn.a().f);
        }
        LogWrapper.info("AudioCore-TTVideoEngineAops", "_playInternal ,network_timeout = " + Integer.valueOf(tTVideoEngineImpl.mNetworkTimeout), new Object[0]);
        tTVideoEngineImpl.TTVideoEngineImpl___playInternal$___twin___(str, map);
    }

    @Override
    protected boolean onMediaPlayerError(MediaPlayer mediaPlayer, int i, int i2) {
        if (this.mPlayDuration != null) {
            this.mPlayDuration.stop();
        }
        updatePlaybackState(3);
        updateLoadState(3, -1);
        if (this.mState == 0) {
            TTVideoEngineLog.i(logcatTag(), "invalid state,return directly");
            return true;
        }
        String stringOption = mediaPlayer.getStringOption(5002);
        String domainForPlayer = Error.getDomainForPlayer(mediaPlayer);
        if (domainForPlayer.equals("kTTVideoErrorDomainVideoOwnPlayer") && this.mRetryingNotHandleError) {
            TTVideoEngineLog.i(logcatTag(), "retrying, not handle error: " + i + ", i1:" + i2);
            return true;
        }
        this.mError = new Error(domainForPlayer, i, i2, stringOption);
        receivedError(this.mError);
        return true;
    }

    @Override
    public void setDirectUrlUseDataLoader(String[] strArr, String str, String str2) {
        if (this.mLooperThread.checkEngineLooperThread(false)) {
            this.mLooperThread.postEngineMessage(20, 0, 0, strArr, str, str2);
        } else {
            _doSetDirectUrlUseDataLoader(strArr, str, str2, 0L, null);
        }
    }

    @Override
    public void setDirectUrlUseDataLoaderByFilePath(String[] strArr, String str, String str2) {
        if (strArr != null && strArr.length != 0 && !TextUtils.isEmpty(strArr[0])) {
            this.mInitialUrlBeforeMdlProxy = strArr[0];
            if (TextUtils.isEmpty(str2)) {
                setDirectUrlUseDataLoader(strArr, str);
                return;
            }
            _resetUsingDataLoaderField();
            String _mdlUrl = _mdlUrl(str, this.mVideoID, getConfigInt(161, this.mLimitMDLCacheSize), strArr, Resolution.Undefine, this.mDecryptionKey, null, str2, null, 0L, null);
            if (!this.mFileHashs.contains(str)) {
                this.mFileHashs.add(str);
            }
            if (TextUtils.isEmpty(_mdlUrl)) {
                setDirectURL(strArr[0]);
                return;
            } else {
                setDirectURL(_mdlUrl);
                return;
            }
        }
        TTVideoEngineLog.e(logcatTag(), "invalid urls list, it is empty");
    }

    @Override
    protected void onMediaPlayerVideoSizeChanged(MediaPlayer mediaPlayer, int i, int i2) {
        int i3;
        TTVideoEngineLog.i(logcatTag(), "video size changed = " + i + ", " + i2);
        VideoSurface videoSurface = this.mTextureSurface;
        if (videoSurface != null) {
            videoSurface.updateTexDimension(i, i2);
            if (this.mPlayBackUsedSR && !this.mSRIgnoreRes && !this.mTextureSurface.supportProcessResolution(i, i2)) {
                TTVideoEngineLog.i(logcatTag(), "VideoSurface resolution not support for sr");
                doOpenSR(0, -7891);
            }
        }
        int intOption = mediaPlayer.getIntOption(912, -1);
        TTVideoEngineLog.d(logcatTag(), "colorTrc " + intOption);
        if (intOption == 16) {
            i3 = 1;
        } else if (intOption == 18) {
            i3 = 2;
        } else {
            i3 = 0;
        }
        _setHDRInfoToTexturerender(mediaPlayer, i3);
        this.mLogger.setIntOption(90, i3);
        setDisplayVideoSize(i, i2);
        notifyVideoSizeChanged(i, i2);
        if (!this.mSeamSwitchingResolution && this.mFirstGetWidthHeight) {
            TTVideoEngineLog.d(logcatTag(), "changed video size set");
            this.mFirstGetWidthHeight = false;
            this.mLogger.setStartPlayWidth(i);
            this.mLogger.setStartPlayHeight(i2);
        }
    }

    private String _generatePlayUrl(String str, Map<String, String> map, List<VideoInfo> list) {
        boolean z;
        String str2;
        boolean z2;
        boolean z3;
        String str3;
        String str4;
        String videoRefStr;
        String videoRefStr2;
        int i;
        if (this.mConfigCenterVersion > 0) {
            if (this.mEngineConfig.getIntOption(33) == 1) {
                z = true;
            } else {
                z = false;
            }
        } else {
            z = this.mBashEnabled;
        }
        if (z && !TextUtils.isEmpty(str) && !str.startsWith("mem://bash") && !str.startsWith("mem://hls")) {
            if (this.mEnableTmpLog == 1) {
                showLongLog("brian is support bash:" + isSupportBash(this.mVideoModel));
            }
            if (isSupportBash(this.mVideoModel)) {
                if (list != null) {
                    videoRefStr2 = VideoRef.VideoListToBashString(list);
                } else {
                    videoRefStr2 = this.mVideoModel.getVideoRefStr(8);
                }
                Object[] objArr = new Object[4];
                objArr[0] = this.urlIndexMap.get(this.currentResolution);
                objArr[1] = Integer.valueOf(getConfigInt(313, this.mCheckHijack ? 1 : 0));
                if (this.mVideoModel.hasFormat(IVideoModel.Format.DASH)) {
                    i = 1;
                } else {
                    i = 2;
                }
                objArr[2] = Integer.valueOf(i);
                objArr[3] = videoRefStr2.replaceAll("\\\\/", "/");
                str2 = String.format("mem://bash/url_index:%d/check_hijack:%d/segment_format:%d/%s", objArr);
                z2 = true;
                if (this.mConfigCenterVersion > 0) {
                    if (this.mEngineConfig.getIntOption(671) == 1) {
                        z3 = true;
                    } else {
                        z3 = false;
                    }
                } else {
                    z3 = this.mHLSSeamlessSwitch;
                }
                if (z3 && !TextUtils.isEmpty(str2) && !str2.startsWith("mem://bash") && !str2.startsWith("mem://hls") && isSupportHLSSeamlessSwitch(this.mVideoModel)) {
                    if (list == null) {
                        videoRefStr = VideoRef.VideoListToBashString(list);
                    } else {
                        videoRefStr = this.mVideoModel.getVideoRefStr(8);
                    }
                    str2 = String.format("mem://hls/url_index:%d/%s", this.urlIndexMap.get(this.currentResolution), videoRefStr.replaceAll("\\\\/", "/"));
                }
                if (z2 && !TextUtils.isEmpty(str2) && map != null && map.containsKey("Host")) {
                    str3 = map.get("Host").toString();
                    str4 = null;
                    try {
                        str4 = new URI(str).getHost();
                    } catch (URISyntaxException e) {
                        TTVideoEngineLog.d(e);
                    }
                    if (!TextUtils.isEmpty(str3) && !TextUtils.isEmpty(str4)) {
                        str2 = str2.replaceAll(str3.trim(), str4);
                    }
                }
                if (getConfigInt(302, this.mForbidP2P) == 1) {
                    if (map == null) {
                        map = new HashMap<>();
                    }
                    map.remove("X-Tt-CDN");
                    map.put("X-Tt-CDN", "0");
                }
                this.mLogger.setEnableBash(str2.startsWith("mem://bash") ? 1 : 0);
                return str2;
            }
            if (getConfigInt(493, this.mDirectUrlBashEnabled ? 1 : 0) == 1 && isSupportBash(str)) {
                str2 = String.format("mem://bash/url_index:0/segment_format:%d/{\"dynamic_video\":{\"dynamic_video_list\":[{\"main_url\":\"%s\"}]}}", 2, str);
                z2 = false;
                if (this.mConfigCenterVersion > 0) {
                }
                if (z3) {
                    if (list == null) {
                    }
                    str2 = String.format("mem://hls/url_index:%d/%s", this.urlIndexMap.get(this.currentResolution), videoRefStr.replaceAll("\\\\/", "/"));
                }
                if (z2) {
                    str3 = map.get("Host").toString();
                    str4 = null;
                    str4 = new URI(str).getHost();
                    if (!TextUtils.isEmpty(str3)) {
                        str2 = str2.replaceAll(str3.trim(), str4);
                    }
                }
                if (getConfigInt(302, this.mForbidP2P) == 1) {
                }
                this.mLogger.setEnableBash(str2.startsWith("mem://bash") ? 1 : 0);
                return str2;
            }
        }
        str2 = str;
        z2 = true;
        if (this.mConfigCenterVersion > 0) {
        }
        if (z3) {
        }
        if (z2) {
        }
        if (getConfigInt(302, this.mForbidP2P) == 1) {
        }
        this.mLogger.setEnableBash(str2.startsWith("mem://bash") ? 1 : 0);
        return str2;
    }

    public void TTVideoEngineImpl__initEngine$___twin___(Context context, int i, Map map) {
        Looper looper;
        boolean z;
        boolean z2;
        super.initEngine(context, i);
        boolean z3 = true;
        this.mFirstURL = true;
        this.mFirstIP = true;
        this.mFirstHost = true;
        this.mUseFallbackAPI = true;
        this.currentResolution = Resolution.Standard;
        this.expectedResolution = Resolution.Auto;
        this.urlIndexMap = new HashMap();
        this.dashVideoUrlMap = new HashMap();
        this.dashAudioUrlMap = new HashMap();
        _resetUrlIndexMap();
        this.urlIPMap = new HashMap();
        this.mHeaders = new ConcurrentHashMap();
        this.mTextureFirstFrame = false;
        this.mPlayerFirstFrame = false;
        this.mSendEngineMsgTimeout = 500L;
        this.mConfigCenterVersion = TTVideoEngine.sUseConfigCenter;
        if (this.mConfigCenterVersion > 0) {
            if (TTVideoEngine.sConfigCenterCheckDiff > 0) {
                z = true;
            } else {
                z = false;
            }
            this.mEngineConfig = new EngineConfig(z, new ConcurrentHashMap());
            if (this.mConfigCenterVersion > 1) {
                z2 = true;
            } else {
                z2 = false;
            }
            this.mPlayerConfigExecutor = new PlayerConfigExecutor(z2);
            TTVideoEngineLog.i(logcatTag(), "ConfigCenter is used, cc Version:" + this.mConfigCenterVersion);
        } else {
            this.mEngineConfig = IEngineConfig.EMPTY;
            this.mPlayerConfigExecutor = PlayerConfigExecutor.EMPTY;
        }
        this.mDataLoaderEnable = EngineGlobalConfig.getInstance().isOnlyUseMediaLoader() ? 1 : 0;
        this.mEngineConfig.setIntOption(160, EngineGlobalConfig.getInstance().isOnlyUseMediaLoader() ? 1 : 0);
        TTVideoEngineLog.d(logcatTag(), "DataLoaderEnable is: " + getConfigInt(160, this.mDataLoaderEnable));
        if (i == 3) {
            TTVideoEngine.setForceUseLitePlayer(true);
        }
        this.mListenerCompact = new ListenerCompact();
        this.mHeadsetMonitor = HeadsetStateMonitor.getInstance(context);
        this.mLogger = new VideoEventLoggerV2(context, new MyLoggerDataSource(this), this.mHeadsetMonitor);
        TTVideoEngineMonitor tTVideoEngineMonitor = TTVideoEngineMonitor.getInstance(context);
        this.mEngineStateMonitor = tTVideoEngineMonitor;
        if (tTVideoEngineMonitor != null) {
            tTVideoEngineMonitor.startObserve(hashCode(), this.mEngineWrapper);
        }
        this.mLogger.setUploadLogEnabled(true);
        this.mLogger.configResolution(_resolutionToString(this.currentResolution), "");
        this.mLogger.setIntOption(132, hashCode());
        if (!EngineGlobalConfig.getInstance().isOnlyUseMediaLoader()) {
            createDefaultCacheFileDirectory();
        }
        this.mPlayDuration = new PlayDurationManager(this.mHeadsetMonitor);
        if (!TimeService.isUpdated()) {
            TimeService.updateTimeFromNTP(this.mContext);
        }
        EngineThreadPool.addExecuteTask(new VideoInfoCollector.myVideoCollectorRegister(this.mEngineWrapper, this.mSerial));
        this.mLooperThread = new TTVideoEngineLooperThread2(this);
        if (SettingsHelper.helper().getVodInt("engine_enable_looper", 0) == 0) {
            z3 = false;
        }
        this.mEnableLooperThread = z3;
        HandlerThread handlerThread = null;
        if (map != null && map.containsKey("callback_looper")) {
            looper = (Looper) map.get("callback_looper");
        } else {
            looper = null;
        }
        if (map != null && map.containsKey("enable_looper")) {
            this.mEnableLooperThread = ((Boolean) map.get("enable_looper")).booleanValue();
        }
        if (this.mEnableLooperThread) {
            if (map != null && map.containsKey("handler_thread")) {
                handlerThread = (HandlerThread) map.get("handler_thread");
            }
            if (map != null && map.containsKey("handler_thread_not_allow_destroy")) {
                this.mLooperThread.setIntValue(0, ((Integer) map.get("handler_thread_not_allow_destroy")).intValue());
            }
            this.mLooperThread.start(handlerThread, looper);
        }
        VideoEventManager.instance.setContext(context);
        initMDLFetcher(context);
        this.mEngineHash = String.valueOf(hashCode());
        this.mCodecStrategyAdapter = new CodecStrategyAdapter(this);
        this.mOptionHolder = new OptionHolder();
        EngineInstanceHolder.getInstance().add(this.mEngineWrapper);
        TTVideoEngineLog.i(logcatTag(), "initEngine, engine hash:" + this.mEngineHash);
    }

    @Override
    public void refreshEnginePara(Context context, int i, Map map) {
        int i2;
        boolean z;
        boolean z2;
        boolean z3;
        Looper looper;
        TTVideoEngineLog.i(logcatTag(), "refreshEnginePara, type:" + i + ", Engine:" + this.mEngineWrapper + ", version:1.10.158.101-novel");
        TTVideoEngineMonitor tTVideoEngineMonitor = this.mEngineStateMonitor;
        if (tTVideoEngineMonitor != null) {
            tTVideoEngineMonitor.startObserve(hashCode(), this.mEngineWrapper);
        }
        this.mContext = context;
        this.mPlayerType = i;
        boolean z4 = true;
        if (i != 2 && i != 5) {
            i2 = 1;
        } else {
            i2 = 0;
        }
        TTPlayerConfiger.setValue(1, i2);
        if (i == 1) {
            z = true;
        } else {
            z = false;
        }
        TTPlayerConfiger.setValue(2, z);
        if (i == 5) {
            z2 = true;
        } else {
            z2 = false;
        }
        TTPlayerConfiger.setValue(26, z2);
        if (!TimeService.isUpdated()) {
            TimeService.updateTimeFromNTP(this.mContext);
        }
        TTVideoEngineLooperThread2 tTVideoEngineLooperThread2 = this.mLooperThread;
        if (tTVideoEngineLooperThread2 != null && tTVideoEngineLooperThread2.isStarted()) {
            z3 = true;
        } else {
            z3 = false;
        }
        if (SettingsHelper.helper().getVodInt("engine_enable_looper", 0) == 0) {
            z4 = false;
        }
        this.mEnableLooperThread = z4;
        if (map != null && map.containsKey("enable_looper")) {
            this.mEnableLooperThread = ((Boolean) map.get("enable_looper")).booleanValue();
        }
        if (!this.mEnableLooperThread) {
            if (z3) {
                TTVideoEngineLog.i(logcatTag(), " Async->Sync ---TTVideoEnginePool");
                this.mLooperThread.closeEngineLooperThread();
            } else {
                TTVideoEngineLog.i(logcatTag(), " Sync->Sync ---TTVideoEnginePool");
            }
        } else {
            HandlerThread handlerThread = null;
            if (map != null && map.containsKey("callback_looper")) {
                looper = (Looper) map.get("callback_looper");
            } else {
                looper = null;
            }
            if (map != null && map.containsKey("handler_thread")) {
                handlerThread = (HandlerThread) map.get("handler_thread");
            }
            if (map != null && map.containsKey("handler_thread_not_allow_destroy")) {
                this.mLooperThread.setIntValue(0, ((Integer) map.get("handler_thread_not_allow_destroy")).intValue());
            }
            if (z3) {
                TTVideoEngineLog.i(logcatTag(), " Async->Async ---TTVideoEnginePool");
                this.mLooperThread.refreshAsyncPara(handlerThread, looper);
            } else {
                TTVideoEngineLog.i(logcatTag(), " Sync->Async ---TTVideoEnginePool");
                this.mLooperThread.start(handlerThread, looper);
            }
        }
        this.mDataLoaderEnable = EngineGlobalConfig.getInstance().isOnlyUseMediaLoader() ? 1 : 0;
        this.mPlayDuration = new PlayDurationManager(this.mHeadsetMonitor);
        super.refreshEnginePara(context, i, map);
    }

    @Override
    protected boolean onMediaPlayerInfo(MediaPlayer mediaPlayer, int i, int i2) {
        if (i != 3) {
            if (i != 4) {
                if (i != 701) {
                    if (i != 702) {
                        switch (i) {
                            case -268435438:
                                _updateCurrentPlaybackPosition(i2, true);
                                _updateCurrentInfoToMDL(i2);
                                break;
                            case -268435392:
                                IVideoEventLogger iVideoEventLogger = this.mLogger;
                                if (iVideoEventLogger != null) {
                                    iVideoEventLogger.setMaskErrorCode(i2);
                                    break;
                                }
                                break;
                            case -268435390:
                                notifyReadyForDisplay();
                                break;
                            case -268435388:
                                _secondFrame();
                                break;
                            case 801:
                                _seekComplete(false);
                                break;
                            case 251658244:
                                _streamChanged(i2);
                                break;
                            case 251658252:
                                _audioRenderStart();
                                break;
                            default:
                                switch (i) {
                                    case -268435436:
                                        notifyInfoIdChanged(i2);
                                        break;
                                    case -268435435:
                                        updatePlaybackState(2);
                                        break;
                                    case -268435434:
                                        _onABRGetPredictResult(i2);
                                        break;
                                    default:
                                        switch (i) {
                                            case -268435408:
                                                _preBuffering(i2);
                                                break;
                                            case -268435407:
                                                TTVideoEngineLog.i(logcatTag(), "av outsync start:" + i2);
                                                this.mLogger.AVOutSyncStart(i2);
                                                break;
                                            case -268435406:
                                                TTVideoEngineLog.i(logcatTag(), "av outsync end:" + i2);
                                                this.mLogger.AVOutSyncEnd(i2);
                                                break;
                                            case -268435405:
                                                _formaterStart();
                                                break;
                                            case -268435404:
                                                _decoderStart(i2);
                                                break;
                                            case -268435403:
                                                this.mLogger.AVNoRenderStart(i2, 0);
                                                break;
                                            case -268435402:
                                                this.mLogger.AVNoRenderEnd(i2);
                                                break;
                                            case -268435401:
                                                TTVideoEngineLog.i(logcatTag(), "starttime is bigger than video duration:" + i2);
                                                this.mShouldUseAudioRenderStart = true;
                                                break;
                                            default:
                                                switch (i) {
                                                    case -268435386:
                                                        _firstAVSyncFrame();
                                                        break;
                                                    case -268435385:
                                                        _refreshSurface();
                                                        break;
                                                    case -268435384:
                                                        _abnormalOccured(i2);
                                                        break;
                                                    case -268435383:
                                                        TTVideoEngineLog.d("TTVideoEngine", "MEDIA_INFO_RENDER_EXCEPTION:" + i2);
                                                        if (this.mTextureSurface == null && getConfigInt(1504, this.mEnableNotifyRenderException) > 0) {
                                                            Error error = new Error("kTTVideoErrorDomainVideoOwnPlayer", -8000, i2);
                                                            if (this.mLooperThread.checkSendMainLooper()) {
                                                                this.mLooperThread.postMainLooperMessage(409, 0, 0, error);
                                                                break;
                                                            } else {
                                                                this.mListenerCompact.onError(error);
                                                                break;
                                                            }
                                                        }
                                                        break;
                                                    default:
                                                        switch (i) {
                                                            case 251658248:
                                                                _renderSeekComplete(i2);
                                                                break;
                                                            case 251658249:
                                                                _videoBitrateChanged(i2);
                                                                break;
                                                        }
                                                }
                                        }
                                }
                        }
                    } else {
                        _bufferEnd(i2);
                    }
                } else {
                    _bufferStart(i2);
                }
            } else if (this.mPlaybackState != 0) {
                _logFirstFrame();
            }
        } else {
            TTVideoEngineLog.i(logcatTag(), "player callback render start");
            _videoRenderStartNotify();
            if (getConfigInt(TTVideoEngineInterface.PLAYER_OPTION_OPEN_TEXTUER_AFTER_FIRST_FRAME, this.mFirstFrameOpenTexture) == 1) {
                this.mPlayerFirstFrame = true;
                _renderStart();
                if (this.mTextureSurface != null && this.mSurface != null && this.mSurfaceHolder == null) {
                    long elapsedRealtime = SystemClock.elapsedRealtime();
                    mediaPlayer.setSurface(this.mTextureSurface);
                    this.mTextureSurface.updateRenderSurface(this.mSurface);
                    TTVideoEngineLog.i(logcatTag(), "renderstart change to texturesurface,time:" + (SystemClock.elapsedRealtime() - elapsedRealtime));
                }
            } else if (this.mTextureSurface != null && (getConfigInt(587, this.mEnableForceDisableOESRender ? 1 : 0) != 1 || getConfigInt(588, this.mForceDisableOESRender ? 1 : 0) != 1)) {
                this.mPlayerFirstFrame = true;
                if (this.mTextureFirstFrame) {
                    TTVideoEngineLog.i(logcatTag(), "render start by player after texture");
                    _renderStart();
                }
            } else {
                TTVideoEngineLog.i(logcatTag(), "render start by player");
                _renderStart();
            }
            if (!isInHousePlayer()) {
                _streamChanged(0);
            }
            VideoSurface videoSurface = this.mTextureSurface;
            if (videoSurface != null && mediaPlayer != null) {
                videoSurface.setIntOption(133, mediaPlayer.getIntOption(139, -1));
            }
        }
        return false;
    }

    public TTVideoEngineImpl(Context context, int i, TTVideoEngine tTVideoEngine) {
        this.mEngineWrapper = tTVideoEngine;
        if (EngineGlobalConfig.getInstance().getLazyLoadVideodec() != 1) {
            TTVideoEngineLog.d(logcatTag(), "JniUtils.loadLibrary in TTVideoEngineImpl new");
            JniUtils.loadLibrary();
        }
        TTVideoEngineLog.i(logcatTag(), "init, type:" + i + ", this:" + this + ", version:1.10.158.101-novel");
        initEngine(context, i, null);
    }

    public static int lambda$snapshot$d0aa4498$1(SnapshotListener snapshotListener, ByteBuffer byteBuffer, int i, int i2) {
        if (byteBuffer == null) {
            snapshotListener.onSnapShot(null, 0, 0);
        } else {
            Bitmap createBitmap = Bitmap.createBitmap(i, i2, Bitmap.Config.ARGB_8888);
            createBitmap.copyPixelsFromBuffer(byteBuffer);
            snapshotListener.onSnapShot(createBitmap, i, i2);
        }
        return 0;
    }

    private static HashMap<String, Object> generateCrosstalkMap(String str, String str2, int i, String str3) {
        HashMap<String, Object> hashMap = new HashMap<>();
        if (!TextUtils.isEmpty(str)) {
            hashMap.put("tag", str);
        }
        if (!TextUtils.isEmpty(str2)) {
            hashMap.put("subtag", str2);
        }
        hashMap.put("islive", Integer.valueOf(i));
        if (!TextUtils.isEmpty(str3)) {
            hashMap.put("enginehash", str3);
        }
        return hashMap;
    }

    @Override
    public void setSRInitConfig(int i, String str, String str2, String str3) {
        this.mOldTextureAlgType = this.mTextureAlgType;
        this.mTextureAlgType = i;
        this.mTextureSRBinPath = str;
        this.mTextureSROclModuleName = str2;
        this.mTextureSRDspModuleName = str3;
        this.mLogger.setSrAlgorithm(i);
        this.mLogger.setEnableBmfSr(EngineGlobalConfig.getInstance().getEnableBmf());
        TTVideoEngineLog.i(logcatTag(), "[SRLog]sr init config = " + this.mTextureAlgType + "," + this.mTextureSRBinPath + "," + this.mTextureSROclModuleName + ", " + this.mTextureSRDspModuleName);
    }

    @TargetClass("com.ss.ttvideoengine.TTVideoEngineImpl")
    @Insert("initEngine")
    public static void com_ss_ttvideoengine_TTVideoEngineImpl_com_dragon_read_aop_TTVideoEngineAop_initEngine(TTVideoEngineImpl tTVideoEngineImpl, Context context, int i, Map map) {
        if (QualityOptExperiment.INSTANCE.getConfig().engineLooperEnable) {
            LogWrapper.info("AudioCore-TTVideoEngineAops", "VideoEngineLooper enable by setting", new Object[0]);
            map = z.a(map);
        }
        tTVideoEngineImpl.TTVideoEngineImpl__initEngine$___twin___(context, i, map);
        TTVideoEngineImpl tTVideoEngineImpl2 = tTVideoEngineImpl;
        tTVideoEngineImpl2.setIntOption(160, 1);
        tTVideoEngineImpl2.setCacheControlEnabled(true);
        if (jm.a().f45296b) {
            tTVideoEngineImpl2.setIntOption(604, jm.a().f45297c);
            tTVideoEngineImpl2.setIntOption(605, jm.a().d);
            tTVideoEngineImpl2.setStringOption(715, jm.a().f);
        }
        if (ab.a().f46712c) {
            tTVideoEngineImpl2.setIntOption(987, ab.a().d);
            tTVideoEngineImpl2.setIntOption(565, ab.a().e);
        }
        if (jm.a().f45296b) {
            tTVideoEngineImpl2.setIntOption(857, jm.a().e);
        }
        if (qx.a().f45600b) {
            tTVideoEngineImpl2.setIntOption(955, 1);
            tTVideoEngineImpl2.setIntOption(42087, qx.a().f45601c ? 1 : 0);
        }
        if (ly.a().f45398b) {
            tTVideoEngineImpl2.setIntOption(313, 1);
            tTVideoEngineImpl2.setIntOption(427, ly.a().f45399c ? 1 : 0);
        }
        try {
            LogWrapper.info("AudioCore-TTVideoEngineAops", "initEngine ,type = " + i, new Object[0]);
        } catch (Throwable th) {
            LogWrapper.error("AudioCore-TTVideoEngineAops", "initEngine ,exception = " + th.getMessage(), new Object[0]);
        }
    }

    void _doSetDirectUrlUseDataLoader(String[] strArr, String str, String str2, long j, String[] strArr2) {
        String str3;
        if (strArr != null && strArr.length != 0) {
            boolean z = false;
            if (!TextUtils.isEmpty(strArr[0])) {
                this.mInitialUrlBeforeMdlProxy = strArr[0];
                if (TextUtils.isEmpty(str)) {
                    _doSetDirectURL(strArr[0], strArr);
                    this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.EmptyKey.ordinal());
                } else if (getConfigInt(160, this.mDataLoaderEnable) == 0) {
                    _doSetDirectURL(strArr[0], strArr);
                    this.mLogger.setIntOption(174, IVideoEventLogger.MdlInvalidCode.OptionNotSet.ordinal());
                } else {
                    _resetUsingDataLoaderField();
                    TTVideoEngineLog.i(logcatTag(), "setDirectUrlUseDataLoader key = " + str + ", videoId = " + str2);
                    String _mdlUrl = _mdlUrl(str, str2, (long) getConfigInt(161, this.mLimitMDLCacheSize), strArr, Resolution.Undefine, this.mDecryptionKey, null, null, null, j, strArr2);
                    if (!this.mFileHashs.contains(str)) {
                        this.mFileHashs.add(str);
                    }
                    if (TextUtils.isEmpty(_mdlUrl)) {
                        _doSetDirectURL(strArr[0], strArr);
                        str3 = str2;
                    } else {
                        str3 = str2;
                        this.mVideoID = str3;
                        if (getConfigInt(606, this.mEnableDirectUrlCheck) == 1) {
                            int length = strArr.length;
                            int i = 0;
                            while (true) {
                                if (i >= length) {
                                    break;
                                }
                                if (URLUtil.isValidUrl(strArr[i])) {
                                    z = true;
                                    break;
                                }
                                i++;
                            }
                            if (!z) {
                                TTVideoEngineLog.e(logcatTag(), "invalid urls list, all url invalid");
                                receivedError(new Error("kTTVideoErrorDomainVideoOwnPlayer", -9966, "Direct url is invalid url."));
                                return;
                            }
                        }
                        _doSetDirectURL(_mdlUrl, strArr);
                        StrategyHelper.buildMediaInfo(this.mMediaInfoMap, str3, str, strArr);
                    }
                    IVideoEventLogger iVideoEventLogger = this.mLogger;
                    if (iVideoEventLogger != null) {
                        iVideoEventLogger.setProxyUrl(_mdlUrl);
                    }
                    this.mVideoID = str3;
                    return;
                }
                str3 = str2;
                this.mVideoID = str3;
                return;
            }
        }
        TTVideoEngineLog.e(logcatTag(), "invalid urls list, it is empty");
    }

    public class IpInfo {
        public String dns;
        public String ip;
        public int isDNSCacheOpen;
        public int isServerDNSOpen;
        public String urlDesc;

        public IpInfo(String str, String str2, int i, int i2, String str3) {
            this.ip = str;
            this.dns = str2;
            this.isDNSCacheOpen = i;
            this.isServerDNSOpen = i2;
            this.urlDesc = str3;
        }
    }

    @Override
    public void setSRInitConfig(int i, String str, String str2, String str3, int i2, int i3, int i4) {
        this.mOldTextureAlgType = this.mTextureAlgType;
        this.mTextureAlgType = i;
        this.mTextureSRBinPath = str;
        this.mTextureSROclModuleName = str2;
        this.mTextureSRDspModuleName = str3;
        this.mSrBackend = i2;
        this.mSrScaleType = i3;
        this.mSrPoolSize = i4;
        IVideoEventLogger iVideoEventLogger = this.mLogger;
        if (iVideoEventLogger != null) {
            iVideoEventLogger.setSrAlgorithm(i);
            this.mLogger.setSrScaleType(i3);
            this.mLogger.setEnableBmfSr(EngineGlobalConfig.getInstance().getEnableBmf());
        }
        TTVideoEngineLog.i(logcatTag(), "[SRLog]sr init config = " + this.mTextureAlgType + "," + this.mTextureSRBinPath + "," + this.mTextureSROclModuleName + ", " + this.mTextureSRDspModuleName);
    }

    private String _mdlUrl(String str, String str2, long j, String[] strArr, Resolution resolution, String str3, VideoInfo videoInfo, String str4, String str5, long j2, String[] strArr2) {
        boolean z;
        boolean z2;
        IVideoModel iVideoModel = this.mVideoModel;
        if (iVideoModel != null && iVideoModel.hasFormat(IVideoModel.Format.HLS)) {
            z = true;
        } else {
            z = false;
        }
        if (this.mPlayerType != 0 && (getConfigInt(5010, this.mExoEnableNativeMdl ? 1 : 0) == 0 || this.mPlayerType != 5)) {
            TTVideoEngineLog.i(logcatTag(), "force disable native mal because play type: " + this.mPlayerType);
            z2 = true;
        } else {
            z2 = false;
        }
        TTVideoEngineLog.d(logcatTag(), "cdn type is: " + this.mP2PCDNType);
        String _proxyUrl = DataLoaderHelper.getDataLoader()._proxyUrl(str, str2, j, strArr, resolution, str3, videoInfo, str4, str5, z2, z, this.mTTHlsDrmToken, j2, strArr2);
        int mdlInvalidCode = DataLoaderHelper.getDataLoader().getMdlInvalidCode();
        if (mdlInvalidCode > 0) {
            this.mLogger.setIntOption(174, mdlInvalidCode);
            if (mdlInvalidCode == IVideoEventLogger.MdlInvalidCode.StateError.ordinal()) {
                loggerSetMdlInitializeState();
            }
        }
        if (!TextUtils.isEmpty(_proxyUrl)) {
            String logcatTag = logcatTag();
            StringBuilder sb = new StringBuilder();
            sb.append("_mdlUrl get proxyUrl: key = ");
            sb.append(str);
            sb.append(", videoId = ");
            String str6 = str2;
            sb.append(str6);
            TTVideoEngineLog.i(logcatTag, sb.toString());
            if (this.mEnableTmpLog == 1) {
                showLongLog(_proxyUrl);
            }
            if (_proxyUrl.startsWith("mdl://")) {
                this.mLogger.setEnableMDL(2);
                if (this.mFirstURL) {
                    this.mLogger.setIntOption(173, 2);
                }
            } else {
                this.mLogger.setEnableMDL(1);
                if (this.mFirstURL) {
                    this.mLogger.setIntOption(173, 1);
                }
            }
            this.mLogger.setProxyUrl(_proxyUrl);
            if (TextUtils.isEmpty(str2)) {
                str6 = str;
            }
            this.mUsingDataLoaderPlayRawKey = str6;
            if (!TextUtils.isEmpty(str4)) {
                this.mUsingDataLoaderPlayFilePaths.add(str4);
            }
            if (!TextUtils.isEmpty(str)) {
                this.mUsingDataLoaderPlayTaskKeys.add(str);
            }
            _dataLoaderAddEngineRef();
        }
        return _proxyUrl;
    }
}