搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e
以下内容为反编译后的 VideoLiveManager.java 源代码,内容仅作参考
package com.bykv.vk.component.ttvideo;
import android.content.Context;
import android.net.Uri;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Looper;
import android.os.SystemClock;
import android.text.TextUtils;
import android.view.Surface;
import android.view.SurfaceHolder;
import com.bykv.vk.component.ttvideo.INetworkClient;
import com.bykv.vk.component.ttvideo.b.a;
import com.bykv.vk.component.ttvideo.d.a;
import com.bykv.vk.component.ttvideo.log.LiveError;
import com.bykv.vk.component.ttvideo.log.MyLog;
import com.bykv.vk.component.ttvideo.model.LiveURL;
import com.bykv.vk.component.ttvideo.player.Keep;
import com.bykv.vk.component.ttvideo.player.n;
import com.bykv.vk.component.ttvideo.player.r;
import com.facebook.imagepipeline.producers.s0;
import com.flyersoft.WB.DownloadTaskBrowser;
import com.flyersoft.seekbooks.ActivityTxt;
import com.flyersoft.source.conf.IntentAction;
import com.ksdk.ssds.s.ce;
import com.lygame.aaa.bf0;
import com.lygame.aaa.c62;
import com.lygame.aaa.e50;
import com.lygame.aaa.h1;
import com.lygame.aaa.hh;
import com.lygame.aaa.pk2;
import com.lygame.aaa.rv;
import com.lygame.aaa.x1;
import com.lygame.aaa.y91;
import com.lygame.aaa.yg0;
import com.qq.e.ads.nativ.express2.MediaEventListener;
import com.qq.e.ads.nativ.express2.NativeExpressAD2CallbackExt;
import com.qq.e.comm.constants.ErrorCode;
import com.tencent.cos.common.COSHttpResponseKey;
import com.zk.deviceidentifier.impl.DeviceConstant;
import io.reactivex.annotations.SchedulerSupport;
import java.lang.ref.WeakReference;
import java.lang.reflect.Method;
import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import kotlinx.coroutines.v0;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@Keep
public final class VideoLiveManager implements ILivePlayer {
private static final int AUDIOSTREAM = 1;
private static final int AV_NO_SYNC_THRESHOLD = 10000;
private static final int BITRATE_ABNORNAL = 1;
private static final int BITRATE_NORMAL = 0;
private static final int BOTHSTREAM = 2;
private static final int CHECK_SEI_INTERVAL = 3000;
private static final int DEFAULT_RTC_FALLBACK_THRESHOLD = 5000;
private static final int DEFAULT_RTC_MIN_JITTER_BUFFER = 300;
private static final String HTTP_FLV_ABR_PREFIX = "mem://llash/";
private static final int INIT_MTU = 1200;
public static final int KeyIsGetSeiDelay = 100;
public static final int KeyIsGetStreamMaxBitrate = 0;
private static final int LIVE_ABR_CHECK_DEFAULT_INTERVAL = 1000;
private static final int MEDIA_PLAYER_OPTION_SET_LIVE_PROTOCOL_HANDLE = 501;
private static final int MSG_SEI_CHECK = 110;
private static final int NOTIFY_ALL_SEI_THRESHOLD = 1000;
private static final String RTC_LOG_PREFIX = "rtc_log_level";
private static final int RTC_VENDER_TYPE_ALIBABA = 1;
private static final int RTC_VENDER_TYPE_BYTE = 0;
private static final int RTC_VENDER_TYPE_OTHERS = 3;
private static final int RTC_VENDER_TYPE_TECENT = 2;
private static final String SEI_PREFIX = "JSON";
private static final int STALL_RECOVER_FROM_BUFFERINGEND = 1;
private static final int STALL_RECOVER_FROM_RETRY = 2;
private static final int STALl_NO_RECOVER = 0;
private static final String TAG = "VideoLiveManager";
public static final int TEX_LIVE = 1;
public static final int TEX_VOD = 0;
private static final int VIDEOSTREAM = 0;
private static int mAudioRenderStallThreshold = 200;
private static int mDecoderStallThreshold = 600;
private static int mDemuxerStallThreshold = 900;
private static int mFastOpenDuration = -1;
private static boolean mIsSettingsUpdate = false;
private static JSONObject mSettingsInfo = null;
private static int mVideoRenderStallThreshold = 500;
private int mABRBufferThreshold;
private int mABRDisableAlgorithm;
private int mABRMethod;
private long mALogWriteAddr;
private int mAVNoSyncThreshold;
private int mAVPHAudioMaxDuration;
private int mAVPHAudioProbesize;
private int mAVPHAutoExit;
private int mAVPHDnsParseEnable;
private int mAVPHDnsTimeout;
private int mAVPHEnableAutoReopen;
private int mAVPHMaxAVDiff;
private int mAVPHOpenVideoFirst;
private int mAVPHReadErrorExit;
private int mAVPHReadRetryCount;
private int mAVPHVideoDiffThreshold;
private int mAVPHVideoMaxDuration;
private int mAVPHVideoProbesize;
private String mAbrStrategy;
private long mAudioLastRenderTime;
private String mAudioOnly;
private int mAudioTimescaleEnable;
private float mAudioVolumeBalancePredelay;
private float mAudioVolumeBalancePregain;
private float mAudioVolumeBalanceRatio;
private float mAudioVolumeBalanceThreshold;
private int mBufferDataSeconds;
private int mBufferTimeout;
private int mByteVC1DecoderType;
private int mCacheFileEnable;
private String mCacheFileKey;
private String mCacheFilePath;
private boolean mCancelSDKDNSFailRetry;
private float mCatchSpeed;
private String mCdnAbrResolution;
private String mCdnSessionPath;
private int mCheckBufferingEndAdvanceEnable;
private int mCheckBufferingEndIgnoreVideo;
public boolean mCheckSupportSR;
private boolean mCmafEnable;
private final Context mContext;
private String mCurrentIP;
private String mCurrentPlayURL;
private int mCurrentRetryCount;
private int mDefaultCodecId;
private int mDefaultResBitrate;
private final com.bykv.vk.component.ttvideo.b.a mDnsParser;
private int mEnableAbrStallDegradeImmediately;
private int mEnableAudioVolumeBalance;
private String mEnableAvLines;
private int mEnableByteVC1HardwareDecode;
private int mEnableCacheSei;
private int mEnableCheckDropAudio;
private int mEnableCheckFrame;
private int mEnableCheckPacketCorrupt;
private int mEnableCheckSEI;
private int mEnableClosePlayRetry;
private int mEnableCmafFastMode;
private int mEnableCmafOptimizeRetry;
private int mEnableDTSCheck;
private int mEnableDecodeMultiSei;
private int mEnableDecodeSeiOnce;
private int mEnableDecoderStall;
private int mEnableDemuxerStall;
private boolean mEnableDns;
private boolean mEnableDnsOptimizer;
private int mEnableDroppingDTSRollFrame;
private int mEnableFastOpenStream;
private int mEnableFlvABR;
private int mEnableFreeFlow;
private int mEnableH264HardwareDecode;
private int mEnableHttpPrepare;
private int mEnableHttpkDegrade;
private int mEnableHurryFlag;
private int mEnableLLASHFastOpen;
private int mEnableLiveAbrCheckEnhance;
private int mEnableLiveIOP2P;
private int mEnableLiveIOPlay;
private int mEnableLowLatencyFLV;
private int mEnableMediaCodecASYNCInit;
private int mEnableNTP;
private int mEnableNTPTask;
private int mEnableNotifySeiImmediatelyBeforeFirstFrame;
private int mEnableOpenLiveIO;
private int mEnableOpenMDL;
private int mEnableOptimizeBackup;
private boolean mEnableOriginResolution;
private int mEnableP2pUp;
private int mEnablePreventDTSBack;
private boolean mEnableQuicCertVerify;
private int mEnableQuicDegrade;
private int mEnableQuicMTUDiscovery;
public int mEnableRadioLiveDisableRender;
private int mEnableRenderStall;
private int mEnableReportSessionStop;
private boolean mEnableResolutionAutoDegrade;
private int mEnableRtcPlay;
private boolean mEnableSaveSCFG;
private boolean mEnableSeiCheck;
private int mEnableSharp;
public int mEnableSharpen;
private int mEnableSkipFindUnnecessaryStream;
private int mEnableSkipFlvNullTag;
private int mEnableSplitStream;
private int mEnableStallCounter;
private int mEnableStallRetryInstantly;
private boolean mEnableSwitchMainAndBackupUrl;
private int mEnableTcpFastOpen;
private int mEnableTextureRender;
private int mEnableTextureSR;
private int mEnableUploadSei;
private boolean mEnableUploadSessionSeries;
private int mEnableUseLiveThreadPool;
private int mEnableVideoMpdRefresh;
private int mEnhancementType;
private boolean mEnterStallRetryInstantly;
private ExecutorService mExecutor;
private com.bykv.vk.component.ttvideo.b.c mFetcher;
private int mForceDecodeMsGaps;
private int mForceDecodeSwitch;
private boolean mForceHttpDns;
private int mForceRenderMsGaps;
private long mFrameDroppingDTSMaxDiff;
private Object mFrameMetaDataListener;
private long mFrameTerminatedDTS;
private int mFramesDrop;
private long mGetSeiCurrentTime;
private int mGopDuration;
private int mHardwareDecodeEnable;
private int mHardwareRTCDecodeEnable;
private boolean mHasAbrInfo;
private boolean mHasRetry;
private boolean mHasSeiInfo;
private int mHlsLiveStartIndex;
private String mHttpDNSServerHost;
private int mHurryTime;
private int mHurryType;
private com.bykv.vk.component.ttvideo.d mInvocationHandler;
private int mIsAlwaysDoAVSync;
private boolean mIsCacheHasComplete;
private int mIsInMainLooper;
private boolean mIsLiveIOProtoRegister;
private boolean mIsLocalURL;
private boolean mIsMdlProtoRegister;
private boolean mIsPlayWithLiveIO;
private boolean mIsPlayWithMdl;
private boolean mIsRequestCanceled;
private boolean mIsRetrying;
private boolean mIsStalling;
private long mLatestAudioPacketDTS;
private int mLayoutType;
private String mLevel;
private final ILiveListener mListener;
private int mLiveABRCheckInterval;
private int mLiveIOABGroupID;
private a mLivePlayerState;
private String mLocalURL;
private com.bykv.vk.component.ttvideo.log.a mLogService;
private boolean mLooping;
private JSONObject mLowLatencyFLVStrategy;
private int mMaxCacheSeconds;
private int mMaxFileCacheSize;
private int mMaxTextureHeight;
private int mMaxTextureWidth;
public boolean mMediaSupportSR;
private boolean mMediaSupportSharpen;
private String mMoudleIDToB;
private final Handler mMyHandler;
private final INetworkClient mNetworkClient;
private int mNetworkTimeout;
private int mNoSyncReportMinDuration;
private int mNoSyncReportReportThres;
private List<String> mNodeOptimizeResults;
private int mOpenCheckSideData;
private n mPlayer;
private int mPlayerCache;
private int mPlayerDegradeMode;
private final com.bykv.vk.component.ttvideo.c.b mPlayerSetting;
private final int mPlayerType;
private l mPrepareState;
private int mQuicConfigOptimize;
private boolean mQuicEnable;
private int mQuicFixProcessTimer;
private int mQuicFixStreamFinAndRst;
private int mQuicFixWillingAndAbleToWrite;
private int mQuicInitMTU;
private int mQuicInitRtt;
private int mQuicMaxAckDelay;
private int mQuicMaxCryptoRetransmissionTimeMs;
private int mQuicMaxCryptoRetransmissions;
private int mQuicMaxRetransmissionTimeMs;
private int mQuicMaxRetransmissions;
private int mQuicMinReceivedBeforeAckDecimation;
private int mQuicPadHello;
private boolean mQuicPull;
private int mQuicReadBlockMode;
private int mQuicReadBlockTimeout;
private int mQuicTimerVersion;
private int mQuicVersion;
private boolean mRedoDns;
private String mReliable;
public boolean mRenderStartEntered;
public long mRenderStartNotifyTimeStamp;
private int mRenderType;
private String mResolution;
private boolean mResolutionDisableSR;
private int mResolutionIndex;
private final com.bykv.vk.component.ttvideo.d.a mRetryProcessor;
private long mRetryStartTime;
private int mRtcEarlyInitRender;
private int mRtcEnableDtls;
private int mRtcEnableRtcUninitLockFree;
private int mRtcEnableSDKDns;
private int mRtcFallbackThreshold;
private int mRtcMaxJitterBuffer;
private int mRtcMaxRetryCount;
private int mRtcMinJitterBuffer;
private int mRtcPlayFallBack;
private int mRtcPlayLogInterval;
private int mRtcSupportMiniSdp;
private int mScaleType;
private long mSeiDiffThres;
private String mSessionId;
private int mSessionNum;
private int mSessionReceiveWindow;
private long mSessionRenderStartTime;
private long mSessionStartTime;
private final ILiveSettingBundle mSettingsBundle;
private float mSharpenAmount;
private float mSharpenEdgeWeightGamma;
private int mSharpenMaxHeight;
private int mSharpenMaxWidth;
private int mSharpenMode;
private float mSharpenOverRatio;
private int mSharpenPowerLevel;
private int mSharpenSceneMode;
private JSONObject mSharpenSdkParams;
private boolean mShowedFirstFrame;
private float mSlowPlaySpeed;
private int mSlowPlayTime;
private int mStallCount;
private int mStallCountThresOfResolutionDegrade;
private Handler mStallCounterHandler;
private int mStallCounterInterval;
private volatile boolean mStallCounterIsRunning;
private final Object mStallCounterLock;
private HandlerThread mStallCounterThread;
public long mStallRetryTimeIntervalManager;
private long mStallStartTime;
private long mStallTotalTime;
private int mStartDirectAfterPrepared;
private long mStartPlayBufferThres;
private String mStreamFormat;
private int mStreamReceiveWindow;
private String mSuggestProtocol;
private boolean mSupportBackupIp;
public int mSupportSRScene;
private int mSupportSharpenScene;
private Surface mSurface;
private SurfaceHolder mSurfaceHolder;
private int mSwitchToB;
private long mTargetOriginBitRate;
private int mTestAction;
private String mTextureRenderErrorMsg;
private boolean mTextureRenderFirstFrame;
private String mTextureSRBinPath;
private String mTextureSRDspModuleName;
public int mTextureSRMode;
private String mTextureSROclModuleName;
private String mTransportProtocol;
private int mTslMinTimeShit;
private int mTslTimeShift;
private int mURLAbility;
private String mURLHost;
private String mURLProtocol;
private final com.bykv.vk.component.ttvideo.model.a mURLSource;
private int mUrlSettingMethod;
private int mUseExternalDir;
private boolean mUsePlayerRenderStart;
private boolean mUserSwitchResoultion;
private String mUuid;
private long mVideoLastRenderTime;
private String mVideoOnly;
private final m mVideoStallCountTask;
@Keep
public static final class Builder {
final Context mContext;
boolean mEnableResolutionAutoDegrade;
boolean mEnableSwitchMainAndBackupUrl;
boolean mForceHttpDns;
boolean mForceTTNetHttpDns;
ILiveListener mListener;
public ExecutorService mLiveThreadPool;
INetworkClient mNetworkClient;
int mPlayerType;
String mProjectKey;
public long mRTCUploadLogInterval;
String mResolution;
int mRetryTimeout;
public long mSeiCheckTimeOut;
ILiveSettingBundle mSettingsBundle;
public long mStallRetryTimeInterval;
public long mUploadLogInterval;
String mVideoFormat;
private Builder(Context context) {
this.mForceHttpDns = false;
this.mForceTTNetHttpDns = false;
this.mRetryTimeout = yg0.c;
this.mPlayerType = 1;
this.mResolution = s0.a.P;
this.mVideoFormat = "flv";
this.mEnableResolutionAutoDegrade = false;
this.mEnableSwitchMainAndBackupUrl = true;
this.mStallRetryTimeInterval = 10000L;
this.mUploadLogInterval = 60000L;
this.mRTCUploadLogInterval = 5000L;
this.mSeiCheckTimeOut = 8000L;
this.mLiveThreadPool = null;
this.mContext = context;
}
public VideoLiveManager build() {
if (this.mContext == null) {
throw new IllegalArgumentException("mContext should not be null");
}
if (this.mListener == null) {
throw new IllegalArgumentException("mListener should not be null");
}
if (this.mNetworkClient != null) {
return new VideoLiveManager(this);
}
throw new IllegalArgumentException("mNetworkClient should not be null");
}
public Builder setCustomThreadPool(ExecutorService executorService) {
MyLog.i(VideoLiveManager.TAG, "setCustomThreadPool: " + executorService);
this.mLiveThreadPool = executorService;
return this;
}
public Builder setEnableResolutionAutoDegrade(boolean z) {
this.mEnableResolutionAutoDegrade = z;
return this;
}
public Builder setEnableSwitchMainAndBackUpURL(boolean z) {
this.mEnableSwitchMainAndBackupUrl = z;
return this;
}
public Builder setForceHttpDns(boolean z) {
this.mForceHttpDns = z;
return this;
}
public Builder setForceTTNetHttpDns(boolean z) {
this.mForceTTNetHttpDns = z;
return this;
}
public Builder setListener(ILiveListener iLiveListener) {
this.mListener = iLiveListener;
return this;
}
public Builder setNetworkClient(INetworkClient iNetworkClient) {
this.mNetworkClient = iNetworkClient;
return this;
}
public Builder setPlayerType(int i) {
this.mPlayerType = i;
return this;
}
public Builder setProjectKey(String str) {
this.mProjectKey = str;
return this;
}
public Builder setResolution(String str) {
this.mResolution = str;
return this;
}
public Builder setRetryTimeout(int i) {
this.mRetryTimeout = i;
return this;
}
public Builder setSeiCheckTimeOut(long j) {
this.mSeiCheckTimeOut = j;
return this;
}
public Builder setSettingsBundle(ILiveSettingBundle iLiveSettingBundle) {
this.mSettingsBundle = iLiveSettingBundle;
return this;
}
public Builder setStallRetryInterval(long j) {
this.mStallRetryTimeInterval = j;
return this;
}
public Builder setVideoFormat(String str) {
this.mVideoFormat = str;
return this;
}
}
public enum a {
IDLE,
PLAYED,
PAUSED,
STOPPED
}
public static final class b implements n.b {
private final WeakReference<VideoLiveManager> a;
public b(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public void onCompletion(n nVar) {
MyLog.d(VideoLiveManager.TAG, "player complete");
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
MyLog.i(VideoLiveManager.TAG, "onCompletion");
videoLiveManager.mListener.onCompletion();
videoLiveManager.mLogService.e(LiveError.STREAM_DRYUP);
videoLiveManager.mSupportBackupIp = false;
if (videoLiveManager.mIsLocalURL) {
return;
}
if (videoLiveManager.mEnableSwitchMainAndBackupUrl && videoLiveManager.mURLSource.j() == 2 && videoLiveManager.switchMainAndBackupUrl(LiveError.STREAM_DRYUP)) {
return;
}
if (videoLiveManager.mURLSource.j() == 1 && videoLiveManager.bytevc1DegradeH264(LiveError.STREAM_DRYUP)) {
return;
}
if (videoLiveManager.mCacheFileEnable != 1) {
videoLiveManager.mRetryProcessor.a(new LiveError(LiveError.STREAM_DRYUP, "live stream dry up, push stream may occur error", new HashMap()), videoLiveManager.mShowedFirstFrame);
return;
}
videoLiveManager.mListener.onCacheFileCompletion();
videoLiveManager.mIsCacheHasComplete = true;
if (!videoLiveManager.mLooping || TextUtils.isEmpty(videoLiveManager.mCacheFilePath)) {
return;
}
videoLiveManager.setLocalURL(videoLiveManager.mCacheFilePath);
videoLiveManager.setLooping(true);
videoLiveManager.parsePlayDNS(videoLiveManager.mCacheFilePath);
}
}
public static final class c implements n.c {
private final WeakReference<VideoLiveManager> a;
public c(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public boolean onError(n nVar, int i, int i2) {
MyLog.e(VideoLiveManager.TAG, "onError " + i);
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager != null && videoLiveManager.mPlayer != null) {
if (i != 0) {
videoLiveManager.mLogService.e(i);
}
videoLiveManager.mListener.onError(new LiveError(i, "player on error", null));
if (videoLiveManager.mIsLocalURL) {
return true;
}
if (videoLiveManager.mEnableQuicDegrade == 1 && videoLiveManager.QuicDegrade(i)) {
return true;
}
if (videoLiveManager.mEnableHttpkDegrade == 1 && videoLiveManager.HttpKDegradeHttp(i)) {
return true;
}
if (!(videoLiveManager.mEnableRtcPlay == 1 && videoLiveManager.mRtcPlayFallBack == 0) && videoLiveManager.mEnableSwitchMainAndBackupUrl && videoLiveManager.mURLSource.j() == 2 && videoLiveManager.switchMainAndBackupUrl(i)) {
return true;
}
if (videoLiveManager.mURLSource.j() == 1 && videoLiveManager.bytevc1DegradeH264(i)) {
return true;
}
HashMap hashMap = new HashMap();
hashMap.put("internalCode", Integer.valueOf(i));
hashMap.put("internalExtra", Integer.valueOf(i2));
hashMap.put("playerType", Integer.valueOf(nVar.b()));
videoLiveManager.mRetryProcessor.a(new LiveError(-100003, "player on error", hashMap), videoLiveManager.mShowedFirstFrame);
}
return false;
}
}
public static final class d implements n.e {
private final WeakReference<VideoLiveManager> a;
public d(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public boolean onInfo(n nVar, int i, int i2) {
com.bykv.vk.component.ttvideo.log.a aVar;
String str;
String b;
String str2;
com.bykv.vk.component.ttvideo.log.a aVar2;
long j;
int i3;
boolean z;
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return false;
}
if (i == -268435437) {
videoLiveManager.mLogService.b(i2, false);
return false;
}
if (i != 3) {
if (i == 251658247) {
String str3 = "speed changed:" + i2;
videoLiveManager.mLogService.k++;
StringBuilder sb = new StringBuilder();
com.bykv.vk.component.ttvideo.log.a aVar3 = videoLiveManager.mLogService;
sb.append(aVar3.l);
sb.append(bf0.COMMA);
sb.append(i2 / 1000.0d);
sb.append(":");
sb.append(System.currentTimeMillis());
aVar3.l = sb.toString();
} else if (i == 701) {
VideoLiveManager.access$4408(videoLiveManager);
videoLiveManager.getLastRenderTime();
videoLiveManager.mIsStalling = true;
videoLiveManager.mListener.onStallStart();
if (videoLiveManager.mShowedFirstFrame) {
videoLiveManager.mLogService.a(i2, true);
if (videoLiveManager.mIsPlayWithMdl) {
com.bykv.vk.component.ttvideo.a.c.a().a(7213, videoLiveManager.mLogService.t, i2);
}
} else {
videoLiveManager.mStallStartTime = System.currentTimeMillis();
videoLiveManager.mLogService.a(i2, false);
}
if ((!videoLiveManager.mEnableResolutionAutoDegrade || videoLiveManager.mURLSource.j() != 2 || (!videoLiveManager.mAbrStrategy.equals("rad") || videoLiveManager.mStallCount < videoLiveManager.mStallCountThresOfResolutionDegrade ? !videoLiveManager.mAbrStrategy.equals("abr_bb_4live") || !videoLiveManager.mResolution.equals(v0.c) || videoLiveManager.mEnableAbrStallDegradeImmediately != 1 || !videoLiveManager.abrDegradeResolution() : !videoLiveManager.degradeResolution())) && !videoLiveManager.mIsLocalURL) {
if (videoLiveManager.mEnableStallRetryInstantly == 1 && videoLiveManager.mPlayer.a(530, -1L) == 0 && videoLiveManager.mPlayer.a(531, -1L) == 0) {
videoLiveManager.mEnterStallRetryInstantly = true;
}
videoLiveManager.mRetryProcessor.a(true, videoLiveManager.mEnterStallRetryInstantly);
}
} else if (i != 702) {
switch (i) {
case -268435442:
videoLiveManager.mLogService.a(i2, VideoLiveManager.mDemuxerStallThreshold, true);
return false;
case -268435441:
videoLiveManager.mLogService.a(i2, VideoLiveManager.mDemuxerStallThreshold, false);
return false;
case -268435440:
videoLiveManager.mLogService.b(i2, VideoLiveManager.mDecoderStallThreshold, true);
return false;
case -268435439:
videoLiveManager.mLogService.b(i2, VideoLiveManager.mDecoderStallThreshold, false);
return false;
default:
switch (i) {
case -268435424:
videoLiveManager.mLogService.a(i2, true);
return false;
case -268435423:
videoLiveManager.mLogService.a(i2, false);
return false;
default:
switch (i) {
case -268435407:
String str4 = "av out sync start; time:" + System.currentTimeMillis() + " pts:" + i2;
videoLiveManager.mLogService.bv = System.currentTimeMillis();
videoLiveManager.mLogService.bw = i2;
break;
case -268435406:
String str5 = "av out sync end; time:" + System.currentTimeMillis() + " pts:" + i2;
long currentTimeMillis = System.currentTimeMillis();
long j2 = i2 - videoLiveManager.mLogService.bw;
long j3 = currentTimeMillis - videoLiveManager.mLogService.bv;
if (j2 > videoLiveManager.mNoSyncReportMinDuration) {
videoLiveManager.mLogService.bx++;
videoLiveManager.mLogService.by++;
videoLiveManager.mLogService.bz += j3;
videoLiveManager.mLogService.bA += j3;
videoLiveManager.mLogService.bB += j2;
videoLiveManager.mLogService.bC += j2;
try {
str2 = new JSONObject().put("start_time", videoLiveManager.mLogService.bv).put("end_time", currentTimeMillis).put("start_pts", videoLiveManager.mLogService.bw).put("end_pts", i2).put("info", videoLiveManager.mPlayer.b(825)).toString();
} catch (JSONException e) {
e.printStackTrace();
str2 = null;
}
if (videoLiveManager.mLogService.bG.length() + str2.length() < videoLiveManager.mLogService.bE) {
videoLiveManager.mLogService.bG = videoLiveManager.mLogService.bG + str2;
}
if (videoLiveManager.mLogService.bF.length() + str2.length() < videoLiveManager.mLogService.bD) {
videoLiveManager.mLogService.bF = videoLiveManager.mLogService.bF + str2;
break;
}
}
break;
default:
switch (i) {
case 251658249:
String str6 = "now bitrate:" + i2;
int i4 = i2 / 1000;
if (videoLiveManager.mEnableResolutionAutoDegrade && videoLiveManager.mAbrStrategy.equals("abr_bb_4live") && videoLiveManager.mURLSource.j() == 2) {
long j4 = i4;
String a = videoLiveManager.mURLSource.a(j4, videoLiveManager.mLevel);
if (TextUtils.isEmpty(a) && videoLiveManager.mLogService.aW == 1 && j4 == videoLiveManager.mTargetOriginBitRate / 1000) {
a = s0.a.P;
}
String a2 = videoLiveManager.mURLSource.a();
if (a2 != null && !a2.equals(a)) {
if (a != null) {
videoLiveManager.mLogService.at = "abr_" + videoLiveManager.mURLSource.a() + "_to_" + a;
videoLiveManager.mURLSource.c(a);
videoLiveManager.mLogService.aj = a;
} else {
videoLiveManager.mLogService.at = SchedulerSupport.NONE;
}
videoLiveManager.mLogService.an++;
StringBuilder sb2 = new StringBuilder();
com.bykv.vk.component.ttvideo.log.a aVar4 = videoLiveManager.mLogService;
sb2.append(aVar4.ao);
sb2.append(bf0.COMMA);
sb2.append(i4);
sb2.append(":");
sb2.append(System.currentTimeMillis());
aVar4.ao = sb2.toString();
videoLiveManager.mLogService.ap = (videoLiveManager.mPlayer.a(63, 0L) * 8) / 1000;
videoLiveManager.mLogService.aq = videoLiveManager.mPlayer.a(73, 0L);
videoLiveManager.mLogService.ar = videoLiveManager.mPlayer.a(72, 0L);
videoLiveManager.mLogService.as = videoLiveManager.mPlayer.a(930, -1L);
videoLiveManager.mListener.onAbrSwitch(a);
String str7 = "abr switch, bitrate:" + i4;
videoLiveManager.mLogService.a(j4, a, true);
break;
}
}
break;
case 251658250:
videoLiveManager.mListener.onAudioRenderStall(i2);
aVar2 = videoLiveManager.mLogService;
j = i2;
i3 = VideoLiveManager.mAudioRenderStallThreshold;
z = false;
aVar2.a(j, i3, z, true);
break;
case 251658251:
videoLiveManager.mListener.onVideoRenderStall(i2);
aVar2 = videoLiveManager.mLogService;
j = i2;
i3 = VideoLiveManager.mVideoRenderStallThreshold;
z = true;
aVar2.a(j, i3, z, true);
break;
case 251658252:
videoLiveManager.mLogService.b(videoLiveManager.mPlayer.a(628, -1L));
break;
case 251658253:
videoLiveManager.mLogService.v++;
break;
}
}
}
}
} else {
videoLiveManager.mIsStalling = false;
videoLiveManager.mListener.onStallEnd();
videoLiveManager.mRetryProcessor.a(false, videoLiveManager.mEnterStallRetryInstantly);
if (videoLiveManager.mShowedFirstFrame && videoLiveManager.mLogService.l()) {
videoLiveManager.mLogService.c(1);
} else if (!videoLiveManager.mShowedFirstFrame && videoLiveManager.mStallStartTime != 0) {
videoLiveManager.mStallTotalTime = System.currentTimeMillis() - videoLiveManager.mStallStartTime;
}
if (videoLiveManager.mIsPlayWithMdl) {
com.bykv.vk.component.ttvideo.a.c.a().a(7214, videoLiveManager.mLogService.t, i2);
}
}
return false;
}
if (videoLiveManager.mEnableRtcPlay == 1 && videoLiveManager.mRtcPlayFallBack == 0 && videoLiveManager.mCurrentRetryCount > 0) {
videoLiveManager.mCurrentRetryCount = 0;
}
String b2 = videoLiveManager.mPlayer.b(142);
String str8 = "meta Data:" + b2;
videoLiveManager.mLogService.d(b2);
int b3 = videoLiveManager.mPlayer.b(141, -1);
if (b3 != 0) {
if (b3 == 1) {
aVar = videoLiveManager.mLogService;
str = "bytevc1";
}
videoLiveManager.mLogService.e = videoLiveManager.convertCodecName(videoLiveManager.mPlayer.b(157, -1));
videoLiveManager.mLogService.e(0);
videoLiveManager.mIsStalling = false;
b = videoLiveManager.mPlayer.b(71);
if (videoLiveManager.mCurrentIP != null && videoLiveManager.mCurrentIP.startsWith("[") && b != null && !b.startsWith("[")) {
b = String.format("[%s]", b);
}
if (b != null && !b.equals(videoLiveManager.mCurrentIP)) {
videoLiveManager.mLogService.a(b, true);
videoLiveManager.mCurrentIP = b;
}
if (videoLiveManager.mEnableReportSessionStop == 1) {
videoLiveManager.mLogService.bm = true;
videoLiveManager.mLogService.bo = System.currentTimeMillis();
videoLiveManager.updateSessionFirstFrameInfo();
}
if (videoLiveManager.mShowedFirstFrame) {
if (videoLiveManager.mEnableTextureRender != 1 || videoLiveManager.mUsePlayerRenderStart) {
MyLog.i(VideoLiveManager.TAG, "render start report first frame");
videoLiveManager.mLogService.a(0L, videoLiveManager.mStallTotalTime);
videoLiveManager.mLogService.a();
videoLiveManager.mShowedFirstFrame = true;
videoLiveManager.mListener.onFirstFrame(true);
videoLiveManager.setIntOption(75, 1);
}
if (videoLiveManager.mIsPlayWithMdl) {
com.bykv.vk.component.ttvideo.a.c.a().a(8015, videoLiveManager.mLogService.t, -1);
}
if (videoLiveManager.mLogService.m() && videoLiveManager.mIsPlayWithMdl) {
com.bykv.vk.component.ttvideo.a.c.a().a(8016, videoLiveManager.mLogService.t, -1);
}
} else if (videoLiveManager.mRenderStartEntered && videoLiveManager.mIsRetrying) {
videoLiveManager.mListener.onFirstFrame(false);
if (videoLiveManager.mUserSwitchResoultion) {
videoLiveManager.mUserSwitchResoultion = false;
} else {
videoLiveManager.mLogService.d(0);
if (videoLiveManager.mLogService.l()) {
videoLiveManager.mListener.onStallEnd();
videoLiveManager.mLogService.c(2);
}
}
if (videoLiveManager.mLogService.u()) {
videoLiveManager.mLogService.v();
}
videoLiveManager.onRenderStallForRetryStop();
}
videoLiveManager.mRenderStartEntered = true;
videoLiveManager.mIsRetrying = false;
videoLiveManager.mRetryProcessor.c();
return false;
}
aVar = videoLiveManager.mLogService;
str = "h264";
aVar.k(str);
videoLiveManager.mLogService.e = videoLiveManager.convertCodecName(videoLiveManager.mPlayer.b(157, -1));
videoLiveManager.mLogService.e(0);
videoLiveManager.mIsStalling = false;
b = videoLiveManager.mPlayer.b(71);
if (videoLiveManager.mCurrentIP != null) {
b = String.format("[%s]", b);
}
if (b != null) {
videoLiveManager.mLogService.a(b, true);
videoLiveManager.mCurrentIP = b;
}
if (videoLiveManager.mEnableReportSessionStop == 1) {
}
if (videoLiveManager.mShowedFirstFrame) {
}
videoLiveManager.mRenderStartEntered = true;
videoLiveManager.mIsRetrying = false;
videoLiveManager.mRetryProcessor.c();
return false;
}
}
public static final class e implements com.bykv.vk.component.ttvideo.a.b {
private final WeakReference<VideoLiveManager> a;
public e(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public long a(int i, long j) {
VideoLiveManager videoLiveManager = this.a.get();
return (videoLiveManager == null || videoLiveManager.mPlayer == null || i != 0) ? j : videoLiveManager.mLogService.a(i, j);
}
@Override
public void a(int i, String str) {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
videoLiveManager.mLogService.c(i, str);
}
@Override
public void b(int i, String str) {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
videoLiveManager.mLogService.b(i, str);
}
}
public static class f implements n.j {
private final WeakReference<VideoLiveManager> a;
public f(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public void onVideoSizeChanged(n nVar, int i, int i2) {
MyLog.i(VideoLiveManager.TAG, "fsllog onVideoSizeChanged, width: " + i + ", height: " + i2);
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null || videoLiveManager.mListener == null) {
return;
}
videoLiveManager.mListener.onVideoSizeChanged(i, i2);
videoLiveManager.mLogService.a(i, i2);
}
}
public static final class g implements n.g {
private final WeakReference<VideoLiveManager> a;
public g(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public void onPrepared(n nVar) {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPrepareState != l.PREPARING || videoLiveManager.mPlayer == null) {
return;
}
String str = "preparing:" + videoLiveManager.mPrepareState;
videoLiveManager.mLogService.g();
videoLiveManager.mPrepareState = l.PREPARED;
if (videoLiveManager.mStartDirectAfterPrepared == 0) {
videoLiveManager.mPlayer.e();
}
videoLiveManager.mListener.onPrepared();
}
}
private static class h implements Runnable {
private n a;
public h(n nVar) {
this.a = nVar;
}
@Override
public void run() {
if (this.a != null) {
try {
MyLog.i(VideoLiveManager.TAG, "MyReleaseRunnable release");
this.a.c();
this.a = null;
} catch (Exception e) {
MyLog.i(VideoLiveManager.TAG, e.toString());
}
}
}
}
private static final class i implements a.InterfaceC0808a {
private final WeakReference<VideoLiveManager> a;
public i(VideoLiveManager videoLiveManager) {
this.a = new WeakReference<>(videoLiveManager);
}
@Override
public void a() {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
MyLog.i(VideoLiveManager.TAG, "onRetryNextPlayURL");
videoLiveManager.updateDownloadSizeStat();
videoLiveManager.mLogService.h();
videoLiveManager.mIsRetrying = true;
String str = null;
if (videoLiveManager.mURLSource.j() == 1) {
str = videoLiveManager.mURLSource.i();
} else if (videoLiveManager.mURLSource.j() == 2) {
str = videoLiveManager.mURLSource.a(videoLiveManager.mResolution.equals(v0.c) ? videoLiveManager.mURLSource.a() : videoLiveManager.mResolution, videoLiveManager.mStreamFormat, videoLiveManager.mLevel);
}
videoLiveManager.mLogService.c(str);
if (!videoLiveManager.mHasRetry) {
videoLiveManager.mHasRetry = true;
videoLiveManager.mLogService.a(videoLiveManager.mPlayer.a(314, 0L));
}
videoLiveManager._stopPlayer();
videoLiveManager.mLogService.bn = System.currentTimeMillis();
if (videoLiveManager.mPrepareState != l.PREPARED) {
videoLiveManager._resetPlayer();
}
videoLiveManager.parsePlayDNS(str);
}
@Override
public void a(LiveError liveError) {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
MyLog.i(VideoLiveManager.TAG, "onReportOutToApplication");
videoLiveManager.mListener.onError(liveError);
videoLiveManager.mFetcher.a();
videoLiveManager.mRetryProcessor.c();
}
@Override
public void a(boolean z) {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
videoLiveManager.updateDownloadSizeStat();
videoLiveManager.mLogService.h();
videoLiveManager.getLastRenderTime();
videoLiveManager.mIsRetrying = true;
MyLog.i(VideoLiveManager.TAG, "onRetryResetPlayer " + z);
if (!videoLiveManager.mHasRetry) {
videoLiveManager.mHasRetry = true;
videoLiveManager.mLogService.a(videoLiveManager.mPlayer.a(314, 0L));
}
videoLiveManager._stopPlayer();
String str = null;
if (videoLiveManager.mURLSource.j() == 1) {
if (videoLiveManager.mURLSource.h() != null) {
str = videoLiveManager.mURLSource.h().mainURL;
}
} else if (videoLiveManager.mURLSource.j() == 2) {
str = videoLiveManager.mURLSource.a(videoLiveManager.mResolution.equals(v0.c) ? videoLiveManager.mURLSource.a() : videoLiveManager.mResolution, videoLiveManager.mStreamFormat, videoLiveManager.mLevel);
}
MyLog.i(VideoLiveManager.TAG, "retry url: " + str);
videoLiveManager.mLogService.c(str);
boolean z2 = false;
if (videoLiveManager.mURLSource.j() == 2 && videoLiveManager.mAbrStrategy.equals("abr_bb_4live") && videoLiveManager.mResolution.equals(v0.c)) {
z2 = true;
}
videoLiveManager.mRetryStartTime = System.currentTimeMillis();
videoLiveManager.mLogService.bn = System.currentTimeMillis();
if (videoLiveManager.mPrepareState != l.PREPARED) {
videoLiveManager._resetPlayer();
if (videoLiveManager.mEnableAbrStallDegradeImmediately != 1 && z2 && (!z2 || videoLiveManager.abrDegradeResolution())) {
return;
}
} else if (videoLiveManager.mEnableAbrStallDegradeImmediately != 1 && z2 && (!z2 || videoLiveManager.abrDegradeResolution())) {
return;
}
videoLiveManager.parsePlayDNS(str);
}
@Override
public void b() {
VideoLiveManager videoLiveManager = this.a.get();
if (videoLiveManager == null || videoLiveManager.mPlayer == null) {
return;
}
videoLiveManager.mIsRetrying = true;
MyLog.i(VideoLiveManager.TAG, "onRTCFallBack");
videoLiveManager._stopPlayer();
if (videoLiveManager.mCurrentRetryCount < videoLiveManager.mRtcMaxRetryCount) {
videoLiveManager.mCurrentRetryCount++;
} else {
videoLiveManager.mRtcPlayFallBack = 1;
videoLiveManager.mLogService.aM = 1;
videoLiveManager.mURLSource.b(1);
if (videoLiveManager.mShowedFirstFrame) {
videoLiveManager.mLogService.aT = 2;
} else {
if (videoLiveManager.mRtcSupportMiniSdp == 1) {
videoLiveManager.mRtcSupportMiniSdp = 0;
videoLiveManager.mLogService.aL = 0;
}
videoLiveManager.mLogService.aT = 1;
}
}
String str = null;
if (videoLiveManager.mURLSource.j() == 1) {
str = videoLiveManager.mURLSource.i();
} else if (videoLiveManager.mURLSource.j() == 2) {
str = videoLiveManager.mURLSource.a(videoLiveManager.mResolution.equals(v0.c) ? videoLiveManager.mURLSource.a() : videoLiveManager.mResolution, videoLiveManager.mStreamFormat, videoLiveManager.mLevel);
}
MyLog.i(VideoLiveManager.TAG, "onRTCFallBack url: " + str + ",mCurrentRetryCount:" + videoLiveManager.mCurrentRetryCount);
videoLiveManager.mLogService.c(str);
if (videoLiveManager.mPrepareState != l.PREPARED) {
videoLiveManager._resetPlayer();
}
videoLiveManager.parsePlayDNS(str);
}
}
private static class j implements ThreadFactory {
private j() {
}
@Override
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(runnable, VideoLiveManager.TAG);
thread.setPriority(10);
return thread;
}
}
public class k implements Runnable {
String a;
boolean b;
private final WeakReference<VideoLiveManager> d;
public k(VideoLiveManager videoLiveManager, String str, boolean z) {
this.b = false;
this.d = new WeakReference<>(videoLiveManager);
this.a = str;
this.b = z;
}
private long a() {
VideoLiveManager videoLiveManager = this.d.get();
if (videoLiveManager == null) {
return -1L;
}
long a = videoLiveManager.mPlayer.a(73, -1L);
long a2 = videoLiveManager.mPlayer.a(72, -1L);
if (a >= 0 && a2 >= 0) {
return Math.min(a, a2);
}
if (a >= 0) {
return a;
}
if (a2 >= 0) {
return a2;
}
return -1L;
}
private void a(long j) {
VideoLiveManager videoLiveManager = this.d.get();
if (videoLiveManager == null) {
return;
}
videoLiveManager.runOnCurrentThreadDelay(new k(videoLiveManager, this.a, this.b), j);
}
@Override
public void run() {
String str;
VideoLiveManager videoLiveManager = this.d.get();
if (videoLiveManager == null || (str = this.a) == null || !str.equals(videoLiveManager.mSessionId) || this.a.isEmpty()) {
return;
}
if (videoLiveManager.mLivePlayerState != a.PLAYED) {
a(500L);
return;
}
long a = a();
if (a == -1) {
a(500L);
return;
}
if (!this.b) {
com.bykv.vk.component.ttvideo.a.c.a().a(7215, videoLiveManager.mSessionId, (int) a);
}
MyLog.d(VideoLiveManager.TAG, "sync play cache:" + a + "(ms) with session id:" + videoLiveManager.mSessionId);
if (a > 5000) {
a(500L);
} else {
a(300L);
}
}
}
public enum l {
IDLE,
INITIALIZED,
PREPARING,
PREPARED
}
public class m implements Runnable {
private m() {
}
@Override
public void run() {
synchronized (VideoLiveManager.this.mStallCounterLock) {
if (VideoLiveManager.this.mStallCounterIsRunning && VideoLiveManager.this.mPlayer != null) {
long uptimeMillis = SystemClock.uptimeMillis() + VideoLiveManager.this.mStallCounterInterval;
long a = VideoLiveManager.this.mPlayer.a(381, 0L);
long a2 = VideoLiveManager.this.mPlayer.a(382, 0L);
long a3 = VideoLiveManager.this.mPlayer.a(383, 0L);
long a4 = VideoLiveManager.this.mPlayer.a(com.facebook.imagepipeline.memory.d.a, 0L);
long a5 = VideoLiveManager.this.mPlayer.a(385, 0L);
long a6 = VideoLiveManager.this.mPlayer.a(386, 0L);
long a7 = VideoLiveManager.this.mPlayer.a(387, 0L);
if ((a != 0 || a2 != 0 || a3 != 0 || a4 != 0 || a5 != 0 || a6 != 0 || a7 != 0) && VideoLiveManager.this.mLogService != null) {
VideoLiveManager.this.mLogService.a(a, a2, a3, a4, a5, a6, a7);
}
if (VideoLiveManager.this.mStallCounterHandler != null) {
VideoLiveManager.this.mStallCounterHandler.postAtTime(this, uptimeMillis);
}
}
}
}
}
private VideoLiveManager(Builder builder) {
this.mMyHandler = new Handler(Looper.myLooper());
this.mURLSource = new com.bykv.vk.component.ttvideo.model.a();
this.mEnableTextureRender = 0;
this.mEnableTextureSR = 0;
this.mResolutionDisableSR = true;
this.mTextureSRBinPath = SchedulerSupport.NONE;
this.mTextureSROclModuleName = "test";
this.mTextureSRDspModuleName = "test";
this.mTextureRenderErrorMsg = null;
this.mEnableOpenMDL = 0;
this.mIsMdlProtoRegister = false;
this.mIsPlayWithMdl = false;
this.mPrepareState = l.IDLE;
this.mLivePlayerState = a.IDLE;
this.mIsRequestCanceled = false;
this.mShowedFirstFrame = false;
this.mHasRetry = false;
this.mLooping = false;
this.mPlayerCache = 0;
this.mEnhancementType = 0;
this.mScaleType = 0;
this.mLayoutType = 0;
this.mRenderType = 3;
this.mHardwareDecodeEnable = 0;
this.mHardwareRTCDecodeEnable = 0;
this.mCacheFileEnable = -1;
this.mTestAction = -1;
this.mUseExternalDir = -1;
this.mMaxFileCacheSize = -1;
this.mByteVC1DecoderType = 1;
this.mBufferDataSeconds = -1;
this.mBufferTimeout = -1;
this.mNetworkTimeout = -1;
this.mPlayerDegradeMode = 0;
this.mEnableSharp = 0;
this.mDefaultCodecId = -1;
this.mEnableMediaCodecASYNCInit = 0;
this.mHurryType = -1;
this.mHurryTime = 0;
this.mCatchSpeed = -1.0f;
this.mSlowPlayTime = -1;
this.mSlowPlaySpeed = -1.0f;
this.mEnableHurryFlag = -1;
this.mCacheFilePath = null;
this.mCacheFileKey = null;
this.mIsCacheHasComplete = false;
this.mCurrentPlayURL = null;
this.mCurrentIP = null;
this.mStallCount = 0;
this.mIsStalling = false;
this.mEnableResolutionAutoDegrade = false;
this.mAbrStrategy = "rad";
this.mHasAbrInfo = false;
this.mDefaultResBitrate = -1;
this.mStallCountThresOfResolutionDegrade = 4;
this.mEnableSwitchMainAndBackupUrl = true;
this.mEnableVideoMpdRefresh = 1;
this.mEnableCmafFastMode = 0;
this.mEnableCmafOptimizeRetry = 0;
this.mEnableDTSCheck = 0;
this.mEnablePreventDTSBack = 0;
this.mFrameDroppingDTSMaxDiff = 10000L;
this.mFrameTerminatedDTS = -1L;
this.mLatestAudioPacketDTS = -1L;
this.mSessionId = null;
this.mEnableCheckFrame = 0;
this.mEnableCheckSEI = 0;
this.mGopDuration = 4;
this.mFrameMetaDataListener = null;
this.mInvocationHandler = null;
this.mLocalURL = null;
this.mIsLocalURL = false;
this.mALogWriteAddr = -1L;
this.mResolution = s0.a.P;
this.mResolutionIndex = -1;
this.mLevel = ce.e;
this.mStreamFormat = "flv";
this.mSuggestProtocol = SchedulerSupport.NONE;
this.mTransportProtocol = "tcp";
this.mURLProtocol = SchedulerSupport.NONE;
this.mEnableAvLines = "";
this.mVideoOnly = "";
this.mAudioOnly = "";
this.mReliable = "";
this.mForceDecodeSwitch = 0;
this.mForceDecodeMsGaps = 0;
this.mForceRenderMsGaps = 0;
this.mFramesDrop = 15;
this.mAVPHDnsParseEnable = 0;
this.mAVPHDnsTimeout = 2000000;
this.mAVPHVideoProbesize = 4096;
this.mAVPHVideoMaxDuration = 100000;
this.mAVPHAudioProbesize = 4096;
this.mAVPHAudioMaxDuration = 100000;
this.mAVPHOpenVideoFirst = 1;
this.mAVPHMaxAVDiff = 10000;
this.mAVPHAutoExit = 1;
this.mAVPHEnableAutoReopen = 0;
this.mAVPHVideoDiffThreshold = 15000;
this.mAVPHReadRetryCount = 100;
this.mAVPHReadErrorExit = 1;
this.mEnableSkipFindUnnecessaryStream = 0;
this.mEnableRenderStall = 1;
this.mAudioLastRenderTime = -1L;
this.mVideoLastRenderTime = -1L;
this.mIsRetrying = false;
this.mEnableDemuxerStall = 1;
this.mEnableDecoderStall = 1;
this.mEnableStallCounter = 0;
this.mStallCounterInterval = com.bigkoo.pickerview.lib.c.b;
this.mEnableClosePlayRetry = 0;
this.mEnableCheckDropAudio = 0;
this.mURLAbility = 1;
this.mStallStartTime = 0L;
this.mStallTotalTime = 0L;
this.mRetryStartTime = 0L;
this.mEnableNTP = 0;
this.mEnableNTPTask = 0;
this.mEnableDns = true;
this.mEnableDnsOptimizer = false;
this.mEnableUploadSessionSeries = false;
this.mEnableH264HardwareDecode = 0;
this.mEnableByteVC1HardwareDecode = 0;
this.mMaxCacheSeconds = -1;
this.mEnableSplitStream = 0;
this.mOpenCheckSideData = 1;
this.mEnableHttpkDegrade = 0;
this.mEnableQuicDegrade = 1;
this.mEnableFastOpenStream = 1;
this.mEnableUploadSei = 1;
this.mSeiDiffThres = 8000L;
this.mEnableSeiCheck = false;
this.mHasSeiInfo = false;
this.mGetSeiCurrentTime = 0L;
this.mStartPlayBufferThres = 0L;
this.mCheckBufferingEndIgnoreVideo = 0;
this.mStartDirectAfterPrepared = 0;
this.mCheckBufferingEndAdvanceEnable = 0;
this.mEnableTcpFastOpen = 0;
this.mEnableCheckPacketCorrupt = 0;
this.mEnableLowLatencyFLV = 0;
this.mLowLatencyFLVStrategy = null;
this.mEnableDroppingDTSRollFrame = 0;
this.mIsInMainLooper = 1;
this.mCmafEnable = false;
this.mQuicEnable = false;
this.mQuicVersion = 39;
this.mEnableSaveSCFG = false;
this.mEnableQuicCertVerify = false;
this.mQuicInitMTU = INIT_MTU;
this.mEnableQuicMTUDiscovery = 0;
this.mQuicPadHello = 1;
this.mQuicFixWillingAndAbleToWrite = 1;
this.mQuicFixProcessTimer = 1;
this.mQuicReadBlockTimeout = 100;
this.mQuicReadBlockMode = 0;
this.mQuicFixStreamFinAndRst = 0;
this.mQuicConfigOptimize = 0;
this.mQuicTimerVersion = 1;
this.mQuicPull = false;
this.mQuicInitRtt = 0;
this.mQuicMaxCryptoRetransmissions = 0;
this.mQuicMaxCryptoRetransmissionTimeMs = 0;
this.mQuicMaxRetransmissions = 0;
this.mQuicMaxRetransmissionTimeMs = 0;
this.mQuicMaxAckDelay = 0;
this.mQuicMinReceivedBeforeAckDecimation = 0;
this.mSessionReceiveWindow = -1;
this.mStreamReceiveWindow = -1;
this.mAVNoSyncThreshold = 10000;
this.mIsAlwaysDoAVSync = 0;
this.mEnableFlvABR = 0;
this.mEnableLLASHFastOpen = 0;
this.mForceHttpDns = false;
this.mHttpDNSServerHost = null;
this.mCancelSDKDNSFailRetry = false;
this.mUrlSettingMethod = -1;
this.mUserSwitchResoultion = false;
this.mEnterStallRetryInstantly = false;
this.mEnableStallRetryInstantly = 1;
this.mNodeOptimizeResults = null;
this.mRedoDns = false;
this.mEnableOptimizeBackup = 0;
this.mSupportBackupIp = true;
this.mTextureSRMode = 0;
this.mRenderStartNotifyTimeStamp = 0L;
this.mRenderStartEntered = false;
this.mEnableAudioVolumeBalance = 0;
this.mAudioVolumeBalancePregain = -1.0f;
this.mAudioVolumeBalanceThreshold = -1.0f;
this.mAudioVolumeBalanceRatio = -1.0f;
this.mAudioVolumeBalancePredelay = -1.0f;
this.mEnableCacheSei = 0;
this.mEnableDecodeMultiSei = 0;
this.mEnableDecodeSeiOnce = 0;
this.mEnableSkipFlvNullTag = 0;
this.mEnableNotifySeiImmediatelyBeforeFirstFrame = 1;
this.mEnableLiveAbrCheckEnhance = 0;
this.mLiveABRCheckInterval = 1000;
this.mABRMethod = -1;
this.mABRBufferThreshold = -1;
this.mTslTimeShift = -1;
this.mTslMinTimeShit = 60;
this.mEnableOriginResolution = false;
this.mTargetOriginBitRate = -1L;
this.mEnableAbrStallDegradeImmediately = 1;
this.mHlsLiveStartIndex = -3;
this.mCdnSessionPath = null;
this.mCdnAbrResolution = null;
this.mAudioTimescaleEnable = -1;
this.mStallRetryTimeIntervalManager = 10000L;
this.mMediaSupportSR = false;
this.mSupportSRScene = 0;
this.mCheckSupportSR = false;
this.mStallCounterThread = null;
this.mStallCounterHandler = null;
this.mVideoStallCountTask = new m();
this.mStallCounterLock = new Object();
this.mStallCounterIsRunning = false;
this.mEnableRtcPlay = 0;
this.mRtcPlayFallBack = 0;
this.mRtcFallbackThreshold = 5000;
this.mRtcEnableDtls = 1;
this.mRtcMinJitterBuffer = 300;
this.mRtcMaxJitterBuffer = com.bigkoo.pickerview.lib.c.b;
this.mRtcEnableSDKDns = 0;
this.mRtcEarlyInitRender = 0;
this.mRtcMaxRetryCount = 0;
this.mRtcSupportMiniSdp = 0;
this.mCurrentRetryCount = 0;
this.mRtcPlayLogInterval = 5000;
this.mRtcEnableRtcUninitLockFree = 0;
this.mEnableRadioLiveDisableRender = 0;
this.mSwitchToB = 0;
this.mMoudleIDToB = "";
this.mURLHost = "";
this.mABRDisableAlgorithm = 0;
this.mTextureRenderFirstFrame = false;
this.mUsePlayerRenderStart = false;
this.mMaxTextureWidth = 0;
this.mMaxTextureHeight = 0;
this.mEnableReportSessionStop = 0;
this.mSessionNum = 0;
this.mSessionStartTime = 0L;
this.mSessionRenderStartTime = 0L;
this.mIsLiveIOProtoRegister = false;
this.mEnableOpenLiveIO = 0;
this.mIsPlayWithLiveIO = false;
this.mEnableLiveIOPlay = 0;
this.mEnableLiveIOP2P = 0;
this.mEnableHttpPrepare = 0;
this.mEnableFreeFlow = 0;
this.mEnableP2pUp = 0;
this.mLiveIOABGroupID = 0;
this.mNoSyncReportMinDuration = 5000;
this.mNoSyncReportReportThres = com.bigkoo.pickerview.lib.c.b;
this.mEnableUseLiveThreadPool = 0;
this.mExecutor = null;
this.mEnableSharpen = 0;
this.mSharpenMode = 0;
this.mMediaSupportSharpen = false;
this.mSupportSharpenScene = -1;
this.mSharpenMaxWidth = 1920;
this.mSharpenMaxHeight = 1080;
this.mSharpenPowerLevel = 0;
this.mSharpenAmount = -1.0f;
this.mSharpenOverRatio = -1.0f;
this.mSharpenEdgeWeightGamma = 6.0f;
this.mSharpenSceneMode = 1;
this.mSharpenSdkParams = null;
Context context = builder.mContext;
this.mContext = context;
ILiveListener iLiveListener = builder.mListener;
this.mListener = iLiveListener;
ILiveSettingBundle iLiveSettingBundle = builder.mSettingsBundle;
this.mSettingsBundle = iLiveSettingBundle;
builder.setStallRetryInterval(this.mStallRetryTimeIntervalManager);
if (iLiveSettingBundle != null) {
this.mEnableReportSessionStop = ((Integer) iLiveSettingBundle.getSettingsValueForKey("live_sdk_should_report_session_stop", 0)).intValue();
this.mEnableUseLiveThreadPool = ((Integer) iLiveSettingBundle.getSettingsValueForKey("live_sdk_enable_use_live_threadpool", 0)).intValue();
}
if (this.mEnableUseLiveThreadPool != 1 || builder.mLiveThreadPool == null) {
MyLog.i(TAG, "create new threadpool");
this.mExecutor = new ThreadPoolExecutor(1, 3, 60L, TimeUnit.SECONDS, new LinkedBlockingDeque(), new j() {
});
} else {
MyLog.i(TAG, "use live threadpool");
this.mExecutor = builder.mLiveThreadPool;
this.mLogService.bH = 1;
}
com.bykv.vk.component.ttvideo.log.a aVar = new com.bykv.vk.component.ttvideo.log.a(this, iLiveListener, builder.mUploadLogInterval, builder.mStallRetryTimeInterval, context, this.mEnableReportSessionStop);
this.mLogService = aVar;
aVar.h(builder.mProjectKey);
com.bykv.vk.component.ttvideo.a.c.a().a(this.mLogService);
this.mRetryProcessor = new com.bykv.vk.component.ttvideo.d.a(new i(this), builder.mRetryTimeout, builder.mStallRetryTimeInterval, this.mLogService);
this.mPlayerSetting = new com.bykv.vk.component.ttvideo.c.b(context, null);
boolean z = builder.mForceHttpDns;
this.mForceHttpDns = z;
this.mLogService.K = z;
INetworkClient iNetworkClient = builder.mNetworkClient;
this.mNetworkClient = iNetworkClient;
com.bykv.vk.component.ttvideo.b.a aVar2 = new com.bykv.vk.component.ttvideo.b.a(context, this.mExecutor, iNetworkClient);
this.mDnsParser = aVar2;
aVar2.b();
this.mPlayerType = builder.mPlayerType;
this.mStreamFormat = builder.mVideoFormat;
this.mResolution = builder.mResolution;
this.mStallCount = 0;
this.mEnableResolutionAutoDegrade = builder.mEnableResolutionAutoDegrade;
this.mEnableSwitchMainAndBackupUrl = builder.mEnableSwitchMainAndBackupUrl;
this.mSeiDiffThres = builder.mSeiCheckTimeOut;
}
public boolean HttpKDegradeHttp(int i2) {
String replaceAll;
String str = this.mCurrentPlayURL;
if (str == null || !str.startsWith("httpk") || (replaceAll = this.mCurrentPlayURL.replaceAll("httpk", rv.a).replaceAll(":(\\d+)/", com.ksdk.ssds.manager.b.b)) == null) {
return false;
}
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
this.mLogService.c(replaceAll);
this.mLogService.a(this.mCurrentPlayURL, replaceAll, "httpk_to_http", i2);
this.mCurrentPlayURL = replaceAll;
_stopPlayer();
_resetPlayer();
this.mSessionStartTime = System.currentTimeMillis();
parsePlayDNS(this.mCurrentPlayURL);
return true;
}
public boolean QuicDegrade(int i2) {
String str;
String str2;
if (this.mCurrentPlayURL == null) {
return false;
}
if ((!TextUtils.equals(this.mTransportProtocol, "quic") && !TextUtils.equals(this.mTransportProtocol, "quicu")) || i2 != -499499) {
return false;
}
if (this.mURLProtocol.equals("tls")) {
this.mTransportProtocol = "tls";
str = this.mCurrentPlayURL;
str2 = "https";
} else if (this.mURLProtocol.equals("kcp")) {
this.mTransportProtocol = "kcp";
str = this.mCurrentPlayURL;
str2 = "httpk";
} else {
this.mTransportProtocol = "tcp";
str = this.mCurrentPlayURL;
str2 = rv.a;
}
String replaceAll = str.replaceAll("httpq", str2).replaceAll(":(\\d+)/", com.ksdk.ssds.manager.b.b);
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
if (replaceAll != null) {
this.mLogService.c(replaceAll);
this.mLogService.a(this.mCurrentPlayURL, replaceAll, "quic_library_load_error", i2);
this.mCurrentPlayURL = replaceAll;
_stopPlayer();
_resetPlayer();
this.mSessionStartTime = System.currentTimeMillis();
parsePlayDNS(this.mCurrentPlayURL);
}
return true;
}
private String _addParamToURL(String str, String str2, String str3) {
if (TextUtils.isEmpty(str)) {
return null;
}
String str4 = str2 + "=" + str3;
int indexOf = str.indexOf("?");
if (indexOf == -1) {
str4 = "?" + str4;
} else if (indexOf != str.length() - 1) {
str4 = h1.b + str4;
}
return str + str4;
}
private void _checkStreamData() {
com.bykv.vk.component.ttvideo.model.a aVar = this.mURLSource;
if (aVar == null) {
return;
}
aVar.a(this.mEnableOriginResolution);
if (this.mEnableResolutionAutoDegrade && this.mURLSource.j() == 2 && this.mAbrStrategy.equals("abr_bb_4live")) {
String a2 = this.mURLSource.a();
if (!TextUtils.isEmpty(a2)) {
if (!this.mEnableOriginResolution && a2.equals(s0.a.P)) {
a2 = "uhd";
}
_smartResolveDefaultResolution(a2);
}
if (this.mURLSource.c() && this.mURLSource.d(this.mLevel)) {
return;
}
this.mResolution = this.mURLSource.a();
this.mAbrStrategy = "rad";
this.mEnableResolutionAutoDegrade = false;
if (!this.mURLSource.c()) {
this.mLogService.aY = 0;
}
if (this.mURLSource.d(this.mLevel)) {
return;
}
this.mLogService.aX = 1;
}
}
private void _checkValidAbrResolution() {
if (!this.mAbrStrategy.equals("abr_bb_4live") || !this.mEnableResolutionAutoDegrade || this.mURLSource.a(this.mResolution)) {
return;
}
int i2 = 0;
while (true) {
String[] strArr = com.bykv.vk.component.ttvideo.c.a;
if (i2 >= strArr.length) {
return;
}
if (this.mURLSource.a(strArr[i2])) {
MyLog.i(TAG, "Abr res check.modify from " + this.mResolution + " to " + strArr[i2]);
this.mResolution = strArr[i2];
return;
}
i2++;
}
}
private void _configAbrInfo() {
JSONObject b2 = this.mURLSource.b();
if (b2 != null) {
boolean z = true;
this.mHasAbrInfo = true;
try {
if (b2.has("enable")) {
this.mEnableResolutionAutoDegrade = b2.optInt("enable") == 1;
}
if (b2.has("strategy")) {
this.mAbrStrategy = b2.getString("strategy");
}
if (b2.has("enable_origin_resolution")) {
if (b2.optInt("enable_origin_resolution") != 1) {
z = false;
}
this.mEnableOriginResolution = z;
}
if (b2.has("disable_algorithm")) {
this.mABRDisableAlgorithm = b2.optInt("disable_algorithm");
return;
}
return;
} catch (JSONException e2) {
e2.printStackTrace();
this.mHasAbrInfo = false;
this.mEnableResolutionAutoDegrade = false;
this.mAbrStrategy = "rad";
this.mEnableOriginResolution = false;
}
} else {
this.mHasAbrInfo = false;
this.mEnableResolutionAutoDegrade = false;
this.mEnableOriginResolution = false;
this.mAbrStrategy = "rad";
}
this.mStallCountThresOfResolutionDegrade = 4;
}
private void _configAvphNeqStrategy() {
JSONObject jSONObject;
String str = (String) this.mSettingsBundle.getSettingsValueForKey("live_sdk_low_latency_flv_default_strategy_map", "");
if (str.length() > 0) {
try {
jSONObject = new JSONObject(str);
} catch (JSONException e2) {
e2.printStackTrace();
}
if (jSONObject == null && jSONObject.has("net_effective_connection_type_strategy")) {
try {
jSONObject.getJSONObject("net_effective_connection_type_strategy");
} catch (JSONException e3) {
e3.printStackTrace();
return;
}
}
return;
}
jSONObject = null;
if (jSONObject == null) {
return;
}
jSONObject.getJSONObject("net_effective_connection_type_strategy");
}
private void _configFlvLowLatencyWithSDKParam() {
String d2 = this.mURLSource.d(this.mResolution, this.mLevel);
if (d2 != null) {
try {
JSONObject jSONObject = new JSONObject(d2);
if (jSONObject.has("NetworkAdapt")) {
JSONObject jSONObject2 = new JSONObject(jSONObject.optString("NetworkAdapt"));
if (jSONObject2.has("Enabled")) {
int optInt = jSONObject2.optInt("Enabled");
this.mEnableHurryFlag = optInt;
if (optInt == 1) {
this.mHurryType = 0;
}
if (jSONObject2.has("HurryTime")) {
int optInt2 = jSONObject2.optInt("HurryTime");
this.mHurryTime = optInt2;
this.mPlayer.a(15, optInt2);
this.mLogService.g = this.mHurryTime;
}
if (jSONObject2.has("HurryMillisecond")) {
int optInt3 = jSONObject2.optInt("HurryMillisecond");
this.mHurryTime = optInt3;
this.mPlayer.a(397, optInt3);
this.mLogService.g = this.mHurryTime;
}
if (jSONObject2.has("HurrySpeed")) {
float parseFloat = Float.parseFloat(jSONObject2.optString("HurrySpeed"));
this.mCatchSpeed = parseFloat;
this.mPlayer.a(80, parseFloat);
this.mLogService.h = this.mCatchSpeed;
}
if (jSONObject2.has("SlowTime")) {
int optInt4 = jSONObject2.optInt("SlowTime");
this.mSlowPlayTime = optInt4;
this.mPlayer.a(190, optInt4);
this.mLogService.i = this.mSlowPlayTime;
}
if (jSONObject2.has("SlowMillisecond")) {
int optInt5 = jSONObject2.optInt("SlowMillisecond");
this.mSlowPlayTime = optInt5;
this.mPlayer.a(398, optInt5);
this.mLogService.i = this.mSlowPlayTime;
}
if (jSONObject2.has("SlowSpeed")) {
float parseFloat2 = Float.parseFloat(jSONObject2.optString("SlowSpeed"));
this.mSlowPlaySpeed = parseFloat2;
this.mPlayer.a(191, parseFloat2);
this.mLogService.j = this.mSlowPlaySpeed;
}
}
}
if (jSONObject.has("FastOpenDuration")) {
mFastOpenDuration = jSONObject.optInt("FastOpenDuration");
}
if (jSONObject.has("EnableLowLatencyFLV")) {
this.mEnableLowLatencyFLV = jSONObject.optInt("EnableLowLatencyFLV");
MyLog.d(TAG, "enable low latency:" + this.mEnableLowLatencyFLV + " stallTotalCount:" + this.mLogService.e() + " retryTotalCount:" + this.mLogService.d());
}
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
private void _configLiveSettingBundle() {
ILiveSettingBundle iLiveSettingBundle = this.mSettingsBundle;
if (iLiveSettingBundle == null) {
return;
}
this.mEnableCheckDropAudio = ((Integer) iLiveSettingBundle.getSettingsValueForKey("live_enable_check_drop_audio", 0)).intValue();
this.mRenderType = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_option_render_type", 3)).intValue();
this.mEnableCmafFastMode = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_enable_cmaf_fast_mode", 0)).intValue();
this.mStartPlayBufferThres = ((Long) this.mSettingsBundle.getSettingsValueForKey("live_start_play_buffer_thres", 0L)).longValue();
this.mCheckBufferingEndIgnoreVideo = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_check_buffering_end_ignore_video", 0)).intValue();
this.mStartDirectAfterPrepared = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_direct_start_after_prepared", 0)).intValue();
this.mCheckBufferingEndAdvanceEnable = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_check_buffering_end_advance", 0)).intValue();
if (!this.mHasAbrInfo) {
this.mEnableResolutionAutoDegrade = ((Boolean) this.mSettingsBundle.getSettingsValueForKey("live_enable_resolution_degrade", Boolean.FALSE)).booleanValue();
this.mStallCountThresOfResolutionDegrade = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_stall_count_thres_for_degrade", 4)).intValue();
}
MyLog.i(TAG, "mEnableResolutionAutoDegrade:" + this.mEnableResolutionAutoDegrade + " mStallCountThresOfResolutionDegrade:" + this.mStallCountThresOfResolutionDegrade);
this.mEnableOpenMDL = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_open_mdl_enable", 0)).intValue();
StringBuilder sb = new StringBuilder();
sb.append("enable mdl:");
sb.append(this.mEnableOpenMDL);
MyLog.i(TAG, sb.toString());
this.mEnableTcpFastOpen = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_enable_tcp_fast_open", 0)).intValue();
MyLog.i(TAG, "enable tfo:" + this.mEnableTcpFastOpen);
this.mEnableCheckPacketCorrupt = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_enable_check_packet_corrupt", 0)).intValue();
this.mEnableFlvABR = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_enable_flv_abr", 0)).intValue();
ILiveSettingBundle iLiveSettingBundle2 = this.mSettingsBundle;
Boolean bool = Boolean.FALSE;
this.mForceHttpDns = ((Boolean) iLiveSettingBundle2.getSettingsValueForKey("live_sdk_http_dns_enabled", bool)).booleanValue();
this.mHttpDNSServerHost = (String) this.mSettingsBundle.getSettingsValueForKey("live_sdk_http_dns_server_host", com.ksdk.ssds.manager.b.p);
this.mLogService.K = this.mForceHttpDns;
MyLog.i(TAG, "enable http dns:" + this.mForceHttpDns + " http dns server: " + this.mHttpDNSServerHost);
this.mLogService.x = (String) this.mSettingsBundle.getSettingsValueForKey("live_sdk_ntp_server_name", com.ksdk.ssds.manager.b.p);
this.mCancelSDKDNSFailRetry = ((Boolean) this.mSettingsBundle.getSettingsValueForKey("live_sdk_cancel_sdk_dns_fail_retry", bool)).booleanValue();
this.mEnableClosePlayRetry = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_enable_close_play_retry", 0)).intValue();
this.mEnableOptimizeBackup = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_optimize_backup_enabled", 0)).intValue();
MyLog.i(TAG, "enable optimize backup ip:" + this.mEnableOptimizeBackup);
this.mEnableStallRetryInstantly = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_stall_retry_instantly_enabled", 1)).intValue();
this.mEnableAudioVolumeBalance = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_audio_volume_balance_enable", 0)).intValue();
this.mAudioVolumeBalancePregain = ((Float) this.mSettingsBundle.getSettingsValueForKey("live_sdk_audio_volume_balance_pregain", Float.valueOf(-1.0f))).floatValue();
this.mAudioVolumeBalanceThreshold = ((Float) this.mSettingsBundle.getSettingsValueForKey("live_sdk_audio_volume_balance_threshold", Float.valueOf(-1.0f))).floatValue();
this.mAudioVolumeBalanceRatio = ((Float) this.mSettingsBundle.getSettingsValueForKey("live_sdk_audio_volume_balance_ratio", Float.valueOf(-1.0f))).floatValue();
this.mAudioVolumeBalancePredelay = ((Float) this.mSettingsBundle.getSettingsValueForKey("live_sdk_audio_volume_balance_predelay", Float.valueOf(-1.0f))).floatValue();
MyLog.i(TAG, "audio balance:" + this.mEnableAudioVolumeBalance + bf0.COMMA + this.mAudioVolumeBalancePregain + bf0.COMMA + this.mAudioVolumeBalanceThreshold + bf0.COMMA + this.mAudioVolumeBalanceRatio + bf0.COMMA + this.mAudioVolumeBalancePredelay);
this.mEnableCacheSei = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_enable_sei_pts_synced", 0)).intValue();
StringBuilder sb2 = new StringBuilder();
sb2.append("enable sei pts sync:");
sb2.append(this.mEnableCacheSei);
MyLog.i(TAG, sb2.toString());
this.mStallRetryTimeIntervalManager = ((Long) this.mSettingsBundle.getSettingsValueForKey("stall_retry_time_interval_manager", 10000L)).longValue();
this.mEnableDecodeMultiSei = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_enable_decode_multi_sei", 0)).intValue();
this.mEnableRadioLiveDisableRender = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_enable_radiolive_disable_render", 0)).intValue();
this.mEnableOpenLiveIO = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_enable_liveio", 0)).intValue();
this.mEnableDecodeSeiOnce = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_enable_decode_sei_once", 0)).intValue();
this.mEnableNotifySeiImmediatelyBeforeFirstFrame = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_notify_sei_immediately_before_first_frame_enabled", 0)).intValue();
this.mEnableNotifySeiImmediatelyBeforeFirstFrame = 1;
this.mEnableDroppingDTSRollFrame = ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_dropping_dts_rollback_frame_enabled", 0)).intValue();
String str = (String) this.mSettingsBundle.getSettingsValueForKey("live_sdk_low_latency_flv_default_strategy_map", "");
if (str.length() > 0) {
try {
this.mLowLatencyFLVStrategy = new JSONObject(str);
} catch (JSONException e2) {
this.mLowLatencyFLVStrategy = null;
e2.printStackTrace();
MyLog.e(TAG, "strategy settings invalid");
}
}
}
private void _configWithLowLatencyFLVStrategy(JSONObject jSONObject) {
if (jSONObject != null && jSONObject.has("net_effective_connection_type_strategy")) {
try {
jSONObject.getJSONObject("net_effective_connection_type_strategy");
} catch (JSONException e2) {
e2.printStackTrace();
}
}
}
private void _configWithSDKParams() {
ILiveSettingBundle iLiveSettingBundle;
JSONObject optJSONObject;
JSONObject optJSONObject2;
JSONObject jSONObject;
JSONObject jSONObject2;
JSONObject jSONObject3;
String d2 = this.mURLSource.d(this.mResolution, this.mLevel);
if (d2 != null) {
try {
JSONObject jSONObject4 = new JSONObject(d2);
if (!this.mHasAbrInfo && jSONObject4.has("Auto") && (jSONObject2 = jSONObject4.getJSONObject("Auto")) != null) {
if (jSONObject2.has("Enable")) {
this.mEnableResolutionAutoDegrade = jSONObject2.optInt("Enable") == 1;
}
if (jSONObject2.has("Demotion") && (jSONObject3 = jSONObject2.getJSONObject("Demotion")) != null && jSONObject3.has("StallCount")) {
this.mStallCountThresOfResolutionDegrade = jSONObject3.getInt("StallCount");
}
}
if (jSONObject4.has("vbitrate")) {
this.mDefaultResBitrate = jSONObject4.optInt("vbitrate");
}
if (jSONObject4.has("FramesDrop")) {
this.mFramesDrop = jSONObject4.optInt("FramesDrop");
}
if (jSONObject4.has("AVPHDnsParseEnable")) {
this.mAVPHDnsParseEnable = jSONObject4.optInt("AVPHDnsParseEnable");
}
if (jSONObject4.has("AVPHDnsTimeout")) {
this.mAVPHDnsTimeout = jSONObject4.optInt("AVPHDnsTimeout");
}
if (jSONObject4.has("AVPHVideoProbesize")) {
this.mAVPHVideoProbesize = jSONObject4.optInt("AVPHVideoProbesize");
}
if (jSONObject4.has("AVPHVideoMaxDuration")) {
this.mAVPHVideoMaxDuration = jSONObject4.optInt("AVPHVideoMaxDuration");
}
if (jSONObject4.has("AVPHAudioProbesize")) {
this.mAVPHAudioProbesize = jSONObject4.optInt("AVPHAudioProbesize");
}
if (jSONObject4.has("AVPHAudioMaxDuration")) {
this.mAVPHAudioMaxDuration = jSONObject4.optInt("AVPHAudioMaxDuration");
}
if (jSONObject4.has("AVPHOpenVideoFirst")) {
this.mAVPHOpenVideoFirst = jSONObject4.optInt("AVPHOpenVideoFirst");
}
if (jSONObject4.has("AVPHMaxAVDiff")) {
this.mAVPHMaxAVDiff = jSONObject4.optInt("AVPHMaxAVDiff");
}
if (jSONObject4.has("AVPHAutoExit")) {
this.mAVPHAutoExit = jSONObject4.optInt("AVPHAutoExit");
}
if (jSONObject4.has("AVPHAutoReopen")) {
this.mAVPHEnableAutoReopen = jSONObject4.optInt("AVPHAutoReopen");
}
if (jSONObject4.has("AVPHVideoDiffThreshold")) {
this.mAVPHVideoDiffThreshold = jSONObject4.optInt("AVPHVideoDiffThreshold");
}
if (jSONObject4.has("AVPHReadRetryCount")) {
this.mAVPHReadRetryCount = jSONObject4.optInt("AVPHReadRetryCount");
}
if (jSONObject4.has("AVPHReadErrorExit")) {
this.mAVPHReadErrorExit = jSONObject4.optInt("AVPHReadErrorExit");
}
if (jSONObject4.has("EnableSkipFindUnnecessaryStream")) {
this.mEnableSkipFindUnnecessaryStream = jSONObject4.optInt("EnableSkipFindUnnecessaryStream");
}
if (jSONObject4.has("EnableRenderStall")) {
this.mEnableRenderStall = jSONObject4.optInt("EnableRenderStall");
}
if (jSONObject4.has("VideoRenderStallThreshold")) {
mVideoRenderStallThreshold = jSONObject4.optInt("VideoRenderStallThreshold");
}
if (jSONObject4.has("AudioRenderStallThreshold")) {
mAudioRenderStallThreshold = jSONObject4.optInt("AudioRenderStallThreshold");
}
if (jSONObject4.has("EnableDemuxerStall")) {
this.mEnableDemuxerStall = jSONObject4.optInt("EnableDemuxerStall");
}
if (jSONObject4.has("EnableDecoderStall")) {
this.mEnableDecoderStall = jSONObject4.optInt("EnableDecoderStall");
}
if (jSONObject4.has("DemuxerStallThreshold")) {
mDemuxerStallThreshold = jSONObject4.optInt("DemuxerStallThreshold");
}
if (jSONObject4.has("DecoderStallThreshold")) {
mDecoderStallThreshold = jSONObject4.optInt("DecoderStallThreshold");
}
if (jSONObject4.has("StallCounter") && (jSONObject = jSONObject4.getJSONObject("StallCounter")) != null) {
if (jSONObject.has("Enable")) {
this.mEnableStallCounter = jSONObject.optInt("Enable");
}
if (jSONObject.has("TimeInterval")) {
this.mStallCounterInterval = jSONObject.optInt("TimeInterval");
}
}
if (jSONObject4.has("DTSCheckEnabled")) {
this.mEnableDTSCheck = jSONObject4.optInt("DTSCheckEnabled");
}
if (jSONObject4.has("DroppingRepeatingDataEnabled")) {
this.mEnablePreventDTSBack = jSONObject4.optInt("DroppingRepeatingDataEnabled");
}
if (jSONObject4.has("DroppingRepeatingDataDTSMaxDiff")) {
this.mFrameDroppingDTSMaxDiff = jSONObject4.optLong("DroppingRepeatingDataDTSMaxDiff");
}
if (jSONObject4.has("EnableSaveSCFG")) {
this.mEnableSaveSCFG = jSONObject4.optInt("EnableSaveSCFG") == 1;
}
if (jSONObject4.has("EnableVideoMpdRefresh")) {
this.mEnableVideoMpdRefresh = jSONObject4.optInt("EnableVideoMpdRefresh");
}
if (jSONObject4.has("TransInfoCheck")) {
JSONObject optJSONObject3 = jSONObject4.optJSONObject("TransInfoCheck");
if (optJSONObject3.has("Enabled")) {
this.mEnableCheckFrame = optJSONObject3.optInt("Enabled");
}
}
if (jSONObject4.has("SEICheck")) {
JSONObject optJSONObject4 = jSONObject4.optJSONObject("SEICheck");
if (optJSONObject4.has("Enabled")) {
this.mEnableCheckSEI = optJSONObject4.optInt("Enabled");
if (optJSONObject4.optInt("Enabled") == 1 || this.mLogService != null) {
this.mLogService.n();
}
}
}
if (jSONObject4.has("EnableCacheSei")) {
this.mEnableCacheSei = jSONObject4.optInt("EnableCacheSei");
}
if (jSONObject4.has("gop")) {
this.mGopDuration = jSONObject4.optInt("gop");
}
if (jSONObject4.has("EnableLLASHFastOpen")) {
this.mEnableLLASHFastOpen = jSONObject4.optInt("EnableLLASHFastOpen");
}
if (jSONObject4.has("EnableABRCheckEnhance")) {
this.mEnableLiveAbrCheckEnhance = jSONObject4.optInt("EnableABRCheckEnhance");
}
if (jSONObject4.has("ABRCheckInterval")) {
this.mLiveABRCheckInterval = jSONObject4.optInt("ABRCheckInterval");
}
if (jSONObject4.has("ABRMethod")) {
this.mABRMethod = jSONObject4.optInt("ABRMethod");
}
if (jSONObject4.has("ABRBufferThreshold")) {
this.mABRBufferThreshold = jSONObject4.optInt("ABRBufferThreshold");
}
if (jSONObject4.has("MaxCacheSeconds")) {
this.mMaxCacheSeconds = jSONObject4.optInt("MaxCacheSeconds");
}
if (jSONObject4.has("MainBackupSwitch")) {
JSONObject optJSONObject5 = jSONObject4.optJSONObject("MainBackupSwitch");
if (optJSONObject5.has("Enabled")) {
if (optJSONObject5.optInt("Enabled") == 0) {
this.mEnableSwitchMainAndBackupUrl = false;
} else {
this.mEnableSwitchMainAndBackupUrl = true;
}
}
}
if (jSONObject4.has("MinTimeShift")) {
this.mTslMinTimeShit = jSONObject4.optInt("MinTimeShift");
}
if (jSONObject4.has("TargetOriginBitRate")) {
this.mTargetOriginBitRate = jSONObject4.optInt("TargetOriginBitRate");
}
if (jSONObject4.has("AbrStallDegradeImmediately")) {
this.mEnableAbrStallDegradeImmediately = jSONObject4.optInt("AbrStallDegradeImmediately");
}
if (jSONObject4.has("HASSessionPath")) {
this.mCdnSessionPath = jSONObject4.optString("HASSessionPath");
}
if (jSONObject4.has("DecodeSEIEnabled")) {
this.mEnableUploadSei = jSONObject4.optInt("DecodeSEIEnabled");
}
if (jSONObject4.has("NetworkAdapt")) {
JSONObject jSONObject5 = new JSONObject(jSONObject4.optString("NetworkAdapt"));
if (jSONObject5.has("Enabled")) {
int optInt = jSONObject5.optInt("Enabled");
this.mEnableHurryFlag = optInt;
if (optInt == 1) {
this.mHurryType = 0;
}
if (jSONObject5.has("HurryTime")) {
int optInt2 = jSONObject5.optInt("HurryTime");
this.mHurryTime = optInt2;
this.mPlayer.a(15, optInt2);
}
if (jSONObject5.has("HurryMillisecond")) {
int optInt3 = jSONObject5.optInt("HurryMillisecond");
this.mHurryTime = optInt3;
this.mPlayer.a(397, optInt3);
}
if (jSONObject5.has("HurrySpeed")) {
this.mCatchSpeed = Float.parseFloat(jSONObject5.optString("HurrySpeed"));
}
if (jSONObject5.has("SlowTime")) {
int optInt4 = jSONObject5.optInt("SlowTime");
this.mSlowPlayTime = optInt4;
this.mPlayer.a(190, optInt4);
}
if (jSONObject5.has("SlowMillisecond")) {
int optInt5 = jSONObject5.optInt("SlowMillisecond");
this.mSlowPlayTime = optInt5;
this.mPlayer.a(398, optInt5);
}
if (jSONObject5.has("SlowSpeed")) {
this.mSlowPlaySpeed = Float.parseFloat(jSONObject5.optString("SlowSpeed"));
}
}
}
if (jSONObject4.has("StartPlayAudioBufferThreshold")) {
this.mStartPlayBufferThres = jSONObject4.optInt("StartPlayAudioBufferThreshold");
}
if (jSONObject4.has("EnableCertVerify")) {
this.mEnableQuicCertVerify = jSONObject4.optInt("EnableCertVerify") == 1;
}
if (jSONObject4.has("EnableClosePlayRetry")) {
this.mEnableClosePlayRetry = jSONObject4.optInt("EnableClosePlayRetry");
}
if (jSONObject4.has("EnableDnsOptimizer")) {
boolean z = jSONObject4.optInt("EnableDnsOptimizer") == 1;
this.mEnableDnsOptimizer = z;
this.mLogService.b(z);
}
if (jSONObject4.has("EnableMTUDiscovery")) {
this.mEnableQuicMTUDiscovery = jSONObject4.optInt("EnableMTUDiscovery");
}
if (jSONObject4.has("InitMTU")) {
this.mQuicInitMTU = jSONObject4.optInt("InitMTU");
}
if (jSONObject4.has("InitRtt")) {
this.mQuicInitRtt = jSONObject4.optInt("InitRtt");
}
if (jSONObject4.has("MaxCryptoRetransmissions")) {
this.mQuicMaxCryptoRetransmissions = jSONObject4.optInt("MaxCryptoRetransmissions");
}
if (jSONObject4.has("MaxCryptoRetransmissionTimeMs")) {
this.mQuicMaxCryptoRetransmissionTimeMs = jSONObject4.optInt("MaxCryptoRetransmissionTimeMs");
}
if (jSONObject4.has("MaxRetransmissions")) {
this.mQuicMaxRetransmissions = jSONObject4.optInt("MaxRetransmissions");
}
if (jSONObject4.has("MaxRetransmissionTimeMs")) {
this.mQuicMaxRetransmissionTimeMs = jSONObject4.optInt("MaxRetransmissionTimeMs");
}
if (jSONObject4.has("MaxAckDelay")) {
this.mQuicMaxAckDelay = jSONObject4.optInt("MaxAckDelay");
}
if (jSONObject4.has("MinReceivedBeforeAckDecimation")) {
this.mQuicMinReceivedBeforeAckDecimation = jSONObject4.optInt("MinReceivedBeforeAckDecimation");
}
if (jSONObject4.has("QuicVersion")) {
this.mQuicVersion = jSONObject4.optInt("QuicVersion", 39);
}
if (jSONObject4.has("PadHello")) {
this.mQuicPadHello = jSONObject4.optInt("PadHello", 1);
}
if (jSONObject4.has("FixWillingAndAbleToWrite")) {
this.mQuicFixWillingAndAbleToWrite = jSONObject4.optInt("FixWillingAndAbleToWrite", 1);
}
if (jSONObject4.has("FixProcessTimer")) {
this.mQuicFixProcessTimer = jSONObject4.optInt("FixProcessTimer", 1);
}
if (jSONObject4.has("QuicReadBlockTimeout")) {
this.mQuicReadBlockTimeout = jSONObject4.optInt("QuicReadBlockTimeout", 100);
}
if (jSONObject4.has("QuicReadBlockMode")) {
this.mQuicReadBlockMode = jSONObject4.optInt("QuicReadBlockMode", 0);
}
if (jSONObject4.has("FixStreamFinAndRst")) {
this.mQuicFixStreamFinAndRst = jSONObject4.optInt("FixStreamFinAndRst", 0);
}
if (jSONObject4.has("QuicTimerVersion")) {
this.mQuicTimerVersion = jSONObject4.optInt("QuicTimerVersion", 1);
}
if (jSONObject4.has("QuicConfigOptimize")) {
this.mQuicConfigOptimize = jSONObject4.optInt("QuicConfigOptimize", 0);
}
if (jSONObject4.has("QuicSessionReceiveWindow")) {
this.mSessionReceiveWindow = jSONObject4.optInt("QuicSessionReceiveWindow", 1);
}
if (jSONObject4.has("QuicStreamReceiveWindow")) {
this.mStreamReceiveWindow = jSONObject4.optInt("QuicStreamReceiveWindow", 1);
}
if (jSONObject4.has("EnableCheckDropAudio")) {
this.mEnableCheckDropAudio = jSONObject4.optInt("EnableCheckDropAudio");
}
if (jSONObject4.has("AVNoSyncThreshold")) {
this.mAVNoSyncThreshold = jSONObject4.optInt("AVNoSyncThreshold");
}
if (jSONObject4.has("AlwaysDoAVSync")) {
this.mIsAlwaysDoAVSync = jSONObject4.optInt("AlwaysDoAVSync");
}
if (jSONObject4.has("StallRetryTimeIntervalManager")) {
this.mStallRetryTimeIntervalManager = jSONObject4.optLong("StallRetryTimeIntervalManager");
}
if (jSONObject4.has("FastOpenDuration")) {
mFastOpenDuration = jSONObject4.optInt("FastOpenDuration");
}
if (jSONObject4.has("LLSConfig") && (optJSONObject2 = jSONObject4.optJSONObject("LLSConfig")) != null) {
if (optJSONObject2.has("FallbackThreshold")) {
this.mRtcFallbackThreshold = optJSONObject2.optInt("FallbackThreshold");
}
if (optJSONObject2.has("EnableDtls")) {
this.mRtcEnableDtls = optJSONObject2.optInt("EnableDtls");
}
if (optJSONObject2.has("MinJitterBuffer")) {
this.mRtcMinJitterBuffer = optJSONObject2.optInt("MinJitterBuffer");
}
if (optJSONObject2.has("MaxJitterBuffer")) {
this.mRtcMaxJitterBuffer = optJSONObject2.optInt("MaxJitterBuffer");
}
if (optJSONObject2.has("EnableSDKDns")) {
this.mRtcEnableSDKDns = optJSONObject2.optInt("EnableSDKDns");
}
if (optJSONObject2.has("EnableEarlyInitRender")) {
this.mRtcEarlyInitRender = optJSONObject2.optInt("EnableEarlyInitRender");
}
if (optJSONObject2.has("MaxRetryCount")) {
this.mRtcMaxRetryCount = optJSONObject2.optInt("MaxRetryCount");
}
if (optJSONObject2.has("EnableRTCHWDecode")) {
this.mHardwareRTCDecodeEnable = optJSONObject2.optInt("EnableRTCHWDecode");
}
if (optJSONObject2.has("EnableMiniSdp")) {
this.mRtcSupportMiniSdp = optJSONObject2.optInt("EnableMiniSdp");
}
if (optJSONObject2.has("PlayingLogInterval")) {
int optInt6 = optJSONObject2.optInt("PlayingLogInterval");
this.mRtcPlayLogInterval = optInt6;
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar != null) {
aVar.d(optInt6);
}
}
if (optJSONObject2.has("EnableRTSFixDeadlock")) {
this.mRtcEnableRtcUninitLockFree = optJSONObject2.optInt("EnableRTSFixDeadlock");
}
}
if (jSONObject4.has("NetWorkTimeoutMs")) {
this.mNetworkTimeout = jSONObject4.optInt("NetWorkTimeoutMs");
}
if (jSONObject4.has("EnableCheckPacketCorrupt")) {
this.mEnableCheckPacketCorrupt = jSONObject4.optInt("EnableCheckPacketCorrupt");
}
if (jSONObject4.has("AudioTimescaleEnable")) {
this.mAudioTimescaleEnable = jSONObject4.optInt("AudioTimescaleEnable");
}
if (jSONObject4.has("EnableTcpFastOpen")) {
this.mEnableTcpFastOpen = jSONObject4.optInt("EnableTcpFastOpen");
}
if (jSONObject4.has("HlsLiveStartIndex")) {
this.mHlsLiveStartIndex = jSONObject4.optInt("HlsLiveStartIndex");
}
if (jSONObject4.has("CmafOptimizeRetry")) {
this.mEnableCmafOptimizeRetry = jSONObject4.optInt("CmafOptimizeRetry");
}
if (jSONObject4.has("EnableFastOpen")) {
this.mEnableFastOpenStream = jSONObject4.optInt("EnableFastOpen");
}
if (jSONObject4.has("EnableLowLatencyFLV")) {
this.mEnableLowLatencyFLV = jSONObject4.optInt("EnableLowLatencyFLV");
String str = "enable low latency:" + this.mEnableLowLatencyFLV;
}
if (jSONObject4.has("EnableSkipFlvNullTag")) {
this.mEnableSkipFlvNullTag = jSONObject4.optInt("EnableSkipFlvNullTag");
String str2 = "enable skip flv null tag:" + this.mEnableSkipFlvNullTag;
}
if (jSONObject4.has("LiveIOConfig") && (optJSONObject = jSONObject4.optJSONObject("LiveIOConfig")) != null) {
if (optJSONObject.has("EnableLiveIO")) {
this.mEnableLiveIOPlay = optJSONObject.optInt("EnableLiveIO");
}
if (optJSONObject.has("EnableP2P")) {
this.mEnableLiveIOP2P = optJSONObject.optInt("EnableP2P");
}
if (optJSONObject.has("EnableHttpPrepare")) {
this.mEnableHttpPrepare = optJSONObject.optInt("EnableHttpPrepare");
}
if (optJSONObject.has("EnableP2pUp")) {
this.mEnableP2pUp = optJSONObject.optInt("EnableP2pUp");
}
if (optJSONObject.has("LiveIOABGroupID")) {
this.mLiveIOABGroupID = optJSONObject.optInt("LiveIOABGroupID");
}
}
if (jSONObject4.has("EnableNTPByApp")) {
int optInt7 = jSONObject4.optInt("EnableNTPByApp");
this.mEnableNTP = optInt7;
com.bykv.vk.component.ttvideo.log.a aVar2 = this.mLogService;
aVar2.y = optInt7;
if (optInt7 == 1 && (iLiveSettingBundle = this.mSettingsBundle) != null) {
aVar2.A = ((Long) iLiveSettingBundle.getSettingsValueForKey("time_diff_server_and_client", 0L)).longValue();
MyLog.d("ntp", "time_diff:" + this.mLogService.A);
}
}
if (jSONObject4.has("NoSyncReportMinDuration")) {
this.mNoSyncReportMinDuration = jSONObject4.optInt("NoSyncReportMinDuration");
}
if (jSONObject4.has("NoSyncReportReportThres")) {
this.mNoSyncReportReportThres = jSONObject4.optInt("NoSyncReportReportThres");
}
} catch (JSONException e2) {
e2.printStackTrace();
}
}
this.mLogService.am = this.mDefaultResBitrate;
}
public void _doRequestSwitchUrlFromServer() {
n nVar;
String b2;
if (TextUtils.isEmpty(this.mCdnSessionPath) || TextUtils.isEmpty(this.mCdnAbrResolution) || this.mCdnAbrResolution.equals(this.mResolution) || (nVar = this.mPlayer) == null || (b2 = nVar.b(335)) == null) {
return;
}
MyLog.i(TAG, "responseHeaders: " + b2);
String str = null;
for (String str2 : b2.split("\r\n")) {
if (str2.startsWith("X-Has-Token: ")) {
str = str2.split(": ", 2)[1];
}
}
try {
JSONObject jSONObject = new JSONObject();
if (!TextUtils.isEmpty(this.mLogService.t)) {
jSONObject.put("live_stream_session_id", this.mLogService.t);
}
String a2 = this.mURLSource.a(this.mCdnAbrResolution, "flv", this.mLevel);
if (TextUtils.isEmpty(a2)) {
return;
}
jSONObject.put("play_url", a2);
if (!TextUtils.isEmpty(str)) {
jSONObject.put("token", str);
}
String substring = a2.substring(a2.indexOf("//") + 2);
String substring2 = substring.substring(substring.indexOf(com.ksdk.ssds.manager.b.b));
if (!this.mCdnSessionPath.startsWith(com.ksdk.ssds.manager.b.b)) {
this.mCdnSessionPath = com.ksdk.ssds.manager.b.b + this.mCdnSessionPath;
}
String str3 = a2.substring(0, a2.indexOf(substring2)) + this.mCdnSessionPath;
MyLog.i(TAG, "sending 'POST' request to URL : " + str3);
MyLog.i(TAG, "httpBody: " + jSONObject);
INetworkClient.Result doPost = this.mNetworkClient.doPost(str3, jSONObject.toString());
if (doPost != null) {
MyLog.i(TAG, "response: " + doPost.response);
MyLog.i(TAG, "code: " + doPost.code);
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
int i2 = doPost.code;
aVar.ba = i2;
if (i2 == 200 && doPost.response.has(COSHttpResponseKey.CODE)) {
this.mLogService.ba = doPost.response.optInt(COSHttpResponseKey.CODE);
if (this.mLogService.ba == 0) {
this.mResolution = this.mCdnAbrResolution;
}
}
}
} catch (Exception e2) {
e2.printStackTrace();
}
}
private void _play(String str) {
l lVar = this.mPrepareState;
if (lVar == l.PREPARED && this.mPlayer != null) {
MyLog.i(TAG, "_play resume");
String str2 = this.mCurrentIP;
if (str2 != null) {
this.mLogService.a(str2, false);
}
this.mPlayer.e();
} else if (lVar == l.IDLE || this.mPlayer == null) {
MyLog.i(TAG, "_play start");
open();
this.mPrepareState = l.INITIALIZED;
if (this.mIsLocalURL && !TextUtils.isEmpty(this.mLocalURL)) {
this.mLogService.f();
prepareToPlay(this.mLocalURL, null, null, null);
}
parsePlayDNS(str);
} else {
configPlayerGlobalOption();
if (this.mIsLocalURL) {
}
parsePlayDNS(str);
}
this.mIsRequestCanceled = false;
}
private void _requestSwitchUrlFromServer() {
this.mLogService.aZ = true;
if ((this.mURLSource.j() != 2 || this.mURLSource.d(this.mLevel)) && !this.mExecutor.isShutdown()) {
this.mExecutor.submit(new Runnable() {
@Override
public void run() {
VideoLiveManager.this._doRequestSwitchUrlFromServer();
}
});
}
}
private void _reset(String str) {
MyLog.i(TAG, "_reset");
_stopPlayer();
_resetPlayer();
_stopLiveManager(str);
this.mResolutionIndex = -1;
this.mLivePlayerState = a.IDLE;
}
public void _resetPlayer() {
MyLog.i(TAG, "_resetPlayer");
n nVar = this.mPlayer;
if (nVar != null) {
nVar.g();
}
this.mPrepareState = l.INITIALIZED;
}
private void _setLooseSync() {
com.bykv.vk.component.ttvideo.model.a aVar = this.mURLSource;
if (aVar == null) {
return;
}
String d2 = aVar.d(this.mResolution, this.mLevel);
if (TextUtils.isEmpty(d2)) {
return;
}
try {
JSONObject jSONObject = new JSONObject(d2);
if (jSONObject.has("ForceDecodeSwitch")) {
this.mForceDecodeSwitch = jSONObject.optInt("ForceDecodeSwitch");
}
if (jSONObject.has("ForceDecodeMsGaps")) {
this.mForceDecodeMsGaps = jSONObject.optInt("ForceDecodeMsGaps");
}
if (jSONObject.has("ForceRenderMsGaps")) {
this.mForceRenderMsGaps = jSONObject.optInt("ForceRenderMsGaps");
}
} catch (JSONException e2) {
e2.printStackTrace();
}
}
private void _setProtocol() {
String a2 = this.mURLSource.a(this.mResolution.equals(v0.c) ? this.mURLSource.a() : this.mResolution, this.mStreamFormat, this.mLevel);
if (a2 != null) {
this.mLogService.b(a2);
if (a2.startsWith(rv.a)) {
this.mTransportProtocol = "tcp";
}
if (a2.startsWith("httpk")) {
this.mTransportProtocol = "kcp";
}
if (a2.startsWith("https")) {
this.mTransportProtocol = "tls";
}
this.mURLProtocol = this.mTransportProtocol;
}
String g2 = this.mURLSource.g(this.mResolution, this.mLevel);
this.mSuggestProtocol = g2;
if (g2 == null) {
this.mSuggestProtocol = SchedulerSupport.NONE;
return;
}
if ((g2.equals("quic") || this.mSuggestProtocol.equals("quicu")) && !this.mQuicEnable) {
try {
com.bykv.vk.component.ttvideo.b.a("ttquic");
this.mQuicEnable = true;
MyLog.i(TAG, "ttquic lib is load success");
this.mLogService.a(1);
} catch (Throwable unused) {
g2 = this.mTransportProtocol;
this.mQuicEnable = false;
MyLog.i(TAG, "ttquic lib is load failed. change default protocol");
this.mLogService.a(0);
}
}
this.mTransportProtocol = g2;
}
private void _setStreamFormat() {
String str;
String str2;
String f2 = this.mURLSource.f(this.mResolution, this.mLevel);
if (f2 != null) {
if (f2.equals("cmaf") && !this.mCmafEnable) {
try {
com.bykv.vk.component.ttvideo.b.a("ttmcmaf");
this.mCmafEnable = true;
MyLog.i(TAG, "cmaf lib is load success");
} catch (Throwable unused) {
this.mURLSource.a(1);
str = this.mStreamFormat;
this.mCmafEnable = false;
str2 = "cmaf lib is load failed. change default format";
MyLog.i(TAG, str2);
this.mStreamFormat = str;
this.mLogService.b(f2, str);
if (!TextUtils.isEmpty(this.mStreamFormat)) {
}
if (TextUtils.isEmpty(this.mStreamFormat)) {
}
}
} else if (f2.equals("lls")) {
this.mEnableRtcPlay = 1;
this.mLogService.aK = 1;
try {
MyLog.i(TAG, "lls load bytertc library");
System.loadLibrary("byteaudio");
System.loadLibrary("bytenn");
System.loadLibrary("bytertc");
MyLog.i(TAG, "lls load bytertc library done");
} catch (Throwable unused2) {
this.mURLSource.a(2);
str = this.mStreamFormat;
this.mEnableRtcPlay = 0;
this.mLogService.aK = 0;
str2 = "bytertc lib is load failed. change default format";
MyLog.i(TAG, str2);
this.mStreamFormat = str;
this.mLogService.b(f2, str);
if (!TextUtils.isEmpty(this.mStreamFormat)) {
_setAvLines();
if (!this.mEnableAvLines.isEmpty()) {
this.mStreamFormat = "avph";
this.mLogService.b("avph", "avph");
}
}
if (TextUtils.isEmpty(this.mStreamFormat)) {
return;
} else {
return;
}
}
}
str = f2;
this.mStreamFormat = str;
this.mLogService.b(f2, str);
} else {
this.mStreamFormat = "flv";
this.mLogService.b(SchedulerSupport.NONE, "flv");
}
if (!TextUtils.isEmpty(this.mStreamFormat) && this.mStreamFormat.equals("flv")) {
_setAvLines();
if (!this.mEnableAvLines.isEmpty() && !this.mVideoOnly.isEmpty() && !this.mAudioOnly.isEmpty() && this.mEnableAvLines.equals(pk2.e) && this.mVideoOnly.equals("only_video=1") && this.mAudioOnly.equals("only_audio=1")) {
this.mStreamFormat = "avph";
this.mLogService.b("avph", "avph");
}
}
if (TextUtils.isEmpty(this.mStreamFormat) || !this.mStreamFormat.equals("avph")) {
return;
}
_configAvphNeqStrategy();
}
private void _smartResolveDefaultResolution(String str) {
char c2;
char c3;
if (this.mAbrStrategy.equals("abr_bb_4live") && this.mEnableResolutionAutoDegrade && !TextUtils.isEmpty(str)) {
String str2 = str;
if (str2.equals("ld")) {
while (!TextUtils.isEmpty(str2)) {
if (TextUtils.isEmpty(this.mURLSource.a(str2, this.mStreamFormat, this.mLevel))) {
str2.hashCode();
switch (str2.hashCode()) {
case -1008619738:
if (str2.equals(s0.a.P)) {
c3 = 0;
break;
}
break;
case 3324:
if (str2.equals("hd")) {
c3 = 1;
break;
}
break;
case 3448:
if (str2.equals("ld")) {
c3 = 2;
break;
}
break;
case 3665:
if (str2.equals("sd")) {
c3 = 3;
break;
}
break;
case 115761:
if (str2.equals("uhd")) {
c3 = 4;
break;
}
break;
}
c3 = 65535;
switch (c3) {
case 0:
default:
str2 = null;
break;
case 1:
str2 = "uhd";
break;
case 2:
str2 = "sd";
break;
case 3:
str2 = "hd";
break;
case 4:
str2 = s0.a.P;
break;
}
}
}
return;
}
while (!TextUtils.isEmpty(str2)) {
if (TextUtils.isEmpty(this.mURLSource.a(str2, this.mStreamFormat, this.mLevel))) {
str2.hashCode();
switch (str2.hashCode()) {
case -1008619738:
if (str2.equals(s0.a.P)) {
c2 = 0;
break;
}
break;
case 3324:
if (str2.equals("hd")) {
c2 = 1;
break;
}
break;
case 3448:
if (str2.equals("ld")) {
c2 = 2;
break;
}
break;
case 3665:
if (str2.equals("sd")) {
c2 = 3;
break;
}
break;
case 115761:
if (str2.equals("uhd")) {
c2 = 4;
break;
}
break;
}
c2 = 65535;
switch (c2) {
case 0:
str2 = "uhd";
break;
case 1:
str2 = "sd";
break;
case 2:
default:
str2 = null;
break;
case 3:
str2 = "ld";
break;
case 4:
str2 = "hd";
break;
}
}
}
if (TextUtils.isEmpty(str2)) {
MyLog.w(TAG, str2 + " not found");
return;
}
return;
this.mURLSource.c(str2);
this.mLogService.aj = this.mURLSource.a();
}
}
private void _stop(boolean z, String str) {
MyLog.i(TAG, "_stop");
a aVar = this.mLivePlayerState;
if (aVar != a.PLAYED && aVar != a.PAUSED) {
this.mLogService.f(str);
this.mListener.onReportALog(6, "illegal call: " + str + " -- " + hashCode());
return;
}
if (z) {
_stopPlayer();
} else {
this.mPrepareState = l.INITIALIZED;
}
_stopLiveManager(str);
this.mLivePlayerState = a.STOPPED;
this.mSupportSRScene = 0;
this.mTextureSRMode = 0;
this.mEnableReportSessionStop = 0;
com.bykv.vk.component.ttvideo.log.a aVar2 = this.mLogService;
aVar2.be = -1;
aVar2.bf = -1.0f;
aVar2.bg = -1.0f;
}
private void _stopLiveManager(String str) {
MyLog.i(TAG, "_stopLiveManager");
com.bykv.vk.component.ttvideo.b.c cVar = this.mFetcher;
if (cVar != null) {
cVar.a();
}
com.bykv.vk.component.ttvideo.b.a aVar = this.mDnsParser;
if (aVar != null) {
aVar.a();
}
a aVar2 = this.mLivePlayerState;
if (aVar2 == a.PLAYED || aVar2 == a.PAUSED) {
onRenderStallForRetryStop();
if (this.mIsStalling) {
this.mLogService.c(0);
}
this.mLogService.a(str);
}
setIntOption(75, 0);
this.mLogService.i();
this.mRetryProcessor.c();
if (str.equals("reset")) {
this.mURLSource.k();
}
this.mShowedFirstFrame = false;
this.mRenderStartEntered = false;
this.mResolutionDisableSR = true;
this.mMediaSupportSR = false;
this.mStallStartTime = 0L;
this.mStallTotalTime = 0L;
this.mStallCount = 0;
this.mIsRequestCanceled = true;
this.mLivePlayerState = a.STOPPED;
this.mHasSeiInfo = false;
this.mGetSeiCurrentTime = 0L;
this.mIsStalling = false;
this.mIsRetrying = false;
this.mHasRetry = false;
this.mSupportBackupIp = true;
this.mUrlSettingMethod = -1;
this.mEnableDTSCheck = 0;
this.mEnablePreventDTSBack = 0;
this.mEnableCheckFrame = 0;
this.mEnterStallRetryInstantly = false;
this.mEnableAvLines = "";
this.mEnableSaveSCFG = false;
this.mStreamFormat = "flv";
this.mTransportProtocol = "tcp";
this.mSuggestProtocol = SchedulerSupport.NONE;
this.mEnableVideoMpdRefresh = 1;
this.mEnableQuicCertVerify = false;
this.mTextureSRMode = 0;
this.mSupportSRScene = 0;
this.mEnableTextureSR = 0;
this.mEnableTextureRender = 0;
this.mQuicVersion = 39;
this.mQuicInitMTU = INIT_MTU;
this.mEnableQuicMTUDiscovery = 0;
this.mQuicInitRtt = 0;
this.mQuicMaxCryptoRetransmissions = 0;
this.mQuicMaxCryptoRetransmissionTimeMs = 0;
this.mQuicMaxRetransmissions = 0;
this.mQuicMaxRetransmissionTimeMs = 0;
this.mQuicMaxAckDelay = 0;
this.mQuicMinReceivedBeforeAckDecimation = 0;
this.mQuicPadHello = 1;
this.mQuicFixWillingAndAbleToWrite = 1;
this.mQuicFixProcessTimer = 1;
this.mQuicReadBlockTimeout = 100;
this.mQuicReadBlockMode = 0;
this.mQuicFixStreamFinAndRst = 0;
this.mQuicConfigOptimize = 0;
this.mEnableCheckDropAudio = 0;
this.mIsPlayWithMdl = false;
this.mAVNoSyncThreshold = 10000;
this.mIsAlwaysDoAVSync = 0;
this.mRedoDns = false;
this.mEnableLiveAbrCheckEnhance = 0;
this.mLiveABRCheckInterval = 1000;
this.mABRMethod = -1;
this.mRtcEnableDtls = 0;
this.mRtcFallbackThreshold = 5000;
this.mRtcMinJitterBuffer = 300;
this.mRtcPlayFallBack = 0;
this.mEnableRtcPlay = 0;
this.mRtcEnableSDKDns = 0;
this.mRtcEarlyInitRender = 0;
this.mEnableFreeFlow = 0;
this.mABRDisableAlgorithm = 0;
this.mTextureRenderFirstFrame = false;
this.mUsePlayerRenderStart = false;
mFastOpenDuration = -1;
this.mMyHandler.removeCallbacksAndMessages(null);
if (this.mEnableStallCounter == 1) {
stopStallCounter();
}
this.mNoSyncReportMinDuration = 5000;
this.mNoSyncReportReportThres = 200;
}
public void _stopPlayer() {
l lVar;
MyLog.i(TAG, "_stopPlayer");
if (this.mPlayer != null && ((lVar = this.mPrepareState) == l.PREPARED || lVar == l.PREPARING)) {
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar != null) {
aVar.o();
this.mLogService.p();
if (this.mEnableCheckFrame == 1 || this.mEnableCheckSEI == 1) {
this.mLogService.w();
}
}
if (this.mLivePlayerState != a.PAUSED) {
this.mPlayer.h();
} else {
this.mPlayer.g();
}
}
if (this.mIsPlayWithMdl && this.mSessionId != null) {
com.bykv.vk.component.ttvideo.a.c.a().a(8018, this.mSessionId, 0);
}
this.mPrepareState = l.INITIALIZED;
MyLog.i(TAG, "prepareState: " + this.mPrepareState);
}
public boolean abrDegradeResolution() {
String a2;
int length = com.bykv.vk.component.ttvideo.c.a.length - 1;
while (true) {
if (length < 0) {
length = -1;
break;
}
if (this.mURLSource.b(com.bykv.vk.component.ttvideo.c.a[length])) {
break;
}
length--;
}
if (length == -1) {
return false;
}
StringBuilder sb = new StringBuilder();
sb.append("abrDegradeResolution, resolution: ");
String[] strArr = com.bykv.vk.component.ttvideo.c.a;
sb.append(strArr[length]);
sb.append(", auto defalut resolution: ");
sb.append(this.mURLSource.a());
MyLog.i(TAG, sb.toString());
if (this.mURLSource.a().equals(strArr[length]) || (a2 = this.mURLSource.a(strArr[length], this.mStreamFormat, ce.e)) == null) {
return false;
}
String str = this.mCurrentPlayURL;
this.mCurrentPlayURL = a2;
this.mResolutionIndex = length;
this.mURLSource.c(strArr[length]);
this.mLogService.aj = strArr[length];
saveCurrentResolution();
this.mLogService.a(str, this.mCurrentPlayURL, "auto_" + this.mLogService.ak + "_to_" + this.mResolution, LiveError.PLAYER_STALL);
this.mLogService.c(this.mCurrentPlayURL);
this.mLevel = ce.e;
this.mStallCount = 0;
parsePlayDNS(a2);
return true;
}
static int access$4408(VideoLiveManager videoLiveManager) {
int i2 = videoLiveManager.mStallCount;
videoLiveManager.mStallCount = i2 + 1;
return i2;
}
private void addRtcCodecInfo(String str) {
com.bykv.vk.component.ttvideo.log.a aVar;
String str2;
if (TextUtils.isEmpty(str)) {
return;
}
if (TextUtils.isEmpty(this.mLogService.e) || "none_codec".equals(this.mLogService.e)) {
try {
JSONObject jSONObject = new JSONObject(str);
if (jSONObject.has("video_codec_impl_name")) {
String optString = jSONObject.optString("video_codec_impl_name");
if (!TextUtils.isEmpty(optString)) {
if ("MediaCodec".equals(optString)) {
com.bykv.vk.component.ttvideo.log.a aVar2 = this.mLogService;
aVar2.e = "hardware_codec";
aVar2.d = true;
} else {
com.bykv.vk.component.ttvideo.log.a aVar3 = this.mLogService;
aVar3.e = "software_codec";
aVar3.d = false;
}
}
}
if (jSONObject.has("video_codec_name")) {
String optString2 = jSONObject.optString("video_codec_name");
if (!TextUtils.isEmpty(optString2)) {
if ("ByteVC1".equalsIgnoreCase(optString2)) {
aVar = this.mLogService;
str2 = "bytevc1";
} else {
aVar = this.mLogService;
str2 = "h264";
}
aVar.c = str2;
}
}
MyLog.i(TAG, "addRtcCodecInfo mCodecName:" + this.mLogService.e + ", mCodecType:" + this.mLogService.c + ",mHardDecodeEnable:" + this.mLogService.d);
} catch (Exception unused) {
}
}
}
private String addSessionIdToURL(String str, long j2) {
if (TextUtils.isEmpty(str) || TextUtils.isEmpty(this.mUuid)) {
return null;
}
String str2 = this.mUuid + "." + j2;
this.mLogService.t = str2;
return !str.contains("_session_id") ? _addParamToURL(str, "_session_id", str2) : str;
}
public boolean bytevc1DegradeH264(int i2) {
String str;
if (this.mURLAbility != 2 || (str = this.mURLSource.e("h264").mainURL) == null) {
return false;
}
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
this.mLogService.c(str);
this.mLogService.a(this.mCurrentPlayURL, str, "bytevc1_to_h264", i2);
this.mCurrentPlayURL = str;
this.mURLAbility = 1;
this.mLogService.N = "h264";
if (this.mHardwareDecodeEnable != 1 && this.mEnableH264HardwareDecode == 1) {
this.mHardwareDecodeEnable = 1;
this.mDefaultCodecId = 0;
this.mPlayer.a(59, 1);
this.mLogService.c(this.mHardwareDecodeEnable == 1);
}
_resetPlayer();
this.mSessionStartTime = System.currentTimeMillis();
parsePlayDNS(str);
return true;
}
private void checkMainLooper(String str) {
com.bykv.vk.component.ttvideo.log.a aVar;
if (this.mIsInMainLooper != 1 || Looper.myLooper() == Looper.getMainLooper() || (aVar = this.mLogService) == null) {
return;
}
aVar.g(str);
}
public static void closeDataLoader() {
com.bykv.vk.component.ttvideo.a.c.a().d();
}
private void configPlayerEventHandler() {
this.mPlayer.a(new g(this));
this.mPlayer.a(new c(this));
this.mPlayer.a(new d(this));
this.mPlayer.a(new b(this));
this.mPlayer.a(new f(this));
}
private void configPlayerGlobalOption() {
LiveURL h2;
Integer num;
Integer num2;
n nVar;
n nVar2;
boolean z;
int i2;
this.mPlayer.a(9, this.mNetworkTimeout * 1000000);
this.mPlayer.a(83, this.mTestAction);
this.mPlayer.a(37, this.mEnhancementType);
this.mPlayer.a(38, this.mScaleType);
StringBuilder sb = new StringBuilder();
this.mPlayer.a(325, 0);
this.mPlayer.a(36, this.mLayoutType);
this.mPlayer.a(110, 5000);
this.mPlayer.a(64, 0);
this.mPlayer.a(94, 1);
this.mPlayer.a(56, this.mRenderType);
_configLiveSettingBundle();
_configWithSDKParams();
configToBParams();
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
int i3 = this.mEnableFastOpenStream;
aVar.T = i3;
this.mPlayer.a(220, i3);
this.mPlayer.a(56, this.mRenderType);
this.mPlayer.a(340, this.mEnableCheckDropAudio);
this.mPlayer.a(52, this.mEnableUploadSei);
if (this.mEnableDTSCheck == 1 || this.mEnableCheckFrame == 1 || this.mEnableCheckSEI == 1) {
this.mPlayer.a(640, 1);
}
this.mPlayer.a(641, 1);
if (this.mEnableClosePlayRetry == 1) {
this.mPlayer.a(197, 0);
this.mPlayer.a(82, 0);
}
com.bykv.vk.component.ttvideo.log.a aVar2 = this.mLogService;
aVar2.ah = this.mHasAbrInfo;
aVar2.ag = this.mAbrStrategy;
aVar2.af = this.mEnableResolutionAutoDegrade;
aVar2.au = this.mStallCountThresOfResolutionDegrade;
long j2 = this.mStallRetryTimeIntervalManager;
aVar2.w = j2;
this.mRetryProcessor.a(j2);
int i4 = this.mEnableSharp;
if (i4 == 1) {
this.mPlayer.a(189, i4);
com.bykv.vk.component.ttvideo.log.a aVar3 = this.mLogService;
if (aVar3 != null) {
aVar3.k();
}
}
String str = null;
if (this.mURLSource.j() == 2) {
str = this.mURLSource.c(this.mResolution, this.mLevel);
} else if (this.mURLSource.j() == 1 && (h2 = this.mURLSource.h()) != null) {
str = h2.getVCodec();
}
if (str != null) {
if (str.equals("h264")) {
this.mHardwareDecodeEnable = this.mEnableH264HardwareDecode;
this.mDefaultCodecId = 0;
} else if (str.equals("bytevc1")) {
this.mHardwareDecodeEnable = this.mEnableByteVC1HardwareDecode;
this.mDefaultCodecId = 1;
} else {
this.mHardwareDecodeEnable = 0;
}
this.mLogService.N = str;
} else {
this.mHardwareDecodeEnable = 0;
}
this.mHardwareDecodeEnable = 1;
this.mEnableMediaCodecASYNCInit = 1;
this.mPlayer.a(e50.T0, this.mEnableRtcPlay);
if (this.mEnableRtcPlay == 1) {
MyLog.i(TAG, "rtc close hardware decode");
this.mPlayer.a(59, 0);
this.mPlayer.a(181, 0);
int i5 = (this.mHardwareRTCDecodeEnable == 1 && this.mHardwareDecodeEnable == 1) ? 1 : 0;
MyLog.i(TAG, "rts decode mHardwareDecodeEnable:" + this.mHardwareDecodeEnable + ", mHardwareRTCDecodeEnable: " + this.mHardwareRTCDecodeEnable);
StringBuilder sb2 = new StringBuilder();
sb2.append("rts decode hardware decode ");
sb2.append(i5 == 1 ? "True" : "False");
MyLog.i(TAG, sb2.toString());
this.mPlayer.a(880, i5);
} else {
this.mPlayer.a(59, this.mHardwareDecodeEnable);
this.mLogService.c(this.mHardwareDecodeEnable == 1);
if (this.mHardwareDecodeEnable == 1) {
MyLog.i(TAG, "enable hardware decode");
if (this.mDefaultCodecId != -1) {
MyLog.i(TAG, "fsllog set hardware async init");
this.mPlayer.a(181, this.mEnableMediaCodecASYNCInit);
this.mPlayer.a(182, this.mDefaultCodecId);
com.bykv.vk.component.ttvideo.log.a aVar4 = this.mLogService;
aVar4.L = this.mEnableMediaCodecASYNCInit;
aVar4.M = this.mDefaultCodecId;
}
}
this.mPlayer.a(97, this.mHardwareDecodeEnable);
this.mPlayer.a(536, 500000);
}
int i6 = this.mByteVC1DecoderType;
if (i6 != -1 && this.mEnableByteVC1HardwareDecode != 1) {
this.mPlayer.a(67, i6);
}
int i7 = this.mBufferTimeout;
if (i7 != -1) {
this.mPlayer.a(81, i7);
}
float f2 = this.mCatchSpeed;
if (f2 > 0.0f) {
this.mPlayer.a(80, f2);
this.mLogService.h = this.mCatchSpeed;
}
if (this.mCacheFileEnable == -1 && this.mCacheFilePath != null) {
String str2 = System.currentTimeMillis() + "";
this.mCacheFileKey = str2;
this.mPlayer.a(17, str2);
this.mPlayer.a(14, 1);
this.mPlayer.a(this.mCacheFilePath, 1);
}
int i8 = this.mHurryType;
if (i8 != -1) {
this.mPlayer.a(84, i8);
this.mLogService.f = true;
}
if (this.mHurryType == 0 && (i2 = this.mHurryTime) != 0) {
this.mPlayer.a(15, i2);
this.mLogService.g = this.mHurryTime;
}
if (this.mIsLocalURL && !TextUtils.isEmpty(this.mLocalURL) && (z = this.mLooping)) {
this.mPlayer.a(z);
}
int i9 = this.mBufferDataSeconds;
if (i9 != -1) {
this.mPlayer.a(86, i9);
}
int i10 = this.mSlowPlayTime;
if (i10 != -1) {
this.mPlayer.a(190, i10);
this.mLogService.i = this.mSlowPlayTime;
}
float f3 = this.mSlowPlaySpeed;
if (f3 > 0.0f) {
this.mPlayer.a(191, f3);
this.mLogService.j = this.mSlowPlaySpeed;
}
int i11 = this.mMaxCacheSeconds;
if (i11 != -1) {
this.mPlayer.a(24, i11);
this.mPlayer.a(198, this.mMaxCacheSeconds);
this.mLogService.P = this.mMaxCacheSeconds;
}
int i12 = this.mEnableSplitStream;
if (i12 != 0) {
this.mPlayer.a(87, i12);
this.mLogService.Q = this.mEnableSplitStream;
}
long j3 = this.mStartPlayBufferThres;
if (j3 > 0) {
this.mPlayer.b(309, j3);
this.mLogService.m = this.mStartPlayBufferThres;
}
int i13 = this.mCheckBufferingEndIgnoreVideo;
if (i13 == 1) {
this.mPlayer.a(310, i13);
this.mLogService.o = this.mCheckBufferingEndIgnoreVideo;
}
int i14 = this.mStartDirectAfterPrepared;
if (i14 == 1) {
this.mPlayer.a(311, i14);
this.mLogService.p = this.mStartDirectAfterPrepared;
}
int i15 = this.mCheckBufferingEndAdvanceEnable;
if (i15 == 1) {
this.mPlayer.a(313, i15);
this.mLogService.q = this.mCheckBufferingEndAdvanceEnable;
}
int i16 = this.mOpenCheckSideData;
if (i16 == 1) {
this.mPlayer.a(132, i16);
}
int i17 = this.mAudioTimescaleEnable;
if (i17 != -1) {
this.mPlayer.a(460, i17);
this.mLogService.r = this.mAudioTimescaleEnable;
}
com.bykv.vk.component.ttvideo.log.a aVar5 = this.mLogService;
aVar5.O = this.mEnableUploadSessionSeries;
if (this.mEnableNTPTask == 1) {
aVar5.j();
}
if (this.mEnableOpenMDL == 1) {
this.mLogService.B = (int) com.bykv.vk.component.ttvideo.a.c.a().a(8100);
this.mLogService.C = (int) com.bykv.vk.component.ttvideo.a.c.a().a(8101);
this.mLogService.G = com.bykv.vk.component.ttvideo.a.c.a().b(11);
num = 0;
this.mLogService.H = (int) com.bykv.vk.component.ttvideo.a.c.a().a(8102);
com.bykv.vk.component.ttvideo.a.c.a().a(new e(this));
if (!this.mIsMdlProtoRegister && com.bykv.vk.component.ttvideo.a.c.a().a(8102) == 1) {
long a2 = com.bykv.vk.component.ttvideo.a.c.a().a(7218);
if (a2 != -1) {
this.mIsMdlProtoRegister = this.mPlayer.b(DownloadTaskBrowser.MIN_JS_DEALY, a2) == 0;
}
MyLog.i(TAG, "get mdl proto ret:" + a2 + ", register ret:" + this.mIsMdlProtoRegister);
}
} else {
num = 0;
}
this.mEnableOpenLiveIO = 0;
this.mEnableLiveIOPlay = 0;
this.mEnableRtcPlay = 0;
long j4 = this.mALogWriteAddr;
if (j4 != -1) {
this.mPlayer.b(231, j4);
this.mPlayer.a(223, 1);
}
String str3 = this.mStreamFormat;
if (str3 != null) {
this.mPlayer.a(315, str3);
}
String str4 = this.mStreamFormat;
if (str4 != null && str4.equals("avph")) {
prepareAvphPlay();
}
this.mPlayer.a(347, this.mAVNoSyncThreshold);
this.mPlayer.a(348, this.mIsAlwaysDoAVSync);
this.mPlayer.a(323, this.mEnableRenderStall);
if (this.mEnableRenderStall == 1) {
this.mPlayer.a(321, mAudioRenderStallThreshold);
this.mPlayer.a(322, mVideoRenderStallThreshold);
}
this.mPlayer.a(360, this.mEnableDemuxerStall);
this.mPlayer.a(461, this.mNoSyncReportReportThres);
if (this.mEnableDemuxerStall == 1) {
this.mPlayer.a(362, mDemuxerStallThreshold);
this.mPlayer.b(364, -1L);
this.mPlayer.b(365, -1L);
}
this.mPlayer.a(361, this.mEnableDecoderStall);
if (this.mEnableDecoderStall == 1) {
this.mPlayer.a(363, mDecoderStallThreshold);
this.mPlayer.b(366, -1L);
this.mPlayer.b(367, -1L);
}
this.mPlayer.a(380, this.mEnableStallCounter);
int i18 = this.mEnableTcpFastOpen;
if (i18 == 1 && (nVar2 = this.mPlayer) != null) {
this.mLogService.aG = i18;
nVar2.a(316, i18);
sb.append("live_enable_tcp_fast_open:1,");
}
n nVar3 = this.mPlayer;
if (nVar3 != null) {
int i19 = this.mEnableCmafFastMode;
if (i19 == 1) {
nVar3.a(hh.DOWNLOAD_FILE_CANCEL_FAIL_CODE, i19);
sb.append("live_enable_cmaf_fast_mode:1 ");
}
this.mPlayer.a(680, this.mEnableCmafOptimizeRetry);
}
n nVar4 = this.mPlayer;
if (nVar4 != null) {
nVar4.a(642, this.mEnableVideoMpdRefresh);
}
int i20 = this.mEnableCheckPacketCorrupt;
if (i20 == 1 && (nVar = this.mPlayer) != null) {
nVar.a(317, i20);
sb.append("live_enable_check_packet_corrupt:1,");
}
if (this.mEnableResolutionAutoDegrade && this.mURLSource.j() == 2 && this.mAbrStrategy.equals("abr_bb_4live") && this.mABRDisableAlgorithm == 1) {
this.mPlayer.a(651, 1);
}
if (this.mEnableFlvABR == 1) {
sb.append("live_enable_flv_abr:1,");
}
if (this.mEnableOptimizeBackup == 1) {
sb.append("live_enable_optimize_backup:1,");
}
sb.append(this.mEnableStallRetryInstantly == 1 ? "live_enable_stall_retry_instantly:1 " : "live_enable_stall_retry_instantly:0 ");
if (this.mEnableCacheSei == 1) {
sb.append("live_enable_sei_pts_sync:1 ");
this.mPlayer.a(368, 1);
this.mPlayer.a(369, 1000);
}
if (this.mEnableDecodeMultiSei == 1) {
sb.append("live_enable_decode_multi_sei:1 ");
this.mPlayer.a(372, 1);
}
if (this.mEnableDecodeSeiOnce == 1) {
sb.append("live_enable_decode_sei_once:1 ");
this.mPlayer.a(648, 1);
}
ILiveSettingBundle iLiveSettingBundle = this.mSettingsBundle;
if (iLiveSettingBundle != null) {
num2 = num;
sb.append(((Integer) iLiveSettingBundle.getSettingsValueForKey("live_sdk_super_resolution_enable", num2)).intValue() == 1 ? "live_sdk_super_resolution_enable:1 " : "live_sdk_super_resolution_enable:0 ");
} else {
num2 = num;
}
sb.append(this.mEnableTextureRender == 1 ? "live_sdk_texture_render_enable:1 " : "live_sdk_texture_render_enable:0 ");
ILiveSettingBundle iLiveSettingBundle2 = this.mSettingsBundle;
if (iLiveSettingBundle2 != null) {
sb.append(((Integer) iLiveSettingBundle2.getSettingsValueForKey("live_sdk_sharpen_enable", num2)).intValue() == 1 ? "live_sdk_sharpen_enable:1 " : "live_sdk_sharpen_enable:0 ");
}
if (this.mEnableOpenLiveIO == 1) {
sb.append("live_sdk_enable_liveio:1 ");
}
if (this.mEnableAudioVolumeBalance == 1) {
sb.append("live_sdk_audio_volume_balance_enable:1 ");
if (this.mAudioVolumeBalancePregain != -1.0f) {
sb.append("live_sdk_audio_volume_balance_pregain:" + this.mAudioVolumeBalancePregain + " ");
}
if (this.mAudioVolumeBalanceThreshold != -1.0f) {
sb.append("live_sdk_audio_volume_balance_threshold:" + this.mAudioVolumeBalanceThreshold + " ");
}
if (this.mAudioVolumeBalanceRatio != -1.0f) {
sb.append("live_sdk_audio_volume_balance_ratio:" + this.mAudioVolumeBalanceRatio + " ");
}
if (this.mAudioVolumeBalancePredelay != -1.0f) {
sb.append("live_sdk_audio_volume_balance_predelay:" + this.mAudioVolumeBalancePredelay + " ");
}
}
if (this.mEnableNotifySeiImmediatelyBeforeFirstFrame == 1) {
sb.append("live_sdk_notifysei_immediately_before_firstframe:1 ");
this.mPlayer.a(649, 1);
}
if (this.mEnableRadioLiveDisableRender == 1) {
sb.append("live_sdk_enable_radiolive_disable_render:1 ");
}
if (this.mLogService.x != null) {
sb.append("live_sdk_ntp_server_name:" + this.mLogService.x + " ");
}
if (this.mEnableReportSessionStop == 1) {
sb.append("live_sdk_should_report_session_stop:1 ");
this.mLogService.bk = 1;
}
if (this.mUsePlayerRenderStart) {
sb.append("live_sdk_texturerender_use_player_renderstart:1 ");
}
if (this.mEnableFreeFlow == 1) {
sb.append("live_sdk_isfreeflow:1 ");
}
if (this.mEnableDroppingDTSRollFrame == 1) {
sb.append("live_sdk_dropping_dts_rollback_frame_enabled:1 ");
this.mPlayer.a(148, this.mEnableDroppingDTSRollFrame);
}
if (this.mEnableUseLiveThreadPool == 1) {
sb.append("live_sdk_enable_use_live_threadpool:1 ");
}
com.bykv.vk.component.ttvideo.log.a aVar6 = this.mLogService;
aVar6.U = this.mIsInMainLooper;
aVar6.ad = sb.length() == 0 ? SchedulerSupport.NONE : sb.deleteCharAt(sb.length() - 1).toString();
if (!TextUtils.isEmpty(this.mStreamFormat) && (this.mStreamFormat.equals("hls") || this.mStreamFormat.equals("tsl"))) {
this.mPlayer.a(y91.k, this.mHlsLiveStartIndex);
}
com.bykv.vk.component.ttvideo.log.a aVar7 = this.mLogService;
aVar7.aH = this.mEnableLowLatencyFLV;
aVar7.n = mFastOpenDuration;
}
private void configPlayerInstanceOption() {
String str;
this.mLogService.c(this.mSuggestProtocol, this.mTransportProtocol);
this.mLogService.l(this.mURLSource.d(this.mResolution, this.mLevel));
n nVar = this.mPlayer;
if (nVar != null && (str = this.mStreamFormat) != null) {
nVar.a(315, str);
}
n nVar2 = this.mPlayer;
if (nVar2 == null || this.mEnableAudioVolumeBalance != 1) {
return;
}
nVar2.a(NativeExpressAD2CallbackExt.EVENT_VIDEO_PAGE_CLOSE, 1);
float f2 = this.mAudioVolumeBalancePregain;
if (f2 != -1.0f) {
this.mPlayer.a(NativeExpressAD2CallbackExt.EVENT_LEFT_APPLICATION, f2);
}
float f3 = this.mAudioVolumeBalanceThreshold;
if (f3 != -1.0f) {
this.mPlayer.a(NativeExpressAD2CallbackExt.EVENT_OPEN_OVERLAY, f3);
}
float f4 = this.mAudioVolumeBalanceRatio;
if (f4 != -1.0f) {
this.mPlayer.a(NativeExpressAD2CallbackExt.EVENT_CLOSE_OVERLAY, f4);
}
float f5 = this.mAudioVolumeBalancePredelay;
if (f5 != -1.0f) {
this.mPlayer.a(306, f5);
}
}
private void configToBParams() {
n nVar;
if (this.mSwitchToB != 1 || (nVar = this.mPlayer) == null) {
return;
}
nVar.a(509, this.mMoudleIDToB);
}
public String convertCodecName(int i2) {
switch (i2) {
case 1:
return "IOSHWCodec";
case 2:
return "hardware_codec";
case 3:
return "ff_H264_codec";
case 4:
return "ff_ByteVC1_codec";
case 5:
return "KS_ByteVC1_codec";
case 6:
return "JX_ByteVC1_codec";
default:
return "none_codec";
}
}
public static boolean dataLoaderIsRunning() {
return com.bykv.vk.component.ttvideo.a.c.a().e();
}
public boolean degradeResolution() {
String[] strArr;
String a2;
if (this.mResolution == "ld") {
return false;
}
if (this.mResolutionIndex == -1) {
int i2 = 0;
while (true) {
String[] strArr2 = com.bykv.vk.component.ttvideo.c.a;
if (i2 >= strArr2.length) {
break;
}
if (strArr2[i2].equals(this.mResolution)) {
this.mResolutionIndex = i2;
break;
}
i2++;
}
}
int i3 = this.mResolutionIndex + 1;
while (true) {
strArr = com.bykv.vk.component.ttvideo.c.a;
if (i3 >= strArr.length || this.mURLSource.b(strArr[i3])) {
break;
}
i3++;
}
if (i3 >= strArr.length || (a2 = this.mURLSource.a(strArr[i3], this.mStreamFormat, this.mLevel)) == null) {
return false;
}
String str = this.mCurrentPlayURL;
this.mCurrentPlayURL = a2;
this.mResolutionIndex = i3;
saveCurrentResolution();
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
String str2 = strArr[i3];
this.mResolution = str2;
aVar.ai = str2;
aVar.a(str, this.mCurrentPlayURL, "auto_" + this.mLogService.ak + "_to_" + this.mResolution, LiveError.PLAYER_STALL);
ILiveListener iLiveListener = this.mListener;
if (iLiveListener != null) {
iLiveListener.onResolutionDegrade(this.mResolution);
}
this.mLogService.c(this.mCurrentPlayURL);
this.mStallCount = 0;
parsePlayDNS(a2);
return true;
}
public static void enableLoadLibrary() {
com.bykv.vk.component.ttvideo.a.c.a().b();
}
private JSONObject extractAvphStreamInfo(String str) {
String str2;
String str3;
String str4;
String str5;
String str6;
String str7;
String str8;
String str9 = "audio_find_stream_info_cost";
String str10 = "audio_open_input_cost";
String str11 = "av_dts_diff";
String str12 = "audio_cur_dts";
String str13 = "video_last_dts";
if (TextUtils.isEmpty(str)) {
return null;
}
JSONObject jSONObject = new JSONObject();
try {
String str14 = "video_find_stream_info_cost";
String[] split = str.split(bf0.COMMA);
int length = split.length;
String str15 = "video_open_input_cost";
int i2 = 0;
while (i2 < length) {
int i3 = length;
String str16 = split[i2];
String[] strArr = split;
if (str16.startsWith("video_key")) {
jSONObject.put("video_key", Integer.parseInt(str16.substring(10)));
} else if (str16.startsWith(str13)) {
jSONObject.put(str13, Integer.parseInt(str16.substring(15)));
} else {
str2 = str13;
if (str16.startsWith("video_cur_dts")) {
jSONObject.put("video_cur_dts", Integer.parseInt(str16.substring(14)));
} else if (str16.startsWith("vv_dts_diff")) {
jSONObject.put("vv_dts_diff", Integer.parseInt(str16.substring(12)));
} else if (str16.startsWith(str12)) {
jSONObject.put(str12, Integer.parseInt(str16.substring(14)));
} else if (str16.startsWith(str11)) {
jSONObject.put(str11, Integer.parseInt(str16.substring(12)));
} else {
if (str16.startsWith("audio_first_pkt_ts")) {
str3 = str11;
str4 = str12;
jSONObject.put("audio_first_pkt_ts", Long.parseLong(str16.substring(19)));
} else {
str3 = str11;
str4 = str12;
if (str16.startsWith("audio_first_pkt_dts")) {
jSONObject.put("audio_first_pkt_dts", Long.parseLong(str16.substring(20)));
} else if (str16.startsWith("video_first_pkt_ts")) {
jSONObject.put("video_first_pkt_ts", Long.parseLong(str16.substring(19)));
} else if (str16.startsWith("video_first_pkt_dts")) {
jSONObject.put("video_first_pkt_dts", Long.parseLong(str16.substring(20)));
} else if (str16.startsWith(str10)) {
jSONObject.put(str10, Long.parseLong(str16.substring(22)));
} else if (str16.startsWith(str9)) {
jSONObject.put(str9, Long.parseLong(str16.substring(28)));
} else {
str5 = str15;
if (str16.startsWith(str5)) {
jSONObject.put(str5, Long.parseLong(str16.substring(22)));
str7 = str9;
str8 = str10;
str6 = str14;
} else {
str6 = str14;
if (str16.startsWith(str6)) {
String substring = str16.substring(28);
str7 = str9;
str8 = str10;
jSONObject.put(str6, Long.parseLong(substring));
} else {
str7 = str9;
str8 = str10;
}
}
i2++;
str15 = str5;
str14 = str6;
str9 = str7;
str10 = str8;
length = i3;
str13 = str2;
str11 = str3;
str12 = str4;
split = strArr;
}
}
str7 = str9;
str8 = str10;
str6 = str14;
str5 = str15;
i2++;
str15 = str5;
str14 = str6;
str9 = str7;
str10 = str8;
length = i3;
str13 = str2;
str11 = str3;
str12 = str4;
split = strArr;
}
str7 = str9;
str8 = str10;
str3 = str11;
str4 = str12;
str6 = str14;
str5 = str15;
i2++;
str15 = str5;
str14 = str6;
str9 = str7;
str10 = str8;
length = i3;
str13 = str2;
str11 = str3;
str12 = str4;
split = strArr;
}
str8 = str10;
str3 = str11;
str4 = str12;
str2 = str13;
str6 = str14;
str5 = str15;
str7 = str9;
i2++;
str15 = str5;
str14 = str6;
str9 = str7;
str10 = str8;
length = i3;
str13 = str2;
str11 = str3;
str12 = str4;
split = strArr;
}
return jSONObject;
} catch (JSONException e2) {
e2.printStackTrace();
return null;
} catch (Exception e3) {
e3.printStackTrace();
return null;
}
}
private JSONArray formatABRStreamInfoToJSONArray(String str) {
if (str == null) {
return null;
}
try {
ArrayList arrayList = new ArrayList();
while (true) {
JSONObject jSONObject = new JSONObject();
int indexOf = str.indexOf("index:");
int indexOf2 = str.indexOf(",pts_diff:");
if (indexOf < 0 || indexOf2 < 0 || indexOf >= indexOf2) {
break;
}
jSONObject.put("index", Integer.parseInt(str.substring(indexOf + 6, indexOf2)));
String substring = str.substring(indexOf2);
int indexOf3 = substring.indexOf(",drop_dur:");
if (indexOf3 < 0 || 10 >= indexOf3) {
break;
}
jSONObject.put("pts_diff", Long.parseLong(substring.substring(10, indexOf3)));
String substring2 = substring.substring(indexOf3);
int indexOf4 = substring2.indexOf(",key:");
if (indexOf4 < 0 || 10 >= indexOf4) {
break;
}
jSONObject.put("drop_dur", Long.parseLong(substring2.substring(10, indexOf4)));
String substring3 = substring2.substring(indexOf4);
int indexOf5 = substring3.indexOf(",index:");
if (indexOf5 == -1) {
if (substring3.length() != 0) {
String substring4 = substring3.substring(5);
jSONObject.put("key_frame", Integer.parseInt(substring4));
arrayList.add(jSONObject);
String str2 = "key: " + substring4;
}
} else {
if (5 >= indexOf5) {
break;
}
jSONObject.put("key_frame", Integer.parseInt(substring3.substring(5, indexOf5)));
arrayList.add(jSONObject);
str = substring3.substring(indexOf5 + 1);
}
}
return new JSONArray((Collection) arrayList);
} catch (JSONException e2) {
e2.printStackTrace();
return null;
}
}
private JSONArray formatAVPHStreamInfoToJSONArray(String str) {
if (TextUtils.isEmpty(str)) {
return null;
}
ArrayList arrayList = new ArrayList();
if (str.contains(x1.b)) {
for (String str2 : str.split(x1.b)) {
JSONObject extractAvphStreamInfo = extractAvphStreamInfo(str2);
if (extractAvphStreamInfo != null) {
arrayList.add(extractAvphStreamInfo);
}
}
} else {
JSONObject extractAvphStreamInfo2 = extractAvphStreamInfo(str);
if (extractAvphStreamInfo2 != null) {
arrayList.add(extractAvphStreamInfo2);
}
}
return new JSONArray((Collection) arrayList);
}
public static Builder newBuilder(Context context) {
return new Builder(context);
}
private void open() {
com.bykv.vk.component.ttvideo.log.a aVar;
String a2;
r.b(1, this.mPlayerType != 0);
r.b(2, this.mPlayerType == 2);
r.b(6, false);
r.b(11, true);
n nVar = this.mPlayer;
if (nVar != null) {
if (nVar.a() ^ (this.mPlayerType == 0)) {
this.mPlayer.d();
this.mPlayer = null;
}
}
if (this.mPlayer == null) {
this.mPlayer = com.bykv.vk.component.ttvideo.c.a.a(this.mContext, this.mPlayerDegradeMode);
com.bykv.vk.component.ttvideo.a.c.a().a(this.mPlayer);
if (this.mPlayer.b() != 1 && this.mPlayer.b() != 2) {
this.mHardwareDecodeEnable = 0;
this.mEnableH264HardwareDecode = 0;
this.mEnableByteVC1HardwareDecode = 0;
}
configPlayerGlobalOption();
configPlayerEventHandler();
}
if (this.mPlayer.a()) {
aVar = this.mLogService;
a2 = "-1";
} else {
aVar = this.mLogService;
a2 = r.a(14, "0");
}
aVar.i(a2);
this.mDnsParser.a(this.mForceHttpDns, this.mHttpDNSServerHost);
if (this.mFetcher == null) {
this.mFetcher = new com.bykv.vk.component.ttvideo.b.c(this.mExecutor, this.mNetworkClient);
}
this.mPlayerSetting.a(this.mPlayer);
}
private String packAvphHeader(String str, String str2, String str3) {
if (!str.equals("")) {
str = str + h1.b;
}
return ((str + str2) + "=") + str3;
}
public void parsePlayDNS(final String str) {
String str2;
MyLog.i(TAG, "parsePlayDNS");
char c2 = 2;
if (str == null || str.length() == 0) {
if (this.mURLSource.j() == 1 && bytevc1DegradeH264(LiveError.BYTEVC1_URL_IS_NULL)) {
return;
}
if (this.mEnableSwitchMainAndBackupUrl && this.mURLSource.j() == 2 && switchMainAndBackupUrl(-100002)) {
return;
}
HashMap hashMap = new HashMap();
hashMap.put("url", "try out all urls");
this.mRetryProcessor.a(new LiveError(-100002, "try out all urls", hashMap), this.mShowedFirstFrame);
return;
}
String b2 = this.mURLSource.b(this.mStreamFormat, this.mLevel, this.mTransportProtocol);
if (!str.startsWith("rtmp") && b2 == null) {
String str3 = this.mTransportProtocol;
str3.hashCode();
switch (str3.hashCode()) {
case 106008:
if (str3.equals("kcp")) {
c2 = 0;
break;
}
c2 = 65535;
break;
case 114657:
if (str3.equals("tcp")) {
c2 = 1;
break;
}
c2 = 65535;
break;
case 114939:
break;
case 3482174:
if (str3.equals("quic")) {
c2 = 3;
break;
}
c2 = 65535;
break;
case 107947511:
if (str3.equals("quicu")) {
c2 = 4;
break;
}
c2 = 65535;
break;
default:
c2 = 65535;
break;
}
switch (c2) {
case 0:
b2 = "8848";
break;
case 1:
case 3:
case 4:
b2 = "80";
break;
case 2:
b2 = "443";
break;
}
}
if (this.mEnableRtcPlay == 0 || this.mRtcPlayFallBack == 1) {
str = set_url_port_scheme(str, b2);
this.mURLSource.i(this.mTransportProtocol, b2);
}
String str4 = this.mStreamFormat;
if (str4 == null || !str4.equals("avph")) {
if (!this.mEnableAvLines.equals(pk2.e) || !this.mVideoOnly.equals("only_video=1") || this.mAudioOnly.equals("only_audio=1")) {
str2 = (this.mEnableAvLines.equals(pk2.e) && !this.mVideoOnly.equals("only_video=1") && this.mAudioOnly.equals("only_audio=1")) ? "only_audio" : "only_video";
}
str = _addParamToURL(str, str2, "1");
} else {
prepareAvphPlay();
}
this.mLogService.a(SchedulerSupport.NONE, false);
this.mCurrentPlayURL = str;
final String a2 = com.bykv.vk.component.ttvideo.b.a.a(str);
if (!com.bykv.vk.component.ttvideo.b.a.b(a2) && this.mEnableDns && a2 != null) {
this.mRetryProcessor.a(a2);
this.mDnsParser.a(a2, new a.InterfaceC0807a() {
@Override
public void a(String str5, final String str6, final LiveError liveError, boolean z) {
String str7 = a2;
if (str7 == null || str5 == null || !str7.equals(str5)) {
return;
}
VideoLiveManager.this.mLogService.a(!z, false);
if (z) {
VideoLiveManager.this.runOnFrontCurrentThread(new Runnable() {
@Override
public void run() {
LiveError liveError2 = liveError;
if (liveError2 != null) {
MyLog.i("DNSError", liveError2.toString());
if (!VideoLiveManager.this.mCancelSDKDNSFailRetry) {
VideoLiveManager.this.mRetryProcessor.a(liveError, VideoLiveManager.this.mShowedFirstFrame);
return;
}
VideoLiveManager.this.mLogService.a(liveError);
}
if (VideoLiveManager.this.mIsRequestCanceled) {
MyLog.i("DNSCancel", "cancel");
return;
}
String str8 = str6;
String str9 = str;
if (str8 == null || str8.length() == 0) {
str8 = SchedulerSupport.NONE;
} else {
com.bykv.vk.component.ttvideo.b.a unused = VideoLiveManager.this.mDnsParser;
str9 = com.bykv.vk.component.ttvideo.b.a.a(str, str8);
}
VideoLiveManager.this.mLogService.f();
VideoLiveManager.this.mLogService.a(str8, false);
AnonymousClass3 anonymousClass3 = AnonymousClass3.this;
VideoLiveManager.this.prepareToPlay(str9, str, str8, a2);
VideoLiveManager.this.mCurrentIP = str8;
}
});
return;
}
String str8 = str;
if (str6 == null || str6.length() == 0) {
str6 = SchedulerSupport.NONE;
} else {
com.bykv.vk.component.ttvideo.b.a unused = VideoLiveManager.this.mDnsParser;
str8 = com.bykv.vk.component.ttvideo.b.a.a(str, str6);
}
VideoLiveManager.this.mLogService.f();
VideoLiveManager.this.mLogService.a(str6, false);
VideoLiveManager.this.prepareToPlay(str8, str, str6, a2);
VideoLiveManager.this.mCurrentIP = str6;
}
});
return;
}
this.mLogService.a(false, false);
this.mLogService.f();
this.mLogService.a(a2, false);
if (TextUtils.isEmpty(this.mURLHost) || !com.bykv.vk.component.ttvideo.b.a.b(a2)) {
prepareToPlay(str, str, null, null);
} else {
prepareToPlay(str, str, null, this.mURLHost);
}
this.mCurrentIP = a2;
}
private void parseResponseHeaders(com.bykv.vk.component.ttvideo.log.b bVar) {
String b2 = this.mPlayer.b(335);
if (b2 == null) {
return;
}
for (String str : b2.split("\r\n")) {
if (str.startsWith("X-Server-Ip: ")) {
bVar.at = str.split(": ", 2)[1];
} else if (str.startsWith("Via: ")) {
bVar.au = str.split(": ", 2)[1];
}
}
}
private void prepareAvphPlay() {
this.mPlayer.a(159, this.mFramesDrop);
this.mPlayer.a(653, this.mEnableSkipFindUnnecessaryStream);
this.mPlayer.a(655, this.mAVPHDnsParseEnable);
this.mPlayer.a(c62.n, this.mAVPHDnsTimeout);
this.mPlayer.a(326, this.mAVPHVideoProbesize);
this.mPlayer.a(327, this.mAVPHVideoMaxDuration);
this.mPlayer.a(328, this.mAVPHAudioProbesize);
this.mPlayer.a(329, this.mAVPHAudioMaxDuration);
this.mPlayer.a(330, this.mAVPHOpenVideoFirst);
this.mPlayer.a(331, this.mAVPHMaxAVDiff);
this.mPlayer.a(332, this.mAVPHEnableAutoReopen);
this.mPlayer.a(712, this.mAVPHAutoExit);
this.mPlayer.a(711, this.mAVPHVideoDiffThreshold);
this.mPlayer.a(713, this.mAVPHReadRetryCount);
this.mPlayer.a(714, this.mAVPHReadErrorExit);
String str = new String();
String str2 = new String();
if (this.mAudioOnly.equals("only_audio=1")) {
str = packAvphHeader(str, "only_audio", "1");
}
if (this.mVideoOnly.equals("only_video=1")) {
str2 = packAvphHeader(str2, "only_video", "1");
}
this.mPlayer.a(376, str);
this.mPlayer.a(377, str2);
}
private String prepareLiveIOURL(String str, String str2, Map<String, String> map) {
return str;
}
private String prepareProxyURL(String str, String str2, String str3, Map<String, String> map) {
MyLog.i(TAG, "prepareProxy play url: " + str + ", host: " + str3);
if (!this.mTransportProtocol.equals("tcp") || !this.mStreamFormat.equals("flv") || this.mEnableResolutionAutoDegrade || TextUtils.isEmpty(this.mSessionId)) {
String str4 = "proxy not support format: " + this.mStreamFormat + ", proto: " + this.mTransportProtocol + ", abr: " + this.mEnableResolutionAutoDegrade + ", sessio id invalid: " + TextUtils.isEmpty(this.mSessionId);
MyLog.i(TAG, str4);
this.mLogService.bs = str4;
return null;
}
if (!TextUtils.isEmpty(str) && !TextUtils.isEmpty(str3)) {
try {
URL url = new URL(str);
String url2 = new URL(url.getProtocol(), str3, url.getPort() == -1 ? url.getDefaultPort() : url.getPort(), url.getFile()).toString();
MyLog.i(TAG, "prepareProxy proxy url: " + url2);
MyLog.i(TAG, "enable liveio:" + this.mEnableOpenLiveIO + " enable liveio play:" + this.mEnableLiveIOPlay);
MyLog.i(TAG, "live mdl enable_from_sdk:" + this.mEnableOpenMDL + " enable_from_app:" + com.bykv.vk.component.ttvideo.a.c.a().a(8100) + " is_running:" + com.bykv.vk.component.ttvideo.a.c.a().e());
if (this.mEnableOpenMDL == 1 && com.bykv.vk.component.ttvideo.a.c.a().a(8100) == 1 && com.bykv.vk.component.ttvideo.a.c.a().e()) {
if (this.mALogWriteAddr != -1) {
com.bykv.vk.component.ttvideo.a.c.a().a(59, this.mALogWriteAddr);
}
this.mIsPlayWithMdl = true;
runOnCurrentThread(new k(this, this.mSessionId, false));
MyLog.i(TAG, "setup mdl play cache sync runner of :" + this.mSessionId);
String a2 = com.bykv.vk.component.ttvideo.a.c.a().a(url2, Boolean.valueOf(this.mIsMdlProtoRegister));
MyLog.i(TAG, "proxyUrl: " + a2);
if (a2 != null && !a2.isEmpty()) {
map.put("Stream-Type", "live");
String str5 = this.mSessionId;
if (str5 != null) {
map.put("X-Tt-Traceid", str5);
}
if (str2 != null && !str2.equals(SchedulerSupport.NONE)) {
if (str2.startsWith("[")) {
str2 = str2.substring(1, str2.length() - 1);
}
map.put("X-Given-IPs", str2);
}
try {
JSONObject jSONObject = new JSONObject();
jSONObject.put("url", a2);
if (str2 != null) {
jSONObject.put("ip", str2);
}
String str6 = this.mSessionId;
if (str6 != null) {
jSONObject.put("traceId", str6);
}
com.bykv.vk.component.ttvideo.a.c.a().a(8017, jSONObject.toString());
} catch (Exception unused) {
MyLog.w(TAG, "set play info to mdl failed");
}
return a2;
}
}
} catch (Exception unused2) {
}
}
return null;
}
public void prepareToPlay(String str, String str2, String str3, String str4) {
Object obj;
String str5;
Object obj2;
String str6;
long j2;
String str7;
String str8;
String prepareProxyURL;
int i2;
SurfaceHolder surfaceHolder;
n nVar;
int i3;
int i4;
String str9 = str;
long currentTimeMillis = System.currentTimeMillis();
this.mLogService.aA = currentTimeMillis;
if (this.mUuid != null) {
this.mSessionId = this.mUuid + "." + currentTimeMillis;
}
MyLog.i(TAG, "prepareToPlay:" + str9);
if (str9 == null || this.mPlayer == null) {
return;
}
HashMap hashMap = new HashMap();
if (str4 != null) {
hashMap.put("Host", String.format(" %s", str4));
}
Map<String, String> f2 = this.mURLSource.f();
if (f2 != null) {
hashMap.putAll(f2);
MyLog.i(TAG, "headers: " + hashMap.toString());
}
if (this.mTransportProtocol.equals("quic") || this.mTransportProtocol.equals("quicu")) {
hashMap.put("suggest_protocol", "quic");
if (this.mEnableSaveSCFG) {
n nVar2 = this.mPlayer;
StringBuilder sb = new StringBuilder();
obj = "url";
sb.append(this.mContext.getFilesDir().getAbsolutePath());
sb.append("/pullstream.scfg");
nVar2.a(353, sb.toString());
} else {
obj = "url";
}
if (this.mEnableQuicCertVerify) {
try {
str5 = "http://";
} catch (Throwable th) {
th = th;
str5 = "http://";
}
try {
Method method = Class.forName("com.ss.avframework.transport.ContextUtils").getMethod("initApplicationContext", Context.class);
method.setAccessible(true);
method.invoke(null, this.mContext.getApplicationContext());
Method method2 = Class.forName("com.ss.avframework.transport.JNIUtils").getMethod("setClassLoader", ClassLoader.class);
method2.setAccessible(true);
method2.invoke(null, this.mContext.getClassLoader());
} catch (Throwable th2) {
th = th2;
this.mEnableQuicCertVerify = false;
String str10 = "disable quic cert verify, " + th.toString();
this.mPlayer.a(925, this.mQuicVersion);
this.mPlayer.a(354, this.mEnableQuicCertVerify ? 1 : 0);
this.mPlayer.a(357, this.mEnableQuicMTUDiscovery);
this.mPlayer.a(356, this.mQuicInitMTU);
this.mPlayer.a(388, this.mQuicInitRtt);
this.mPlayer.a(389, this.mQuicMaxCryptoRetransmissions);
this.mPlayer.a(390, this.mQuicMaxCryptoRetransmissionTimeMs);
this.mPlayer.a(391, this.mQuicMaxRetransmissions);
this.mPlayer.a(392, this.mQuicMaxRetransmissionTimeMs);
this.mPlayer.a(393, this.mQuicMaxAckDelay);
this.mPlayer.a(394, this.mQuicMinReceivedBeforeAckDecimation);
this.mPlayer.a(395, this.mQuicPadHello);
this.mPlayer.a(ActivityTxt.x0, this.mQuicFixWillingAndAbleToWrite);
this.mPlayer.a(ActivityTxt.y0, this.mQuicFixProcessTimer);
this.mPlayer.a(ActivityTxt.z0, this.mQuicReadBlockTimeout);
this.mPlayer.a(923, this.mQuicReadBlockMode);
this.mPlayer.a(924, this.mQuicFixStreamFinAndRst);
this.mPlayer.a(926, this.mQuicTimerVersion);
this.mPlayer.a(927, this.mQuicConfigOptimize);
this.mPlayer.a(652, this.mEnableSkipFlvNullTag);
this.mPlayer.a(396, this.mTransportProtocol.equals("quicu") ? 1 : 0);
this.mPlayer.a(928, this.mSessionReceiveWindow);
this.mPlayer.a(929, this.mStreamReceiveWindow);
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
aVar.aD = this.mQuicInitMTU;
aVar.aC = this.mEnableSaveSCFG ? 1 : 0;
aVar.aE = this.mQuicPadHello;
aVar.aF = this.mQuicTimerVersion;
obj2 = obj;
this.mPlayer.a(372, this.mEnableDecodeMultiSei);
this.mPlayer.a(648, this.mEnableDecodeSeiOnce);
this.mPlayer.a(374, this.mForceDecodeMsGaps);
this.mPlayer.a(373, this.mForceDecodeSwitch);
this.mPlayer.a(375, this.mForceRenderMsGaps);
_configFlvLowLatencyWithSDKParam();
this.mPlayer.b(309, this.mStartPlayBufferThres);
this.mLogService.m = this.mStartPlayBufferThres;
configPlayerInstanceOption();
if (this.mPrepareState == l.PREPARED) {
}
int b2 = this.mURLSource.b(this.mResolution, this.mLevel);
this.mLogService.f(b2);
this.mPlayer.a(339, b2);
StringBuilder sb2 = new StringBuilder();
sb2.append("mEnableResolutionAutoDegrade:");
sb2.append(this.mEnableResolutionAutoDegrade);
sb2.append(";mAbrStrategy:");
sb2.append(this.mAbrStrategy);
sb2.append(";mResolution:");
sb2.append(this.mResolution);
if (this.mResolution.equals(v0.c)) {
}
sb2.append(str6);
MyLog.i(TAG, sb2.toString());
com.bykv.vk.component.ttvideo.log.a aVar2 = this.mLogService;
aVar2.ay = -1L;
j2 = this.mLatestAudioPacketDTS;
if (j2 > 0) {
}
String str11 = this.mResolution;
aVar2.ai = str11;
aVar2.al = this.mURLSource.e(!str11.equals(v0.c) ? this.mURLSource.a() : this.mResolution, this.mLevel);
if (this.mEnablePreventDTSBack == 1) {
MyLog.i(TAG, "prepareToPlay set dts:" + this.mFrameTerminatedDTS);
this.mPlayer.b(633, this.mFrameTerminatedDTS);
this.mPlayer.b(635, this.mFrameDroppingDTSMaxDiff);
}
if (!this.mIsLocalURL) {
}
if (this.mStreamFormat.equals("flv")) {
str9 = _addParamToURL(str9, "abr_pts", String.format("%d", Integer.valueOf(i4)));
}
if (this.mStreamFormat.equals("cmaf")) {
}
if (this.mStreamFormat.equals("tsl")) {
}
if (this.mTransportProtocol.equals("quicu")) {
}
if (!this.mResolution.equals(v0.c)) {
}
str7 = str3;
str8 = str4;
prepareProxyURL = prepareProxyURL(str9, str7, str8, hashMap);
if (prepareProxyURL != null) {
}
if (isRtcPlayAvailable()) {
}
if (this.mEnableRtcPlay == 1) {
MyLog.i(TAG, "rtc fallback set hardware decode: " + this.mHardwareDecodeEnable);
this.mPlayer.a(59, this.mHardwareDecodeEnable);
this.mLogService.c(this.mHardwareDecodeEnable != 1);
if (this.mHardwareDecodeEnable == 1) {
}
}
i2 = this.mNetworkTimeout;
if (i2 == -1) {
}
if (i2 != -1) {
}
surfaceHolder = this.mSurfaceHolder;
if (surfaceHolder == null) {
}
nVar = this.mPlayer;
if (nVar != null) {
}
if (this.mPrepareState == l.INITIALIZED) {
}
}
} else {
str5 = "http://";
}
this.mPlayer.a(925, this.mQuicVersion);
this.mPlayer.a(354, this.mEnableQuicCertVerify ? 1 : 0);
this.mPlayer.a(357, this.mEnableQuicMTUDiscovery);
this.mPlayer.a(356, this.mQuicInitMTU);
this.mPlayer.a(388, this.mQuicInitRtt);
this.mPlayer.a(389, this.mQuicMaxCryptoRetransmissions);
this.mPlayer.a(390, this.mQuicMaxCryptoRetransmissionTimeMs);
this.mPlayer.a(391, this.mQuicMaxRetransmissions);
this.mPlayer.a(392, this.mQuicMaxRetransmissionTimeMs);
this.mPlayer.a(393, this.mQuicMaxAckDelay);
this.mPlayer.a(394, this.mQuicMinReceivedBeforeAckDecimation);
this.mPlayer.a(395, this.mQuicPadHello);
this.mPlayer.a(ActivityTxt.x0, this.mQuicFixWillingAndAbleToWrite);
this.mPlayer.a(ActivityTxt.y0, this.mQuicFixProcessTimer);
this.mPlayer.a(ActivityTxt.z0, this.mQuicReadBlockTimeout);
this.mPlayer.a(923, this.mQuicReadBlockMode);
this.mPlayer.a(924, this.mQuicFixStreamFinAndRst);
this.mPlayer.a(926, this.mQuicTimerVersion);
this.mPlayer.a(927, this.mQuicConfigOptimize);
this.mPlayer.a(652, this.mEnableSkipFlvNullTag);
this.mPlayer.a(396, this.mTransportProtocol.equals("quicu") ? 1 : 0);
this.mPlayer.a(928, this.mSessionReceiveWindow);
this.mPlayer.a(929, this.mStreamReceiveWindow);
com.bykv.vk.component.ttvideo.log.a aVar3 = this.mLogService;
aVar3.aD = this.mQuicInitMTU;
aVar3.aC = this.mEnableSaveSCFG ? 1 : 0;
aVar3.aE = this.mQuicPadHello;
aVar3.aF = this.mQuicTimerVersion;
obj2 = obj;
} else {
str5 = "http://";
obj2 = "url";
}
this.mPlayer.a(372, this.mEnableDecodeMultiSei);
this.mPlayer.a(648, this.mEnableDecodeSeiOnce);
this.mPlayer.a(374, this.mForceDecodeMsGaps);
this.mPlayer.a(373, this.mForceDecodeSwitch);
this.mPlayer.a(375, this.mForceRenderMsGaps);
_configFlvLowLatencyWithSDKParam();
this.mPlayer.b(309, this.mStartPlayBufferThres);
this.mLogService.m = this.mStartPlayBufferThres;
configPlayerInstanceOption();
if (this.mPrepareState == l.PREPARED) {
this.mPrepareState = l.INITIALIZED;
this.mPlayer.g();
if (this.mCacheFileEnable == 1 && !TextUtils.isEmpty(this.mCacheFilePath) && !TextUtils.isEmpty(this.mCacheFileKey) && !this.mIsCacheHasComplete) {
this.mPlayer.a(17, this.mCacheFileKey);
this.mPlayer.a(14, 1);
this.mPlayer.a(this.mCacheFilePath, 1);
}
}
int b22 = this.mURLSource.b(this.mResolution, this.mLevel);
this.mLogService.f(b22);
this.mPlayer.a(339, b22);
StringBuilder sb22 = new StringBuilder();
sb22.append("mEnableResolutionAutoDegrade:");
sb22.append(this.mEnableResolutionAutoDegrade);
sb22.append(";mAbrStrategy:");
sb22.append(this.mAbrStrategy);
sb22.append(";mResolution:");
sb22.append(this.mResolution);
if (this.mResolution.equals(v0.c)) {
str6 = "";
} else {
str6 = ";auto default resolution:" + this.mURLSource.a();
}
sb22.append(str6);
MyLog.i(TAG, sb22.toString());
com.bykv.vk.component.ttvideo.log.a aVar22 = this.mLogService;
aVar22.ay = -1L;
j2 = this.mLatestAudioPacketDTS;
if (j2 > 0) {
aVar22.az = j2;
}
String str112 = this.mResolution;
aVar22.ai = str112;
aVar22.al = this.mURLSource.e(!str112.equals(v0.c) ? this.mURLSource.a() : this.mResolution, this.mLevel);
if (this.mEnablePreventDTSBack == 1 && this.mFrameTerminatedDTS != -1 && this.mPlayer != null) {
MyLog.i(TAG, "prepareToPlay set dts:" + this.mFrameTerminatedDTS);
this.mPlayer.b(633, this.mFrameTerminatedDTS);
this.mPlayer.b(635, this.mFrameDroppingDTSMaxDiff);
}
try {
if (!this.mIsLocalURL) {
str9 = addSessionIdToURL(str9, currentTimeMillis);
}
if (this.mStreamFormat.equals("flv") && (i4 = mFastOpenDuration) != -1) {
str9 = _addParamToURL(str9, "abr_pts", String.format("%d", Integer.valueOf(i4)));
}
if (this.mStreamFormat.equals("cmaf")) {
str9 = _addParamToURL(str9, "play_start", "1");
}
if (this.mStreamFormat.equals("tsl")) {
String substring = this.mCurrentPlayURL.substring(this.mCurrentPlayURL.indexOf("TimeShiftFormat=") + 16);
if (substring.indexOf(h1.b) > 0) {
substring = substring.substring(0, substring.indexOf(h1.b));
}
int i5 = this.mTslTimeShift;
if (i5 > 0) {
str9 = _addParamToURL(str9, substring, String.format("%d", Integer.valueOf(i5)));
}
}
if (this.mTransportProtocol.equals("quicu")) {
str9 = _addParamToURL(str9, "unreliable", "1");
}
if (!this.mResolution.equals(v0.c) && this.mEnableResolutionAutoDegrade && this.mAbrStrategy.equals("abr_bb_4live") && this.mURLSource.j() == 2 && this.mStreamFormat.equals("flv")) {
this.mLogService.aj = this.mURLSource.a();
long j3 = this.mTargetOriginBitRate;
if (j3 > 0 && this.mURLSource.a(this.mStreamFormat, this.mLevel, j3)) {
this.mLogService.aW = 1;
}
str7 = str3;
str8 = str4;
this.mURLSource.c("_session_id=" + this.mLogService.t, str7, str8);
String a2 = this.mURLSource.a(this.mResolution, this.mStreamFormat, this.mLevel);
MyLog.i(TAG, "mpd url:" + a2);
if (a2 != null) {
str9 = HTTP_FLV_ABR_PREFIX + a2;
}
if (a2 != null) {
this.mPlayer.a(315, "llash");
}
this.mPlayer.a(324, 1);
if (this.mShowedFirstFrame && (i3 = this.mEnableLLASHFastOpen) == 1) {
this.mPlayer.a(532, i3);
}
int i6 = this.mEnableLiveAbrCheckEnhance;
if (i6 == 1) {
this.mLogService.aJ = 1;
this.mPlayer.a(533, i6);
this.mPlayer.a(534, this.mLiveABRCheckInterval);
}
int i7 = this.mABRMethod;
if (i7 >= 0) {
this.mPlayer.a(535, i7);
}
int i8 = this.mABRBufferThreshold;
if (i8 > 0) {
this.mPlayer.a(543, i8);
}
} else {
str7 = str3;
str8 = str4;
}
prepareProxyURL = prepareProxyURL(str9, str7, str8, hashMap);
if (prepareProxyURL != null) {
try {
MyLog.i(TAG, "proxyUrl: " + prepareProxyURL + " headers: " + hashMap.toString());
str9 = prepareProxyURL;
} catch (Exception e2) {
e = e2;
str9 = prepareProxyURL;
HashMap hashMap2 = new HashMap();
hashMap2.put(obj2, str9);
LiveError liveError = new LiveError(-100002, e.getMessage(), hashMap2);
if (this.mIsLocalURL) {
this.mListener.onError(liveError);
return;
} else {
this.mRetryProcessor.a(liveError, this.mShowedFirstFrame);
return;
}
}
}
if (isRtcPlayAvailable()) {
this.mPlayer.a(e50.T0, 0);
this.mPlayer.a(this.mContext, Uri.parse(str9), hashMap);
com.bykv.vk.component.ttvideo.log.a aVar4 = this.mLogService;
aVar4.bb = str9;
aVar4.bc = hashMap;
} else {
MyLog.i(TAG, "set rtc play config parameters");
this.mLogService.aK = 1;
this.mPlayer.a(ActivityTxt.j0, 1);
this.mPlayer.a(802, 1);
this.mPlayer.a(803, 3);
this.mPlayer.a(804, 1000);
this.mPlayer.a(805, 3000);
this.mPlayer.a(813, this.mRtcFallbackThreshold);
this.mPlayer.a(814, this.mRtcEnableDtls);
this.mPlayer.a(815, this.mRtcMinJitterBuffer);
this.mPlayer.a(881, this.mRtcMaxJitterBuffer);
this.mPlayer.a(816, this.mRtcEarlyInitRender);
this.mPlayer.a(882, this.mRtcEnableRtcUninitLockFree);
if (!this.mLogService.t.equals(SchedulerSupport.NONE)) {
this.mPlayer.a(811, this.mLogService.t);
com.bykv.vk.component.ttvideo.log.a aVar5 = this.mLogService;
aVar5.aU = aVar5.t;
}
if (this.mRtcEnableSDKDns == 1) {
JSONObject jSONObject = new JSONObject();
jSONObject.put("s_expect_ip", str7);
this.mLogService.aN = str7;
this.mPlayer.a(812, String.valueOf(jSONObject));
}
com.bykv.vk.component.ttvideo.log.a aVar6 = this.mLogService;
aVar6.e = "";
aVar6.c = "";
aVar6.d = false;
if (this.mRtcSupportMiniSdp != 1) {
this.mPlayer.a(this.mContext, Uri.parse(str2), (Map<String, String>) null);
com.bykv.vk.component.ttvideo.log.a aVar7 = this.mLogService;
aVar7.bb = str2;
aVar7.aL = 0;
} else if (str2 != null) {
String str12 = str5;
if (str2.startsWith(str12)) {
String replace = str2.replace(str12, "webrtc://");
this.mPlayer.a(this.mContext, Uri.parse(replace), (Map<String, String>) null);
com.bykv.vk.component.ttvideo.log.a aVar8 = this.mLogService;
aVar8.bb = replace;
aVar8.aL = 1;
}
}
this.mLogService.bc = null;
}
if (this.mEnableRtcPlay == 1 && this.mRtcPlayFallBack == 1) {
MyLog.i(TAG, "rtc fallback set hardware decode: " + this.mHardwareDecodeEnable);
this.mPlayer.a(59, this.mHardwareDecodeEnable);
this.mLogService.c(this.mHardwareDecodeEnable != 1);
if (this.mHardwareDecodeEnable == 1) {
MyLog.i(TAG, "rtc fallback enable hardware decode, mDefaultCodecId: " + this.mDefaultCodecId + ", mEnableMediaCodecASYNCInit: " + this.mEnableMediaCodecASYNCInit);
if (this.mDefaultCodecId != -1) {
this.mPlayer.a(181, this.mEnableMediaCodecASYNCInit);
this.mPlayer.a(182, this.mDefaultCodecId);
com.bykv.vk.component.ttvideo.log.a aVar9 = this.mLogService;
aVar9.L = this.mEnableMediaCodecASYNCInit;
aVar9.M = this.mDefaultCodecId;
}
}
}
i2 = this.mNetworkTimeout;
if (i2 == -1 && i2 >= 1000) {
this.mPlayer.a(9, i2 * 1000);
MyLog.i(TAG, "networktimeout: " + this.mNetworkTimeout + " microsecond");
this.mLogService.aB = this.mNetworkTimeout;
} else if (i2 != -1) {
MyLog.e(TAG, "networktimeout so small: " + this.mNetworkTimeout + " microsecond");
this.mLogService.aB = 5000;
}
surfaceHolder = this.mSurfaceHolder;
if (surfaceHolder == null) {
setSurfaceHolder(surfaceHolder);
} else {
Surface surface = this.mSurface;
if (surface != null) {
setSurface(surface);
}
}
nVar = this.mPlayer;
if (nVar != null) {
nVar.b(true);
}
if (this.mPrepareState == l.INITIALIZED) {
return;
}
try {
this.mPlayer.i();
this.mPrepareState = l.PREPARING;
} catch (Exception e3) {
HashMap hashMap3 = new HashMap();
hashMap3.put(obj2, str9);
LiveError liveError2 = new LiveError(-100001, e3.getMessage(), hashMap3);
if (this.mIsLocalURL) {
this.mListener.onError(liveError2);
} else {
this.mRetryProcessor.a(liveError2, this.mShowedFirstFrame);
}
}
} catch (Exception e4) {
e = e4;
}
}
public void runOnCurrentThread(Runnable runnable) {
this.mMyHandler.post(runnable);
}
public void runOnCurrentThreadDelay(Runnable runnable, long j2) {
this.mMyHandler.postDelayed(runnable, j2);
}
public void runOnFrontCurrentThread(Runnable runnable) {
this.mMyHandler.postAtFrontOfQueue(runnable);
}
private void saveCurrentResolution() {
com.bykv.vk.component.ttvideo.log.a aVar;
if (this.mLivePlayerState == a.IDLE || (aVar = this.mLogService) == null) {
return;
}
aVar.ak = this.mResolution.equals(v0.c) ? this.mLogService.aj : this.mResolution;
}
public static void setAppInfo(Context context, Map map) {
if (map == null || map.size() == 0) {
return;
}
com.bykv.vk.component.ttvideo.a.a = context;
com.bykv.vk.component.ttvideo.a.c = (String) map.get("app_name");
Object obj = map.get("app_id");
MyLog.i(TAG, "set appid:" + ((Integer) obj));
if (obj != null) {
com.bykv.vk.component.ttvideo.a.b = ((Integer) obj).intValue();
MyLog.i(TAG, "set appid:" + com.bykv.vk.component.ttvideo.a.b);
}
com.bykv.vk.component.ttvideo.a.d = (String) map.get("app_channel");
com.bykv.vk.component.ttvideo.a.e = (String) map.get("app_version");
com.bykv.vk.component.ttvideo.a.f = (String) map.get(DeviceConstant.DEVICE_SP_NAME);
}
public static void setDataLoaderListener(com.bykv.vk.component.ttvideo.a.b bVar) {
com.bykv.vk.component.ttvideo.a.c.a().a(bVar);
}
public static void setIntValue(int i2, int i3) {
com.bykv.vk.component.ttvideo.a.c.a().a(i2, i3);
}
public static void setSettingsParam(Context context, Map<String, Object> map) {
if (map == null || map.isEmpty()) {
return;
}
HashMap hashMap = (HashMap) map;
hashMap.put("live_pull_sdk_version", Integer.valueOf(com.bykv.vk.component.ttvideo.utils.f.a("1.4.6.26-lite")));
hashMap.put("ttm_version", Integer.valueOf(com.bykv.vk.component.ttvideo.utils.f.a(r.a(14, ""))));
}
public static void startDataLoader(Context context) {
try {
com.bykv.vk.component.ttvideo.a.c.a().c();
} catch (Exception e2) {
throw e2;
}
}
private void startStallCounter() {
synchronized (this.mStallCounterLock) {
if (this.mStallCounterIsRunning) {
return;
}
if (this.mStallCounterThread == null) {
HandlerThread handlerThread = new HandlerThread("stallCounter");
this.mStallCounterThread = handlerThread;
handlerThread.start();
}
if (this.mStallCounterHandler == null) {
this.mStallCounterHandler = new Handler(this.mStallCounterThread.getLooper());
}
this.mStallCounterHandler.post(this.mVideoStallCountTask);
this.mStallCounterIsRunning = true;
}
}
private void stopStallCounter() {
synchronized (this.mStallCounterLock) {
Handler handler = this.mStallCounterHandler;
if (handler != null) {
handler.removeCallbacksAndMessages(null);
}
this.mStallCounterIsRunning = false;
}
}
public boolean switchMainAndBackupUrl(int i2) {
String a2;
if (this.mLevel.equals(ce.e)) {
a2 = this.mURLSource.a(this.mResolution.equals(v0.c) ? this.mURLSource.a() : this.mResolution, "flv", "backup");
if (a2 != null) {
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
this.mLogService.a(this.mCurrentPlayURL, a2, "main_to_backup", i2);
this.mLogService.c(a2);
this.mCurrentPlayURL = a2;
this.mLevel = "backup";
_setStreamFormat();
this.mRetryProcessor.c();
_resetPlayer();
this.mSessionStartTime = System.currentTimeMillis();
this.mRedoDns = true;
parsePlayDNS(a2);
this.mStallCount = 0;
return true;
}
return false;
}
if (this.mLevel.equals("backup")) {
a2 = this.mURLSource.a(this.mResolution.equals(v0.c) ? this.mURLSource.a() : this.mResolution, "flv", ce.e);
if (a2 != null) {
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
this.mLogService.a(this.mCurrentPlayURL, a2, "backup_to_main", i2);
this.mLogService.c(a2);
this.mCurrentPlayURL = a2;
this.mLevel = ce.e;
_setStreamFormat();
this.mRetryProcessor.c();
_resetPlayer();
this.mSessionStartTime = System.currentTimeMillis();
this.mRedoDns = true;
parsePlayDNS(a2);
this.mStallCount = 0;
return true;
}
}
return false;
}
public void updateDownloadSizeStat() {
long a2 = this.mPlayer.a(45, 0L);
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
aVar.ax += a2;
long j2 = aVar.aw;
if (aVar.av) {
aVar.aw = a2 + j2;
} else {
aVar.aw = a2 - aVar.c();
this.mLogService.av = true;
}
}
public void updateSessionFirstFrameInfo() {
n nVar;
com.bykv.vk.component.ttvideo.log.b bVar = this.mLogService.bl;
if (bVar == null || (nVar = this.mPlayer) == null) {
return;
}
bVar.ab = (nVar.a(63, 0L) * 8) / 1000;
this.mLogService.bl.ac = this.mPlayer.a(72, 0L);
this.mLogService.bl.ad = this.mPlayer.a(73, 0L);
}
public void _setAvLines() {
String str;
String str2;
String a2 = this.mURLSource.a(this.mResolution, this.mLevel);
if (a2 == null) {
return;
}
String str3 = null;
try {
JSONObject jSONObject = new JSONObject(a2);
str2 = jSONObject.has("IsEnable") ? jSONObject.optString("IsEnable") : null;
try {
str = jSONObject.has("VideoOnly") ? jSONObject.optString("VideoOnly") : null;
try {
if (jSONObject.has("AudioOnly")) {
str3 = jSONObject.optString("AudioOnly");
}
} catch (JSONException e2) {
e = e2;
e.printStackTrace();
if (str2 != null) {
}
if (str != null) {
}
if (str3 == null) {
}
}
} catch (JSONException e3) {
e = e3;
str = null;
}
} catch (JSONException e4) {
e = e4;
str = null;
str2 = null;
}
if (str2 != null) {
this.mEnableAvLines = str2;
}
if (str != null) {
this.mVideoOnly = str;
}
if (str3 == null) {
this.mAudioOnly = str3;
}
}
@Override
public void closeDNS() {
this.mEnableDns = false;
}
@Override
public void closeSeiCheck() {
this.mEnableSeiCheck = false;
this.mLogService.S = false;
}
public boolean disableSR(int i2, int i3) {
ArrayList arrayList = new ArrayList();
ILiveSettingBundle iLiveSettingBundle = this.mSettingsBundle;
if (iLiveSettingBundle != null) {
arrayList = (ArrayList) iLiveSettingBundle.getSettingsValueForKey("live_sdk_sr_resolution_block_list", new ArrayList());
}
if (!arrayList.isEmpty()) {
Iterator it = arrayList.iterator();
while (it.hasNext()) {
String[] split = ((String) it.next()).split("x");
if (split.length < 2) {
return false;
}
int parseInt = Integer.parseInt(split[0]);
int parseInt2 = Integer.parseInt(split[1]);
if (i2 == parseInt && i3 == parseInt2) {
return true;
}
}
}
return false;
}
void doResolutionChange(String str) {
}
@Override
public void enableSeiCheck() {
this.mEnableSeiCheck = true;
this.mLogService.S = true;
}
@Override
public void enableUploadSessionSeries() {
this.mEnableUploadSessionSeries = true;
this.mLogService.O = true;
}
public void frameDTSNotify(int i2, long j2, long j3) {
if (this.mEnableCheckFrame == 1 && i2 == 0 && this.mResolution.equals(s0.a.P)) {
this.mLogService.c(j2);
}
if (i2 == 1 && this.mEnableDTSCheck == 1) {
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar.ay < 0) {
aVar.ay = j2;
} else {
long j4 = this.mLatestAudioPacketDTS;
if (j2 < j4) {
aVar.b(j4, j2);
}
}
this.mLatestAudioPacketDTS = j2;
}
}
public int getEnableSR() {
return this.mEnableTextureSR;
}
public int getEnableTexturerender() {
return this.mEnableTextureRender;
}
public long getIntOption(int i2, long j2) {
if (i2 == 0) {
n nVar = this.mPlayer;
return nVar != null ? (nVar.a(63, 0L) * 8) / 1000 : j2;
}
if (i2 == 68) {
n nVar2 = this.mPlayer;
return nVar2 != null ? (nVar2.a(63, 0L) * 8) / 1000 : j2;
}
if (i2 != 78) {
return i2 != 79 ? j2 : this.mTslMinTimeShit;
}
return this.mPlayer != null ? r9.b(379, 0) : j2;
}
public void getLastRenderTime() {
if (this.mIsRetrying || this.mIsStalling) {
return;
}
this.mVideoLastRenderTime = this.mPlayer.a(320, -1L);
this.mAudioLastRenderTime = this.mPlayer.a(319, -1L);
}
public void getLogInfo(com.bykv.vk.component.ttvideo.log.b bVar, int i2) {
n nVar;
int i3;
int i4;
int i5;
int i6;
if (bVar == null || (nVar = this.mPlayer) == null) {
return;
}
bVar.ax = nVar.b(355, -1);
bVar.av = this.mPlayer.b(351, -1);
bVar.aL = this.mPlayer.b(349, 0);
if (i2 == 0 || i2 == 2) {
bVar.d = this.mPlayer.a(68, -1L);
bVar.s = this.mPlayer.a(318, -1L);
bVar.P = this.mPlayer.a(345, -1L);
bVar.Q = this.mPlayer.a(346, -1L);
bVar.T = this.mPlayer.a(45, 0L);
String str = this.mStreamFormat;
if (str != null && (str.equals("cmaf") || this.mStreamFormat.equals("avph"))) {
bVar.D = this.mPlayer.a(264, -1L);
bVar.E = this.mPlayer.a(267, -1L);
bVar.B = this.mPlayer.a(265, -1L);
bVar.C = this.mPlayer.a(268, -1L);
bVar.G = this.mPlayer.a(269, -1L);
bVar.F = this.mPlayer.a(266, -1L);
bVar.H = this.mPlayer.a(272, -1L);
bVar.I = this.mPlayer.a(273, -1L);
bVar.J = this.mPlayer.a(com.facebook.imageutils.e.d, -1L);
bVar.K = this.mPlayer.a(275, -1L);
if (this.mStreamFormat.equals("cmaf")) {
bVar.t = this.mPlayer.a(457, -1L);
bVar.u = this.mPlayer.a(450, -1L);
bVar.w = this.mPlayer.a(451, -1L);
bVar.y = this.mPlayer.a(452, -1L);
bVar.x = this.mPlayer.a(456, -1L);
bVar.z = this.mPlayer.a(453, -1L);
bVar.A = this.mPlayer.a(454, -1L);
bVar.v = this.mPlayer.a(455, -1L);
}
}
if (isRtcPlayAvailable()) {
bVar.aD = this.mPlayer.a(806, -1L);
bVar.aE = this.mPlayer.a(807, -1L);
bVar.aF = this.mPlayer.a(808, -1L);
bVar.aG = this.mPlayer.a(809, -1L);
}
bVar.e = this.mPlayer.a(69, -1L);
bVar.f = this.mPlayer.a(70, -1L);
bVar.g = this.mPlayer.a(75, -1L);
bVar.h = this.mPlayer.a(76, -1L);
bVar.i = this.mPlayer.a(77, -1L);
bVar.j = this.mPlayer.a(78, -1L);
bVar.o = this.mPlayer.a(155, -1L);
bVar.p = this.mPlayer.a(162, -1L);
bVar.q = this.mPlayer.a(156, -1L);
bVar.r = this.mPlayer.a(163, -1L);
bVar.Y = (this.mPlayer.a(63, 0L) * 8) / 1000;
bVar.aa = this.mPlayer.a(73, 0L);
bVar.Z = this.mPlayer.a(72, 0L);
bVar.as = this.mResolution;
bVar.ak = this.mPlayer.a(458, 0L);
bVar.al = this.mPlayer.a(459, 0L);
bVar.am = this.mPlayer.n();
bVar.an = this.mPlayer.a(624, 0L);
bVar.ao = this.mPlayer.a(338, 0L);
bVar.ap = this.mPlayer.a(336, 0L);
bVar.aq = this.mPlayer.a(337, 0L);
bVar.L = this.mPlayer.a(341, -1L);
bVar.M = this.mPlayer.a(343, -1L);
bVar.N = this.mPlayer.a(342, -1L);
bVar.O = this.mPlayer.a(344, -1L);
bVar.R = this.mPlayer.a(821, 0L);
bVar.S = this.mPlayer.a(822, 0L);
if (i2 == 0) {
bVar.aK = this.mPlayer.b(518, -1);
bVar.ab = bVar.Y;
bVar.ac = bVar.Z;
bVar.ad = bVar.aa;
bVar.ar = this.mDnsParser.c();
bVar.m = this.mPlayer.a(MediaEventListener.EVENT_VIDEO_READY, -1L);
bVar.k = System.currentTimeMillis();
parseResponseHeaders(bVar);
}
if (!this.mHasRetry && i2 == 2) {
bVar.ae = this.mPlayer.a(314, 0L);
}
if (i2 == 0) {
i3 = 352;
i4 = -1;
bVar.ay = this.mPlayer.b(352, -1);
i5 = bVar.ay;
if (i5 == i4) {
i5 = this.mPlayer.b(i3, i4);
}
bVar.aw = i5;
}
} else if (i2 == 1) {
bVar.T = this.mPlayer.a(45, 0L);
bVar.U = this.mPlayer.a(46, 0L);
bVar.X = this.mPlayer.b(150, 0.0f);
bVar.Y = (this.mPlayer.a(63, 0L) * 8) / 1000;
bVar.aa = this.mPlayer.a(73, 0L);
bVar.Z = this.mPlayer.a(72, 0L);
bVar.W = this.mPlayer.j();
bVar.V = System.currentTimeMillis();
bVar.ar = this.mDnsParser.c();
bVar.as = this.mResolution;
if (isRtcPlayAvailable()) {
String b2 = this.mPlayer.b(810);
bVar.aH = b2;
addRtcCodecInfo(b2);
}
} else if (i2 == 3) {
bVar.X = this.mPlayer.b(150, 0.0f);
bVar.Y = (this.mPlayer.a(63, 0L) * 8) / 1000;
bVar.aa = this.mPlayer.a(73, 0L);
bVar.as = this.mResolution;
} else if (i2 == 4) {
bVar.aa = this.mPlayer.a(73, 0L);
bVar.Z = this.mPlayer.a(72, 0L);
} else if (i2 == 5) {
bVar.aA = this.mPlayer.a(73, -1L);
bVar.az = this.mPlayer.a(72, -1L);
} else if (i2 == 6) {
bVar.aC = this.mPlayer.a(73, -1L);
bVar.aB = this.mPlayer.a(72, -1L);
} else if (i2 == 7) {
int b3 = this.mPlayer.b(61, -1);
int b4 = this.mPlayer.b(62, -1);
if (b3 == 1) {
if (b4 == 1) {
i6 = 2;
bVar.aI = i6;
} else {
bVar.aI = 1;
}
} else if (b4 == 1) {
i6 = 0;
bVar.aI = i6;
}
} else if (i2 == 8) {
String b5 = this.mPlayer.b(147);
if (b5 != null) {
bVar.aJ = formatABRStreamInfoToJSONArray(b5);
}
} else if (i2 == 9) {
String b6 = this.mPlayer.b(710);
if (!TextUtils.isEmpty(b6)) {
bVar.aM = formatAVPHStreamInfoToJSONArray(b6);
}
}
i3 = 352;
i4 = -1;
i5 = bVar.ay;
if (i5 == i4) {
}
bVar.aw = i5;
}
@Override
public float getMaxVolume() {
return this.mPlayerSetting.a();
}
public long getNtpTimeDiff() {
ILiveSettingBundle iLiveSettingBundle = this.mSettingsBundle;
if (iLiveSettingBundle != null) {
return ((Long) iLiveSettingBundle.getSettingsValueForKey("time_diff_server_and_client", 0L)).longValue();
}
return 0L;
}
@Override
public String getPlayerErrorInfo() {
n nVar = this.mPlayer;
return nVar != null ? nVar.b(ErrorCode.VIDEO_DOWNLOAD_FAIL) : SchedulerSupport.NONE;
}
@Override
public float getPlayerVolume() {
return this.mPlayerSetting.c();
}
public boolean getSRState() {
return false;
}
@Override
public long getSeiDelay() {
return this.mLogService.a(100, 0L);
}
@Override
public String getServerIP() {
return this.mCurrentIP;
}
public void getSessionlogInfo(com.bykv.vk.component.ttvideo.log.b bVar) {
n nVar;
if (bVar == null || (nVar = this.mPlayer) == null) {
return;
}
bVar.d = nVar.a(68, -1L);
bVar.s = this.mPlayer.a(318, -1L);
bVar.P = this.mPlayer.a(345, -1L);
bVar.Q = this.mPlayer.a(346, -1L);
bVar.e = this.mPlayer.a(69, -1L);
bVar.f = this.mPlayer.a(70, -1L);
bVar.g = this.mPlayer.a(75, -1L);
bVar.h = this.mPlayer.a(76, -1L);
bVar.i = this.mPlayer.a(77, -1L);
bVar.j = this.mPlayer.a(78, -1L);
bVar.o = this.mPlayer.a(155, -1L);
bVar.p = this.mPlayer.a(162, -1L);
bVar.q = this.mPlayer.a(156, -1L);
bVar.r = this.mPlayer.a(163, -1L);
bVar.Y = (this.mPlayer.a(63, 0L) * 8) / 1000;
bVar.aa = this.mPlayer.a(73, 0L);
bVar.Z = this.mPlayer.a(72, 0L);
bVar.as = this.mResolution;
bVar.ak = this.mPlayer.a(458, 0L);
bVar.al = this.mPlayer.a(459, 0L);
bVar.am = this.mPlayer.n();
bVar.an = this.mPlayer.a(624, 0L);
bVar.ao = this.mPlayer.a(338, 0L);
bVar.ap = this.mPlayer.a(336, 0L);
bVar.aq = this.mPlayer.a(337, 0L);
bVar.L = this.mPlayer.a(341, -1L);
bVar.M = this.mPlayer.a(343, -1L);
bVar.N = this.mPlayer.a(342, -1L);
bVar.O = this.mPlayer.a(344, -1L);
bVar.R = this.mPlayer.a(821, 0L);
bVar.S = this.mPlayer.a(822, 0L);
bVar.T = this.mPlayer.a(45, 0L);
}
public boolean getSharpenState() {
return false;
}
@Override
public JSONObject getStaticLog() {
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar == null) {
return null;
}
return aVar.q();
}
@Override
public String getStringOption(int i2, String str) {
if (i2 == 57) {
str = this.mCurrentPlayURL;
} else if (i2 == 58) {
str = this.mResolution;
} else if (i2 == 60) {
str = this.mStreamFormat;
} else if (i2 == 65) {
str = this.mAbrStrategy;
}
MyLog.i(TAG, "getStringOption: " + str);
return str;
}
public int getUrlSettingMethod() {
return this.mUrlSettingMethod;
}
public void getVideoCodecType() {
com.bykv.vk.component.ttvideo.log.a aVar;
String str;
n nVar = this.mPlayer;
if (nVar == null || this.mLogService == null) {
return;
}
int b2 = nVar.b(141, -1);
if (b2 == 0) {
aVar = this.mLogService;
str = "h264";
} else {
if (b2 != 1) {
return;
}
aVar = this.mLogService;
str = "bytevc1";
}
aVar.k(str);
}
@Override
public int getVideoHeight() {
n nVar = this.mPlayer;
if (nVar != null) {
return nVar.k();
}
return 0;
}
@Override
public int getVideoWidth() {
n nVar = this.mPlayer;
if (nVar != null) {
return nVar.l();
}
return 0;
}
@Override
public float getVolume() {
return this.mPlayerSetting.b();
}
@Override
public boolean isIPPlayer() {
n nVar = this.mPlayer;
return nVar != null && nVar.b() == 2;
}
@Override
public boolean isOsPlayer() {
n nVar = this.mPlayer;
return nVar != null && nVar.a();
}
@Override
public boolean isPlaying() {
n nVar = this.mPlayer;
return nVar != null && nVar.o();
}
public boolean isRtcPlayAvailable() {
return this.mEnableRtcPlay == 1 && this.mRtcPlayFallBack == 0;
}
public boolean isUsedSR() {
return false;
}
public boolean isUsedSharpen() {
return false;
}
public JSONObject liveInfoItems() {
try {
JSONObject x = this.mLogService.x();
x.put("get_live_info_iterms", "OK");
return x;
} catch (JSONException e2) {
e2.printStackTrace();
return null;
}
}
public void onRenderStallForRetryStop() {
if ((this.mIsStalling || this.mIsRetrying) && this.mEnableRenderStall == 1) {
if (this.mAudioLastRenderTime != -1) {
this.mLogService.a((int) (System.currentTimeMillis() - this.mAudioLastRenderTime), 0, false, false);
}
if (this.mVideoLastRenderTime != -1) {
this.mLogService.a((int) (System.currentTimeMillis() - this.mVideoLastRenderTime), 0, true, false);
}
}
}
@Override
public void openNTP() {
this.mEnableNTPTask = 1;
this.mLogService.j();
}
@Override
public void pause() {
MyLog.i(TAG, IntentAction.pause);
checkMainLooper(IntentAction.pause);
n nVar = this.mPlayer;
if (nVar == null || !nVar.o()) {
return;
}
this.mLivePlayerState = a.PAUSED;
this.mPlayer.f();
}
@Override
public void play() {
String str;
this.mListener.onReportALog(4, "play start -- " + hashCode());
checkMainLooper(IntentAction.play);
a aVar = this.mLivePlayerState;
a aVar2 = a.PLAYED;
if (aVar == aVar2) {
this.mLogService.f(IntentAction.play);
this.mListener.onReportALog(6, "illegal call: play -- " + hashCode());
return;
}
if (aVar == a.PAUSED) {
this.mLivePlayerState = aVar2;
n nVar = this.mPlayer;
if (nVar != null) {
nVar.e();
return;
}
return;
}
MyLog.i(TAG, IntentAction.play);
if (this.mURLSource.j() == 2) {
_configAbrInfo();
_setStreamFormat();
_setProtocol();
_checkStreamData();
}
ILiveSettingBundle iLiveSettingBundle = this.mSettingsBundle;
if (iLiveSettingBundle != null) {
this.mURLSource.c(((Integer) iLiveSettingBundle.getSettingsValueForKey("live_sdk_super_resolution_enable", 0)).intValue());
setIntOption(69, ((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_texture_render_enable", 0)).intValue());
if (((Integer) this.mSettingsBundle.getSettingsValueForKey("live_sdk_sharpen_enable", 0)).intValue() == 1) {
JSONObject j2 = this.mURLSource.j(this.mResolution, this.mLevel);
this.mSharpenSdkParams = j2;
if (j2 != null) {
this.mEnableSharpen = j2.optInt("Enabled");
}
}
}
setIntOption(70, this.mURLSource.h(this.mResolution, this.mLevel) ? 1 : 0);
this.mLivePlayerState = aVar2;
this.mFrameTerminatedDTS = -1L;
this.mLatestAudioPacketDTS = -1L;
String str2 = null;
com.bykv.vk.component.ttvideo.model.a aVar3 = this.mURLSource;
if (aVar3 != null) {
if (aVar3.j() == 1 && this.mURLSource.h() != null) {
str2 = this.mURLSource.h().mainURL;
String str3 = this.mIsLocalURL ? this.mLocalURL : str2;
if (str3 != null) {
if (str3.startsWith(rv.a)) {
this.mTransportProtocol = "tcp";
}
if (str3.startsWith("https")) {
this.mTransportProtocol = "tls";
}
if (str3.startsWith("httpk")) {
this.mTransportProtocol = "kcp";
}
this.mURLProtocol = this.mTransportProtocol;
}
if (this.mQuicPull) {
try {
com.bykv.vk.component.ttvideo.b.a("ttquic");
this.mQuicEnable = true;
MyLog.i(TAG, "ttquic lib is load success");
this.mLogService.a(1);
str = "quic";
} catch (Throwable unused) {
String str4 = this.mTransportProtocol;
this.mQuicEnable = false;
MyLog.i(TAG, "ttquic lib is load failed. change default protocol");
this.mLogService.a(0);
str = str4;
}
} else {
str = "";
}
if (str.isEmpty()) {
str = this.mTransportProtocol;
}
this.mTransportProtocol = str;
} else if (this.mURLSource.j() == 2) {
str2 = this.mURLSource.a(this.mResolution.equals(v0.c) ? this.mURLSource.a() : this.mResolution, this.mStreamFormat, this.mLevel);
}
}
if (this.mIsLocalURL) {
str2 = this.mLocalURL;
}
if (str2 != null) {
String e2 = this.mURLSource.e();
this.mUuid = e2;
if (TextUtils.isEmpty(e2)) {
this.mUuid = UUID.randomUUID().toString().replace("-", "").toLowerCase();
}
this.mLogService.c(this.mSuggestProtocol, this.mTransportProtocol);
this.mLogService.i();
this.mLogService.t = this.mUuid + "." + System.currentTimeMillis();
this.mLogService.s = this.mURLSource.d();
com.bykv.vk.component.ttvideo.log.a aVar4 = this.mLogService;
aVar4.ai = this.mResolution;
aVar4.aj = this.mURLSource.a();
this.mLogService.a(this.mIsLocalURL ? this.mLocalURL : str2, this.mDnsParser.c());
_play(str2);
this.mRetryProcessor.a();
} else {
HashMap hashMap = new HashMap();
hashMap.put("url", "no playurl found while play");
this.mRetryProcessor.a(new LiveError(-100002, "playURL is null", hashMap), this.mShowedFirstFrame);
}
if (this.mEnableStallCounter == 1) {
startStallCounter();
}
this.mListener.onReportALog(4, "play end -- " + hashCode());
}
@Override
public boolean playResolution(String str) {
MyLog.i(TAG, "playResolution:" + str);
checkMainLooper("playResolution");
if (this.mURLSource.j() != 2 || this.mPrepareState != l.PREPARED) {
return false;
}
if (this.mResolution.equals(str)) {
MyLog.i(TAG, "playResolution: same res=" + str);
return true;
}
this.mRetryProcessor.c();
this.mResolutionIndex = -1;
this.mStallCount = 0;
this.mLogService.a(this.mCurrentPlayURL, SchedulerSupport.NONE, "setting_" + this.mResolution + "_to_" + str, 0);
this.mLogService.at = "manual_abr_" + this.mResolution + "_to_" + str;
saveCurrentResolution();
this.mResolution = str;
if (this.mAbrStrategy.equals("abr_bb_4live") || (this.mAbrStrategy.equals("rad") && !str.equals(v0.c))) {
String a2 = this.mURLSource.a(this.mResolution.equals(v0.c) ? this.mURLSource.a() : this.mResolution, this.mStreamFormat, this.mLevel);
if (TextUtils.isEmpty(a2)) {
MyLog.w(TAG, "" + str + " playUrl not exist");
return false;
}
updateDownloadSizeStat();
this.mLogService.h();
this.mIsRetrying = true;
_stopPlayer();
_resetPlayer();
this.mLogService.c(a2);
this.mUserSwitchResoultion = true;
this.mLogService.bn = System.currentTimeMillis();
parsePlayDNS(a2);
}
return true;
}
@Override
public void release() {
MyLog.i(TAG, "release start");
this.mListener.onReportALog(4, "release start -- " + hashCode());
checkMainLooper("release");
a aVar = this.mLivePlayerState;
if (aVar == a.PLAYED || aVar == a.PAUSED) {
_stop(true, "release");
}
releaseTextureRenderRef();
this.mExecutor.shutdown();
this.mMyHandler.removeCallbacksAndMessages(null);
n nVar = this.mPlayer;
if (nVar == null) {
return;
}
nVar.c();
this.mPlayer = null;
this.mLogService.i();
this.mPrepareState = l.IDLE;
this.mLivePlayerState = a.IDLE;
MyLog.i(TAG, "release end");
this.mListener.onReportALog(4, "release end -- " + hashCode());
}
@Override
public void releaseAsync() {
this.mListener.onReportALog(4, "releaseAsync start -- " + hashCode());
MyLog.i(TAG, "releaseAsync");
checkMainLooper("releaseAsync");
a aVar = this.mLivePlayerState;
if (aVar == a.PLAYED || aVar == a.PAUSED) {
_stop(false, "releaseAsync");
}
this.mExecutor.shutdown();
this.mMyHandler.removeCallbacksAndMessages(null);
n nVar = this.mPlayer;
if (nVar == null) {
return;
}
if (this.mSurfaceHolder != null) {
nVar.a((SurfaceHolder) null);
}
releaseTextureRenderRef();
n nVar2 = this.mPlayer;
this.mPlayer = null;
this.mLogService.i();
this.mPrepareState = l.IDLE;
this.mLivePlayerState = a.IDLE;
com.bykv.vk.component.ttvideo.utils.e.a(new h(nVar2));
MyLog.i(TAG, "releaseAsync end");
this.mListener.onReportALog(4, "releaseAsync end -- " + hashCode());
}
public void releaseTextureRenderRef() {
}
@Override
public void reset() {
MyLog.i(TAG, "reset");
checkMainLooper("reset");
if (this.mPlayer == null) {
return;
}
_reset("reset");
this.mLogService.i();
this.mCacheFileKey = null;
this.mCacheFilePath = null;
this.mEnableResolutionAutoDegrade = false;
this.mEnableOriginResolution = false;
this.mEnableSwitchMainAndBackupUrl = true;
this.mEnableTextureSR = 0;
this.mEnableTextureRender = 0;
this.mTextureSRMode = 0;
this.mResolution = s0.a.P;
this.mResolutionIndex = -1;
this.mStreamFormat = "flv";
this.mTransportProtocol = "tcp";
this.mSuggestProtocol = SchedulerSupport.NONE;
this.mLevel = ce.e;
this.mLocalURL = null;
this.mIsLocalURL = false;
this.mEnableHurryFlag = 0;
this.mHurryType = -1;
this.mEnableAvLines = "";
this.mEnableSaveSCFG = false;
this.mShowedFirstFrame = false;
this.mEnableLLASHFastOpen = 0;
}
@Override
public void setAsyncInit(int i2) {
MyLog.d(TAG, String.format("setAsyncInit enable:%b", Integer.valueOf(i2)));
this.mEnableMediaCodecASYNCInit = i2;
}
@Override
public void setCommonFlag(String str) {
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar != null) {
aVar.j(str);
}
}
@Override
public void setDisableVideoRender(Boolean bool) {
n nVar;
MyLog.i(TAG, "setDisableVideoRender: " + bool);
this.mLogService.bd = bool.booleanValue() ? 1 : 0;
if (this.mEnableRadioLiveDisableRender != 1 || (nVar = this.mPlayer) == null) {
return;
}
nVar.a(261, bool.booleanValue() ? 1 : 0);
}
@Override
public void setFloatOption(int i2, float f2) {
StringBuilder sb;
String str;
String str2 = "";
if (i2 != 19) {
if (i2 == 20) {
if (this.mEnableLowLatencyFLV == 1) {
sb = new StringBuilder();
sb.append("");
str = "invalid settings on low latency flv, slow_speed:";
sb.append(str);
sb.append(f2);
str2 = sb.toString();
} else {
str2 = "slow_speed:" + f2;
this.mSlowPlaySpeed = f2;
n nVar = this.mPlayer;
if (nVar != null) {
nVar.a(191, f2);
this.mLogService.j = f2;
}
}
}
} else if (this.mEnableLowLatencyFLV == 1) {
sb = new StringBuilder();
sb.append("");
str = "invalid settings on low latency flv, catch_speed:";
sb.append(str);
sb.append(f2);
str2 = sb.toString();
} else {
str2 = "catch_speed:" + f2;
this.mCatchSpeed = f2;
n nVar2 = this.mPlayer;
if (nVar2 != null) {
nVar2.a(80, f2);
this.mLogService.h = f2;
}
}
MyLog.i(TAG, "setFloatOption " + str2);
}
@Override
public void setIntOption(int i2, int i3) {
n nVar;
int i4;
n nVar2;
int i5;
StringBuilder sb;
String str;
n nVar3;
int i6;
com.bykv.vk.component.ttvideo.log.a aVar;
String str2;
String str3 = "";
switch (i2) {
case 1:
str3 = "image_enhancement:" + i3;
this.mEnhancementType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 37;
nVar.a(i4, i3);
break;
}
break;
case 2:
str3 = "image_scale:" + i3;
this.mScaleType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 38;
nVar.a(i4, i3);
break;
}
break;
case 3:
str3 = "forbid_os_player:" + i3;
r.b(11, i3);
break;
case 4:
str3 = "image_layout:" + i3;
this.mLayoutType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 36;
nVar.a(i4, i3);
break;
}
break;
case 5:
str3 = "render_type:" + i3;
this.mRenderType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 56;
nVar.a(i4, i3);
break;
}
break;
case 7:
str3 = "hard_decode:" + i3;
this.mHardwareDecodeEnable = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 59;
nVar.a(i4, i3);
break;
}
break;
case 8:
str3 = "enable_cache_file:" + i3;
this.mCacheFileEnable = i3;
n nVar4 = this.mPlayer;
if (nVar4 != null) {
nVar4.a(14, 1);
break;
}
break;
case 9:
str3 = "bytevc1_decoder_type:" + i3;
this.mByteVC1DecoderType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 67;
nVar.a(i4, i3);
break;
}
break;
case 10:
str3 = "buffering_millSeconds:" + i3;
this.mBufferDataSeconds = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 86;
nVar.a(i4, i3);
break;
}
break;
case 11:
str3 = "buffering_timeout:" + i3;
this.mBufferTimeout = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 81;
nVar.a(i4, i3);
break;
}
break;
case 12:
str3 = "network_timeout:" + i3;
this.mNetworkTimeout = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 9;
i3 *= 1000000;
nVar.a(i4, i3);
break;
}
break;
case 15:
str3 = "use_external_dir:" + i3;
this.mUseExternalDir = i3;
break;
case 16:
str3 = "use_test_action:" + i3;
this.mTestAction = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 83;
nVar.a(i4, i3);
break;
}
break;
case 17:
if (this.mEnableLowLatencyFLV != 1) {
str3 = "hurry_time:" + i3;
this.mHurryTime = i3;
nVar2 = this.mPlayer;
if (nVar2 != null) {
i5 = 15;
nVar2.a(i5, i3);
this.mLogService.g = i3;
break;
}
} else {
sb = new StringBuilder();
sb.append("");
str = "invalid settings on low latency flv, hurry_time:";
sb.append(str);
sb.append(i3);
str3 = sb.toString();
break;
}
break;
case 18:
str3 = "hurry_type:" + i3;
this.mHurryType = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 84;
nVar.a(i4, i3);
break;
}
break;
case 21:
if (this.mEnableLowLatencyFLV != 1) {
str3 = "slow_play_time:" + i3;
this.mSlowPlayTime = i3;
nVar3 = this.mPlayer;
if (nVar3 != null) {
i6 = 190;
nVar3.a(i6, i3);
this.mLogService.i = i3;
break;
}
} else {
sb = new StringBuilder();
sb.append("");
str = "invalid settings on low latency flv, slow_play_time:";
sb.append(str);
sb.append(i3);
str3 = sb.toString();
break;
}
break;
case 22:
str3 = "check side data" + i3;
this.mOpenCheckSideData = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 132;
nVar.a(i4, i3);
break;
}
break;
case 25:
str3 = "player_degrade_mode:" + i3;
this.mPlayerDegradeMode = i3;
break;
case 31:
str3 = "url_ability:" + i3;
this.mURLAbility = i3;
if (i3 == 1) {
aVar = this.mLogService;
str2 = "h264";
} else if (i3 == 2) {
aVar = this.mLogService;
str2 = "bytevc1";
}
aVar.N = str2;
break;
case 32:
str3 = "enable_sharp:" + i3;
this.mEnableSharp = i3;
break;
case 33:
str3 = "asyncInit:" + i3;
this.mEnableMediaCodecASYNCInit = i3;
n nVar5 = this.mPlayer;
if (nVar5 != null && this.mHardwareDecodeEnable == 1) {
nVar5.a(181, i3);
this.mLogService.L = i3;
break;
}
break;
case 34:
str3 = "defaultCodecID:" + i3;
this.mDefaultCodecId = i3;
n nVar6 = this.mPlayer;
if (nVar6 != null) {
nVar6.a(182, i3);
this.mLogService.M = i3;
break;
}
break;
case 35:
str3 = "enable 264 hardware decode " + i3;
this.mEnableH264HardwareDecode = i3;
break;
case 36:
str3 = "enable bytevc1 hardware decode " + i3;
this.mEnableByteVC1HardwareDecode = i3;
break;
case 37:
str3 = "set max cache" + i3;
this.mMaxCacheSeconds = i3;
n nVar7 = this.mPlayer;
if (nVar7 != null) {
nVar7.a(198, i3);
this.mLogService.P = i3;
break;
}
break;
case 38:
str3 = "enable test split " + i3;
this.mEnableSplitStream = i3;
n nVar8 = this.mPlayer;
if (nVar8 != null) {
nVar8.a(87, i3);
this.mLogService.Q = i3;
break;
}
break;
case 39:
str3 = "enable httpk degrade:" + i3;
this.mEnableHttpkDegrade = i3;
break;
case 40:
str3 = "enable fast open:" + i3;
this.mEnableFastOpenStream = i3;
break;
case 41:
str3 = "enable upload sei:" + i3;
this.mEnableUploadSei = i3;
break;
case 42:
str3 = "enable NTP:" + i3;
this.mEnableNTPTask = i3;
break;
case 44:
str3 = "set in main looper:" + i3;
this.mIsInMainLooper = i3;
break;
case 46:
str3 = "buffering end ignore video:" + i3;
this.mCheckBufferingEndIgnoreVideo = i3;
n nVar9 = this.mPlayer;
if (nVar9 != null) {
nVar9.a(310, i3);
this.mLogService.o = i3;
break;
}
break;
case 47:
str3 = "start direct:" + i3;
this.mStartDirectAfterPrepared = i3;
n nVar10 = this.mPlayer;
if (nVar10 != null) {
nVar10.a(311, i3);
this.mLogService.p = i3;
break;
}
break;
case 48:
str3 = "enable mediaLoader:" + i3;
this.mEnableOpenMDL = i3;
break;
case 54:
str3 = "check buffering end advance:" + i3;
this.mCheckBufferingEndAdvanceEnable = i3;
n nVar11 = this.mPlayer;
if (nVar11 != null) {
nVar11.a(313, i3);
this.mLogService.q = i3;
break;
}
break;
case 55:
str3 = "set stall count thre:" + i3;
this.mStallCountThresOfResolutionDegrade = i3;
break;
case 56:
str3 = "enable resolution degrade:" + i3;
this.mEnableResolutionAutoDegrade = i3 == 1;
break;
case 61:
str3 = "enable tcp fast open:" + i3;
this.mEnableTcpFastOpen = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 316;
nVar.a(i4, i3);
break;
}
break;
case 62:
str3 = "enable check packet corrupt:" + i3;
this.mEnableCheckPacketCorrupt = i3;
nVar = this.mPlayer;
if (nVar != null) {
i4 = 317;
nVar.a(i4, i3);
break;
}
break;
case 67:
str3 = "enable flv abr:" + i3;
this.mEnableFlvABR = i3;
break;
case 69:
str3 = "enable texture render:" + i3;
this.mEnableTextureRender = i3;
break;
case 70:
str3 = "enable texture sr:" + i3;
this.mEnableTextureSR = i3;
break;
case 77:
str3 = "tsl time shift:" + i3;
this.mTslTimeShift = i3;
this.mLogService.R = i3;
break;
case 80:
str3 = "toB switch :" + i3;
this.mSwitchToB = i3;
break;
case 82:
str3 = "enable mult_sei:" + i3;
this.mEnableDecodeMultiSei = i3;
break;
case 83:
this.mHurryTime = i3;
str3 = "hurry_time:" + i3;
nVar2 = this.mPlayer;
if (nVar2 != null) {
i5 = 397;
nVar2.a(i5, i3);
this.mLogService.g = i3;
break;
}
break;
case 84:
str3 = "slow_play_time:" + i3;
this.mSlowPlayTime = i3;
nVar3 = this.mPlayer;
if (nVar3 != null) {
i6 = 398;
nVar3.a(i6, i3);
this.mLogService.i = i3;
break;
}
break;
case 85:
str3 = "enable free flow:" + i3;
this.mEnableFreeFlow = i3;
break;
}
MyLog.i(TAG, "setIntOption " + str3);
}
@Override
public void setLocalURL(String str) {
checkMainLooper("setLocalURL");
if (str != null && !str.equals(this.mLocalURL) && this.mLocalURL != null) {
reset();
}
this.mLocalURL = str;
this.mIsLocalURL = true;
}
@Override
public void setLongOption(int i2, long j2) {
String str = "";
if (i2 == 45) {
str = "startPlayBufferThreshold:" + j2;
this.mStartPlayBufferThres = j2;
n nVar = this.mPlayer;
if (nVar != null && j2 > 0) {
nVar.b(309, j2);
this.mLogService.m = j2;
}
} else if (i2 == 59) {
str = "set alog func:" + j2;
this.mALogWriteAddr = j2;
}
MyLog.i(TAG, "setLongOptin " + str);
}
@Override
public void setLooping(boolean z) {
this.mLooping = z;
if (this.mPlayer == null || !this.mIsLocalURL || TextUtils.isEmpty(this.mLocalURL)) {
return;
}
this.mPlayer.a(this.mLooping);
}
@Override
public void setMute(Boolean bool) {
this.mPlayerSetting.a(bool.booleanValue());
this.mLogService.be = bool.booleanValue() ? 1 : 0;
}
@Override
public void setPlayURLs(LiveURL[] liveURLArr) {
MyLog.i(TAG, "setPlayUrls, sdkParam:" + liveURLArr[0].sdkParams);
checkMainLooper("setPlayURLS");
this.mURLSource.a(liveURLArr);
this.mUrlSettingMethod = 0;
if (this.mCurrentPlayURL == null || this.mURLSource.h().mainURL == this.mCurrentPlayURL) {
return;
}
_reset("setPlayURLs");
}
@Override
public void setPlayerVolume(float f2) {
this.mPlayerSetting.b(f2);
this.mLogService.bg = f2;
}
@Override
public void setPreviewFlag(boolean z) {
com.bykv.vk.component.ttvideo.log.a aVar = this.mLogService;
if (aVar != null) {
aVar.a(z);
}
}
@Override
public void setProjectKey(String str) {
this.mLogService.h(str);
}
@Override
public void setStreamInfo(String str) {
JSONObject jSONObject;
MyLog.i(TAG, "setStreamInfo:" + str);
this.mLogService.X = str;
checkMainLooper("setStreamInfo");
try {
jSONObject = new JSONObject(str);
} catch (JSONException e2) {
jSONObject = null;
e2.printStackTrace();
}
if (jSONObject == null) {
return;
}
_reset("setStreamInfo");
this.mURLSource.a(new com.bykv.vk.component.ttvideo.model.b(jSONObject));
this.mUrlSettingMethod = 1;
_setLooseSync();
}
@Override
public void setStringOption(int i2, String str) {
com.bykv.vk.component.ttvideo.model.a aVar;
String str2 = "";
if (i2 == 26) {
String str3 = "cacheFilePath:" + str;
this.mCacheFilePath = str;
if (this.mPlayer != null) {
String str4 = System.currentTimeMillis() + "";
this.mCacheFileKey = str4;
this.mPlayer.a(17, str4);
this.mPlayer.a(14, 1);
this.mPlayer.a(str, 1);
}
str2 = str3;
} else if (i2 == 43) {
str2 = "set resolution:" + str;
saveCurrentResolution();
this.mResolution = str;
if (this.mPlayer != null && (aVar = this.mURLSource) != null && aVar.j() == 2) {
long e2 = this.mURLSource.e(this.mResolution, this.mLevel);
if (e2 > 0) {
this.mPlayer.a(650, (int) e2);
this.mLogService.bh = 1;
}
}
} else if (i2 == 60) {
str2 = "set stream format:" + str;
this.mStreamFormat = str;
this.mLogService.b(str, str);
if (this.mPlayer != null && (this.mStreamFormat.equals("avph") || this.mStreamFormat.equals("cmaf"))) {
this.mPlayer.a(315, str);
}
} else if (i2 == 81) {
str2 = "toB module id:" + str;
this.mMoudleIDToB = str;
} else if (i2 == 86) {
str2 = "switch resolution of cdn abr:" + str;
this.mCdnAbrResolution = str;
_requestSwitchUrlFromServer();
} else if (i2 != 89) {
switch (i2) {
case 63:
this.mLogService.a = str;
break;
case 64:
this.mLogService.b = str;
break;
case 65:
str2 = " abr strategy:" + str;
this.mAbrStrategy = str;
break;
case 66:
str2 = "set transport protocol:" + str;
if (str.equals("tcp") || str.equals("quic")) {
this.mTransportProtocol = str;
}
this.mQuicPull = true;
break;
default:
switch (i2) {
case 72:
str2 = "set sr kernal bin path:" + str;
this.mTextureSRBinPath = str;
break;
case 73:
str2 = "set sr ocl module path:" + str;
this.mTextureSROclModuleName = str;
break;
case 74:
str2 = "set sr dsp module path:" + str;
this.mTextureSRDspModuleName = str;
break;
}
}
} else {
str2 = "set_url_host:" + str;
this.mURLHost = str;
}
MyLog.i(TAG, "setStringOption " + str2);
}
@Override
public void setSurface(Surface surface) {
checkMainLooper("setSurface");
MyLog.i(TAG, "setsurface: " + surface);
this.mSurface = surface;
if (this.mPlayer != null) {
this.mLogService.W = System.currentTimeMillis();
this.mPlayer.a(surface);
this.mLogService.V = System.currentTimeMillis() - this.mLogService.W;
}
}
@Override
public void setSurfaceHolder(SurfaceHolder surfaceHolder) {
checkMainLooper("setSurfaceHolder");
this.mSurfaceHolder = surfaceHolder;
if (this.mPlayer != null) {
this.mLogService.W = System.currentTimeMillis();
this.mPlayer.a(surfaceHolder);
this.mLogService.V = System.currentTimeMillis() - this.mLogService.W;
}
}
public void setTextureRenderLogListener() {
}
@Override
public void setVideoFormat(String str) {
this.mStreamFormat = str;
}
@Override
public void setVolume(float f2) {
this.mPlayerSetting.a(f2);
this.mLogService.bf = f2;
}
public String set_url_port_scheme(String str, String str2) {
String str3;
int indexOf;
int indexOf2 = str.indexOf(".com");
int indexOf3 = str.indexOf(".com:");
StringBuilder sb = new StringBuilder(str);
if (str2 != null) {
if (indexOf3 != -1) {
int i2 = indexOf3 + 5;
int i3 = i2 + 1;
while (i3 < sb.length() && sb.charAt(i3) - '0' >= 0 && sb.charAt(i3) - '0' <= 9) {
i3++;
}
sb.replace(i2, i3, str2);
} else if (indexOf2 != -1 && ((indexOf = str.indexOf("vhost")) == -1 || indexOf > indexOf2)) {
sb.insert(indexOf2 + 4, ":" + str2);
}
}
StringBuilder sb2 = new StringBuilder(sb.toString());
int indexOf4 = sb2.indexOf("://");
if (this.mURLSource.j() == 2) {
if (this.mTransportProtocol.equals("kcp")) {
if (indexOf4 != -1) {
str3 = "httpk";
sb2.replace(0, indexOf4, str3);
}
} else if (this.mTransportProtocol.equals("quic") || this.mTransportProtocol.equals("quicu")) {
if (indexOf4 != -1) {
str3 = "httpq";
sb2.replace(0, indexOf4, str3);
}
} else if (this.mTransportProtocol.equals("tls")) {
if (indexOf4 != -1) {
str3 = "https";
sb2.replace(0, indexOf4, str3);
}
} else if (this.mTransportProtocol.equals("tcp") && indexOf4 != -1) {
str3 = rv.a;
sb2.replace(0, indexOf4, str3);
}
}
return sb2.toString();
}
public void setupTextureRender() {
}
@Override
public void stop() {
MyLog.i(TAG, IntentAction.stop);
this.mListener.onReportALog(4, "stop start -- " + hashCode());
checkMainLooper(IntentAction.stop);
_stop(true, IntentAction.stop);
this.mRetryProcessor.b();
this.mListener.onReportALog(4, "stop end-- " + hashCode());
}
public void updateFrameTerminatedDTS(int i2, long j2, long j3) {
this.mFrameTerminatedDTS = j2;
}
}