搜书大师 v23.2版本的 MD5 值为:5ee433f6456b6278bd6e80a5d44df55e

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


package com.bykv.vk.component.ttvideo.log;

import android.content.Context;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.Message;
import android.text.TextUtils;
import com.bykv.vk.component.ttvideo.ILiveListener;
import com.bykv.vk.component.ttvideo.VideoLiveManager;
import com.facebook.imagepipeline.producers.s0;
import com.flyersoft.source.conf.IntentAction;
import com.lygame.aaa.a2;
import com.lygame.aaa.z0;
import com.tencent.cos.common.COSHttpResponseKey;
import io.reactivex.annotations.SchedulerSupport;
import java.io.IOException;
import java.net.InetAddress;
import java.net.SocketException;
import java.net.UnknownHostException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue;
import kotlinx.coroutines.v0;
import org.apache.commons.net.ntp.NTPUDPClient;
import org.apache.commons.net.ntp.TimeInfo;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class a implements Handler.Callback {
    private static final String bI = a.class.getCanonicalName();
    private Context bJ;
    private ILiveListener bL;
    private b bM;
    private VideoLiveManager bN;
    private final long bO;
    public b bl;
    private InetAddress cZ;
    private C0809a da;
    private boolean dc;
    public long w;
    public String x;
    private boolean bP = false;
    public String a = SchedulerSupport.NONE;
    public String b = SchedulerSupport.NONE;
    private String bQ = SchedulerSupport.NONE;
    private String bR = SchedulerSupport.NONE;
    private String bS = SchedulerSupport.NONE;
    private String bT = SchedulerSupport.NONE;
    private String bU = SchedulerSupport.NONE;
    private boolean bV = false;
    private String bW = SchedulerSupport.NONE;
    private boolean bX = false;
    private long bY = 0;
    private String bZ = SchedulerSupport.NONE;
    private String ca = SchedulerSupport.NONE;
    private String cb = SchedulerSupport.NONE;
    private String cc = SchedulerSupport.NONE;

    private String f1696cd = SchedulerSupport.NONE;
    private String ce = SchedulerSupport.NONE;
    private int cf = -1;
    private int cg = -1;
    private int ch = -1;
    private int ci = -1;
    private int cj = -1;
    private String ck = SchedulerSupport.NONE;
    private String cl = SchedulerSupport.NONE;
    private String cm = "";
    private boolean cn = false;
    private String co = SchedulerSupport.NONE;
    private boolean cp = false;
    private boolean cq = false;
    private boolean cr = false;
    public String c = SchedulerSupport.NONE;
    public boolean d = false;
    public String e = SchedulerSupport.NONE;
    public boolean f = false;
    public int g = -1;
    public float h = -1.0f;
    public int i = -1;
    public float j = -1.0f;
    public int k = 0;
    public String l = SchedulerSupport.NONE;
    public long m = 0;
    public int n = -1;
    public int o = 0;
    public int p = 0;
    public int q = 0;
    public int r = -1;
    public String s = SchedulerSupport.NONE;
    public String t = SchedulerSupport.NONE;
    private String cs = "flv";
    private boolean ct = false;
    private long cu = 0;
    public long u = 0;
    private int cv = 0;
    private int cw = 0;
    private long cx = 0;
    private long cy = 0;
    private long cz = -1;
    private long cA = 0;
    private long cB = 0;
    private long cC = 0;
    private long cD = 0;
    private long cE = 0;
    private long cF = 0;
    private boolean cG = false;
    private int cH = 0;
    private int cI = 0;
    private int cJ = 0;
    private int cK = 0;
    private int cL = 0;
    private int cM = 0;
    private long cN = 0;
    private long cO = 0;
    private int cP = 0;
    private int cQ = 0;
    private boolean cR = false;
    public int v = -1;
    private boolean cS = false;
    private boolean cT = false;
    private boolean cU = false;
    private long cV = 0;
    private long cW = 0;
    private long cX = 0;
    private NTPUDPClient cY = null;
    private final long db = 300000;
    private int dd = -1;
    private String de = null;
    private boolean df = false;
    public int y = 0;
    public int z = 0;
    public long A = 0;
    public int B = 0;
    public int C = 0;
    public int D = 0;
    public int E = 0;
    public int F = -1;
    public String G = null;
    public int H = 0;
    public int I = 0;
    public int J = 0;
    private int dg = -1;
    private ArrayList<Long> dh = null;
    private ArrayList<Long> di = null;
    private ArrayList<Long> dj = null;
    private ArrayList<Long> dk = null;
    private JSONObject dl = null;
    private ArrayList<Integer> dm = null;
    private ArrayList<Integer> dn = null;

    private boolean f1635do = false;
    public boolean K = false;
    public int L = 0;
    public int M = -1;
    public String N = SchedulerSupport.NONE;
    public boolean O = false;
    public int P = -1;
    public int Q = 0;
    public int R = -1;
    public boolean S = false;
    public int T = 0;
    public int U = 1;
    public long V = 0;
    public long W = 0;
    public String X = SchedulerSupport.NONE;
    public int Y = 0;
    public boolean Z = false;
    public boolean aa = false;
    public float ab = -1.0f;
    public long ac = 0;
    private String dp = SchedulerSupport.NONE;
    private String dq = "tcp";
    private String dr = SchedulerSupport.NONE;
    private int ds = -1;
    private String dt = SchedulerSupport.NONE;
    private String du = Build.BOARD;
    private String dv = Build.HARDWARE;
    public String ad = SchedulerSupport.NONE;
    public String ae = SchedulerSupport.NONE;
    public boolean af = false;
    public String ag = "rad";
    public boolean ah = false;
    public String ai = s0.a.P;
    public String aj = s0.a.P;
    public String ak = SchedulerSupport.NONE;
    public long al = -1;
    public int am = -1;
    public int an = 0;
    public String ao = SchedulerSupport.NONE;
    public long ap = -1;
    public long aq = -1;
    public long ar = -1;
    public long as = -1;
    public String at = SchedulerSupport.NONE;
    public int au = 4;
    public boolean av = false;
    public long aw = 0;
    public long ax = 0;
    public long ay = -1;
    public long az = -1;
    private int dw = 0;
    private long dx = 0;
    public long aA = 0;
    public int aB = -1;
    public int aC = -1;
    public int aD = -1;
    public int aE = -1;
    public int aF = -1;
    public int aG = 0;
    public int aH = 0;
    public List<String> aI = null;
    private final int dy = 0;
    private final int dz = 1;
    private final int dA = 2;
    private final int dB = 3;
    private final int dC = 4;
    private LinkedBlockingQueue<Long> dD = null;
    private final int dE = 600;
    private int dF = -1;
    private int dG = -1;
    private long dH = -1;
    private int dI = -1;
    private int dJ = 0;
    private int dK = 0;
    private int dL = 0;
    private int dM = 0;
    public int aJ = 0;
    public int aK = 0;
    public int aL = 0;
    public int aM = 0;
    public String aN = SchedulerSupport.NONE;
    public int aO = -1;
    public long aP = 0;
    public long aQ = 0;
    public long aR = 0;
    public long aS = 0;
    public int aT = 0;
    public String aU = SchedulerSupport.NONE;
    public String aV = SchedulerSupport.NONE;
    public int aW = 0;
    public int aX = 0;
    public int aY = 1;
    public boolean aZ = false;
    public int ba = -1;
    public String bb = SchedulerSupport.NONE;
    public Map<String, String> bc = null;
    public int bd = 0;
    public int be = -1;
    public float bf = -1.0f;
    public float bg = -1.0f;
    public int bh = 0;
    public int bi = -1;
    public long bj = 0;
    public int bk = 0;
    public boolean bm = false;
    public long bn = 0;
    public long bo = 0;
    public long bp = 0;
    private int dN = 0;
    private long dO = 0;
    private long dP = 0;
    private long dQ = 0;
    private long dR = 0;
    private long dS = 0;
    private long dT = 0;
    private long dU = 0;
    private long dV = 0;
    private int dW = -1;
    private int dX = -1;
    private String dY = SchedulerSupport.NONE;
    private long dZ = 0;
    private long ea = 0;
    private long eb = 0;
    private long ec = 0;
    private long ed = 0;
    private long ee = 0;
    private long ef = 0;
    private long eg = 0;
    public int bq = 0;
    public int br = 0;
    public String bs = SchedulerSupport.NONE;
    public long bt = 0;
    public String bu = SchedulerSupport.NONE;
    private boolean eh = false;
    public long bv = 0;
    public long bw = 0;
    public int bx = 0;
    public int by = 0;
    public long bz = 0;
    public long bA = 0;
    public long bB = 0;
    public long bC = 0;
    public int bD = 4096;
    public int bE = 512;
    public String bF = "";
    public String bG = "";
    private long ei = 5000;
    public int bH = 0;
    private Handler bK = new Handler(this);

    public static class C0809a {
        private HandlerThread a;
        private Handler b;

        public C0809a(final a aVar) {
            HandlerThread handlerThread = new HandlerThread("DnsHandlerThread");
            this.a = handlerThread;
            handlerThread.start();
            this.b = new Handler(this.a.getLooper()) {
                @Override
                public void handleMessage(Message message) {
                    String str;
                    if (message == null || (str = aVar.x) == null || str.equals(com.ksdk.ssds.manager.b.p)) {
                        return;
                    }
                    if ((message.what == 104 && aVar.dd == -1) || aVar.E() || aVar.cZ == null) {
                        try {
                            a aVar2 = aVar;
                            aVar2.cZ = InetAddress.getByName(aVar2.x);
                        } catch (UnknownHostException e) {
                            aVar.cZ = null;
                            e.printStackTrace();
                        }
                    }
                    if (message.what == 103) {
                        aVar.D();
                        if (aVar.df) {
                            C0809a.this.b.sendEmptyMessageDelayed(103, 300000L);
                        }
                    }
                }
            };
        }

        public void a(int i, long j) {
            Handler handler;
            if (this.a == null || (handler = this.b) == null) {
                return;
            }
            if (j == 0) {
                handler.sendEmptyMessage(i);
            } else {
                handler.sendEmptyMessageDelayed(i, j);
            }
        }
    }

    public a(VideoLiveManager videoLiveManager, ILiveListener iLiveListener, long j, long j2, Context context, int i) {
        this.w = 10000L;
        this.bJ = context;
        this.bO = j <= 0 ? 60000L : j;
        this.bL = iLiveListener;
        this.bN = videoLiveManager;
        this.bM = new b();
        this.w = j2;
        MyLog.i(bI, "enable report sessionstop: " + i);
        if (i == 1) {
            this.bl = new b();
        }
    }

    private void A() {
        b bVar;
        if (this.bk == 0 || (bVar = this.bl) == null) {
            return;
        }
        this.bm = false;
        this.dU = 0L;
        this.dV = 0L;
        this.dO = 0L;
        this.dP = 0L;
        this.bn = 0L;
        this.bo = 0L;
        this.bp = 0L;
        this.dQ = 0L;
        this.dR = 0L;
        this.dS = 0L;
        this.dT = 0L;
        this.dW = -1;
        this.dX = 0;
        this.dY = SchedulerSupport.NONE;
        bVar.a();
    }

    private void B() {
        b bVar;
        VideoLiveManager videoLiveManager = this.bN;
        if (videoLiveManager == null || this.bL == null || (bVar = this.bM) == null) {
            return;
        }
        videoLiveManager.getLogInfo(bVar, 3);
        if (this.dh == null) {
            this.dh = new ArrayList<>();
            this.dj = new ArrayList<>();
            this.di = new ArrayList<>();
        }
        this.dh.add(Long.valueOf(this.bM.X));
        this.dj.add(Long.valueOf(this.bM.aa));
        this.di.add(Long.valueOf(this.bM.Y));
        if (this.f1635do) {
            if (this.dn == null) {
                this.dn = new ArrayList<>();
                this.dm = new ArrayList<>();
            }
            this.dn.add(Integer.valueOf(this.bM.aj));
            this.dm.add(Integer.valueOf(this.bM.ai));
        }
    }

    private void C() {
        B();
        MyLog.i("zdh", "update session series");
        if (this.bP) {
            this.bK.sendEmptyMessageDelayed(102, 5000L);
        }
    }

    public void D() {
        NTPUDPClient nTPUDPClient = this.cY;
        if (nTPUDPClient == null) {
            return;
        }
        TimeInfo timeInfo = null;
        try {
            nTPUDPClient.open();
            InetAddress inetAddress = this.cZ;
            if (inetAddress != null) {
                timeInfo = this.cY.getTime(inetAddress);
            }
        } catch (SocketException e) {
            e.printStackTrace();
            return;
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        if (timeInfo == null) {
            return;
        }
        long time = timeInfo.getMessage().getOriginateTimeStamp().getTime();
        long time2 = timeInfo.getMessage().getReceiveTimeStamp().getTime();
        long time3 = timeInfo.getMessage().getTransmitTimeStamp().getTime();
        long currentTimeMillis = System.currentTimeMillis();
        this.A = ((time2 - time) + (time3 - currentTimeMillis)) / 2;
        String str = "ori:" + time + " rec:" + time2 + " trans:" + time3 + " destTs:" + currentTimeMillis + " diff:" + this.A;
    }

    public boolean E() {
        String str;
        int i;
        NetworkInfo a = com.bykv.vk.component.ttvideo.b.d.a(this.bJ);
        if (a == null || !a.isAvailable()) {
            str = null;
            i = -1;
        } else {
            i = a.getType();
            str = a.getExtraInfo();
        }
        if (i != -1 && i == this.dd) {
            if (str == null) {
                return false;
            }
            String str2 = this.de;
            if (str2 != null && str.equals(str2)) {
                return false;
            }
        }
        this.dd = i;
        this.de = str;
        return true;
    }

    private JSONObject a(b bVar, long j, long j2, long j3, long j4, boolean z) {
        long j5;
        JSONObject b = b();
        if (b == null) {
            return null;
        }
        long j6 = bVar.V - j3;
        long j7 = bVar.W - j4;
        long j8 = bVar.U - j2;
        long j9 = (j7 <= 0 || j8 <= 0) ? 0L : (j8 * 8) / j7;
        this.bY++;
        int i = this.cH;
        int i2 = this.cI;
        if (this.cG && this.cy != 0) {
            i++;
            i2 = (int) (i2 + (System.currentTimeMillis() - this.cy));
            this.cy = System.currentTimeMillis();
        }
        long j10 = bVar.T;
        long j11 = this.ax + j10;
        if (this.av) {
            j5 = j10 + this.aw;
            this.aw = 0L;
        } else {
            j5 = j10 - j;
        }
        this.av = false;
        b.put("event_key", "playing").put("download_size_delta", j5).put("download_size", j11).put("video_play_size", bVar.U).put("render_fps", bVar.X).put("video_rate", j9).put("download_speed", this.bM.Y).put("play_time", j6).put("retry_count", this.cP).put("stall_count", i).put("stall_time", i2).put("audio_render_stall_count", this.cL).put("audio_render_stall_time", this.cM).put("video_render_stall_count", this.cJ).put("video_render_stall_time", this.cK).put("silence_detected_count", this.v).put("is_last", z ? 1 : 0).put("index", this.bY).put("speed_switch_count", this.k).put("speed_switch_info", this.l).put("video_buffer_time", this.bM.Z).put("audio_buffer_time", this.bM.aa).put("enable_sei_check", this.S ? 1 : 0).put("ntp_sync", this.dc ? 1 : 0).put("rtc_stat_info", this.bM.aH).put("suggest_format", this.dp).put("suggest_protocol", this.dr);
        int i3 = this.by;
        if (i3 > 0) {
            b.put("av_out_sync_count", i3).put("av_out_sync_duration", this.bA).put("av_out_sync_info", this.bG);
        }
        this.by = 0;
        this.bA = 0L;
        this.bG = "";
        this.cP = 0;
        this.cH = 0;
        this.cI = 0;
        this.cL = 0;
        this.cM = 0;
        this.cJ = 0;
        this.cK = 0;
        this.k = 0;
        this.l = SchedulerSupport.NONE;
        this.v = this.cR ? 0 : -1;
        return b;
    }

    private JSONObject a(b bVar, long j, boolean z, long j2) {
        long j3;
        JSONObject b = b();
        if (b == null) {
            return null;
        }
        JSONObject put = b.put("event_key", "first_frame").put("last_retry_end", j).put("hit_cache", z ? 1 : 0).put(IntentAction.start, bVar.a).put("sdk_dns_analysis_end", bVar.b).put("prepare_block_end", bVar.c);
        long j4 = bVar.s;
        if (j4 <= 0) {
            j4 = bVar.d;
        }
        put.put("tfo_fall_back_time", j4).put("pre_connect", this.dg).put("http_req_finish_time", bVar.R).put("http_res_finish_time", bVar.S).put("first_video_package_end", bVar.g).put("first_audio_package_end", bVar.h).put("first_video_frame_decode_end", bVar.i).put("first_audio_frame_decode_end", bVar.j).put("first_frame_from_player_core", bVar.m).put("first_frame_render_end", bVar.k).put("video_param_send_outlet_time", bVar.ak).put("first_video_frame_send_outlet_time", bVar.al).put("set_surface_time", this.W).put("set_surface_cost", this.V).put("video_render_type", bVar.am).put("video_device_open_start", bVar.o).put("video_device_open_end", bVar.p).put("audio_device_open_start", bVar.q).put("audio_device_open_end", bVar.r).put("video_device_wait_start", bVar.ap).put("video_device_wait_end", bVar.aq).put("find_stream_info_start", bVar.an).put("find_stream_info_end", bVar.ao).put("video_first_pkt_pos", bVar.L).put("video_first_pkt_pts", bVar.M).put("audio_first_pkt_pos", bVar.N).put("audio_first_pkt_pts", bVar.O).put("video_buffer_time", this.bM.Z).put("audio_buffer_time", this.bM.aa).put("download_speed", this.bM.Y).put("stall_time", j2).put("first_sei_delay", this.bM.af).put("response_header_X-Server-IP", this.bM.at).put("response_header_Via", this.bM.au).put("prepare_end", bVar.n).put("drop_audio_pts_diff", bVar.P).put("drop_audio_cost", bVar.Q).put("enable_tcp_fast_open", this.aG).put("tfo_success", bVar.aK).put("abr_check_enhance", this.aJ).put("optimize_backup_ips", this.aI == null ? new JSONArray() : new JSONArray((Collection) this.aI)).put("suggest_format", this.dp).put("suggest_protocol", this.dr).put("container_fps", this.ab);
        String str = "tcp_first_package_end";
        if (y()) {
            b.put("player_dns_analysis_end", this.aP);
            b.put("rtc_use_sdk_dns", this.aO);
            b.put("tcp_connect_end", this.aQ);
            b.put("rtc_tls_handshake_end", this.aR);
            b.put("tcp_first_package_end", this.aS);
            b.put("rtc_inited_end", bVar.aD);
            b.put("rtc_offer_send_end", bVar.aE);
            b.put("rtc_answer_recv_end", bVar.aF);
            j3 = bVar.aG;
            str = "rtc_start_end";
        } else {
            b.put("player_dns_analysis_end", bVar.d);
            b.put("tcp_connect_end", this.dq.equals("kcp") ? bVar.d : bVar.e);
            j3 = bVar.f;
        }
        b.put(str, j3);
        int i = this.r;
        if (i != -1) {
            b.put("audio_timescale_enable", i);
        }
        return b;
    }

    private void a(JSONObject jSONObject) {
        if (TextUtils.equals(this.dq, "quic") || TextUtils.equals(this.dq, "quicu")) {
            jSONObject.put("quic_open_result", this.bM.ax);
            MyLog.i(bI, "quic_open_result = " + this.bM.ax);
        }
    }

    private void d(boolean z) {
        b bVar;
        VideoLiveManager videoLiveManager = this.bN;
        if (videoLiveManager == null || this.bL == null || (bVar = this.bM) == null) {
            return;
        }
        try {
            long j = bVar.T;
            long j2 = bVar.U;
            long j3 = bVar.V;
            long j4 = bVar.W;
            videoLiveManager.getLogInfo(bVar, 1);
            this.bL.onMonitorLog(a(this.bM, j, j2, j3, j4, z), "live_client_monitor_log");
            long j5 = this.u;
            if (j5 > 0) {
                this.u = j5 + 1;
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
        long j6 = this.bO;
        if (y()) {
            j6 = this.ei;
        }
        if (this.bP) {
            this.bK.sendEmptyMessageDelayed(101, j6);
        }
    }

    private JSONObject z() {
        B();
        try {
            JSONObject put = new JSONObject().put("start_time", this.bM.a).put("duration", System.currentTimeMillis() - this.bM.a).put("render_fps_series", new JSONArray((Collection) this.dh)).put("download_bitrate_series", new JSONArray((Collection) this.di)).put("play_buffer_series", new JSONArray((Collection) this.dj)).put("push_bitrate_series", this.dm == null ? new JSONArray() : new JSONArray((Collection) this.dm)).put("push_fps_series", this.dn == null ? new JSONArray() : new JSONArray((Collection) this.dn)).put("stall_series", this.dk == null ? new JSONArray() : new JSONArray((Collection) this.dk));
            JSONObject jSONObject = this.dl;
            if (jSONObject == null) {
                jSONObject = new JSONObject();
            }
            return put.put("error_series", jSONObject);
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
    }

    public long a(int i, long j) {
        VideoLiveManager videoLiveManager;
        if (i != 0) {
            return i != 100 ? j : this.bM.af;
        }
        int i2 = this.ch;
        return (i2 != -1 || (videoLiveManager = this.bN) == null) ? i2 : videoLiveManager.getIntOption(i, j);
    }

    public void a() {
        C0809a c0809a;
        if (this.bP) {
            return;
        }
        this.bK.sendEmptyMessageDelayed(101, this.bO);
        if (this.O) {
            this.bK.sendEmptyMessageDelayed(102, 5000L);
        }
        if (this.z == 1 && !this.df && (c0809a = this.da) != null) {
            c0809a.a(103, 0L);
            this.df = true;
        }
        this.bP = true;
    }

    public void a(int i) {
        this.ds = i;
    }

    public void a(int i, int i2) {
        this.I = i;
        this.J = i2;
    }

    public void a(int i, String str) {
        if (this.dl == null) {
            this.dl = new JSONObject();
        }
        try {
            this.dl.put(Long.toString(System.currentTimeMillis() - this.bM.a), i);
        } catch (JSONException e) {
            this.dl = null;
            e.printStackTrace();
        }
        this.bN.getLogInfo(this.bM, 2);
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "play_error").put(COSHttpResponseKey.CODE, i).put("info", str);
                a(b);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
                this.cv = i;
            } catch (JSONException e2) {
                e2.printStackTrace();
            }
        }
    }

    public void a(int i, boolean z) {
        this.cv = LiveError.PLAYER_STALL;
        if (z) {
            this.bN.getLogInfo(this.bM, 5);
            long currentTimeMillis = System.currentTimeMillis();
            this.cx = currentTimeMillis;
            if (this.cN == 0) {
                this.cN = currentTimeMillis;
            }
            if (this.bk == 1) {
                if (this.dU == 0) {
                    this.dU = currentTimeMillis;
                }
                this.dX = this.cv;
            }
            this.cy = currentTimeMillis;
            this.cz = i;
            this.cG = true;
            if (this.dk == null) {
                this.dk = new ArrayList<>();
            }
            this.dk.add(Long.valueOf(this.cx - this.bM.a));
        }
    }

    public void a(long j) {
        b bVar = this.bM;
        if (bVar != null) {
            bVar.ae = j;
        }
        b bVar2 = this.bl;
        if (bVar2 != null) {
            bVar2.ae = j;
        }
    }

    public void a(long j, int i, boolean z) {
        if (j > System.currentTimeMillis() - this.bM.a || j <= i) {
            MyLog.i(bI, "abnormal demux stall time" + j);
            return;
        }
        if (z) {
            this.ed++;
            this.ee += j;
        } else {
            this.ef++;
            this.eg += j;
        }
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "demux_stall").put("type", z ? "video" : "audio").put("demux_stall_time", j);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j2 = this.u;
                if (j2 > 0) {
                    this.u = j2 + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void a(long j, int i, boolean z, boolean z2) {
        if (j > System.currentTimeMillis() - this.bM.a || j <= i) {
            MyLog.i(bI, "abnormal render stall time" + j);
            return;
        }
        String str = bI;
        if (z) {
            MyLog.i(str, "video render stall time " + j);
            this.cJ = this.cJ + 1;
            this.cC = this.cC + 1;
            this.cK = (int) (((long) this.cK) + j);
            this.cD += j;
            if (this.bk == 1) {
                this.dQ++;
                this.dR += j;
            }
        } else {
            MyLog.i(str, "audio render stall time " + j);
            this.cL = this.cL + 1;
            this.cE = this.cE + 1;
            this.cM = (int) (((long) this.cM) + j);
            this.cF += j;
            if (this.bk == 1) {
                this.dS++;
                this.dT += j;
            }
        }
        if (z2) {
            JSONObject b = b();
            this.bN.getLogInfo(this.bM, 4);
            if (b != null) {
                try {
                    b.put("event_key", "render_stall").put("type", z ? "video" : "audio").put("render_stall_time", j).put("video_buffer_time", this.bM.Z).put("audio_buffer_time", this.bM.aa);
                    this.bL.onMonitorLog(b, "live_client_monitor_log");
                    long j2 = this.u;
                    if (j2 > 0) {
                        this.u = j2 + 1;
                    }
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        }
    }

    public void a(long j, long j2) {
        b bVar;
        this.ct = true;
        this.dw = this.cQ;
        this.dx = this.aA;
        this.cu = System.currentTimeMillis();
        if (this.bN == null || this.bL == null || (bVar = this.bM) == null) {
            return;
        }
        try {
            bVar.V = System.currentTimeMillis();
            this.bN.getLogInfo(this.bM, 0);
            JSONObject a = a(this.bM, j, this.cr, j2);
            this.bt = this.cu - this.bM.a;
            String str = this.cs;
            if (str != null && (str.equals("cmaf") || this.cs.equals("avph"))) {
                a.put("video_dns_analysis_end", this.bM.D).put("audio_dns_analysis_end", this.bM.E).put("video_tcp_connect_time", this.bM.B).put("audio_tcp_connect_time", this.bM.C).put("video_tcp_first_packet_time", this.bM.F).put("audio_tcp_first_packet_time", this.bM.G).put("video_http_req_finish_time", this.bM.H).put("audio_http_req_finish_time", this.bM.I).put("video_http_res_finish_time", this.bM.J).put("audio_http_res_finish_time", this.bM.K);
                if (this.cs.equals("cmaf")) {
                    a.put("cmaf_mpd_dns_analysis_end", this.bM.t).put("cmaf_mpd_tcp_connect_time", this.bM.u).put("cmaf_mpd_tcp_first_package_end", this.bM.w).put("cmaf_mpd_http_req_finish_time", this.bM.v).put("cmaf_mpd_http_res_finish_time", this.bM.x).put("cmaf_audio_firstseg_connect_time", this.bM.z).put("cmaf_video_firstseg_connect_time", this.bM.A).put("cmaf_mpd_connect_time", this.bM.y);
                }
                a(a);
            }
            this.bL.onMonitorLog(a, "live_client_monitor_log");
            long j3 = this.u;
            if (j3 > 0) {
                this.u = j3 + 1;
            }
            this.l = "1.0:" + this.cu;
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void a(long j, long j2, long j3, long j4, long j5, long j6, long j7) {
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "stall_counter").put("type", "video").put("render_stall_200_duration", j / 1000).put("render_stall_200_count", j % 1000).put("render_stall_300_duration", j2 / 1000).put("render_stall_300_count", j2 % 1000).put("render_stall_400_duration", j3 / 1000).put("render_stall_400_count", j3 % 1000).put("render_stall_500_duration", j4 / 1000).put("render_stall_500_count", j4 % 1000).put("demuxer_stall_500_duration", j5 / 1000).put("demuxer_stall_500_count", j5 % 1000).put("decode_pre_stall_500_duration", j6 / 1000).put("decode_pre_stall_500_count", j6 % 1000).put("decode_post_stall_500_duration", j7 / 1000).put("decode_post_stall_500_count", j7 % 1000);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j8 = this.u;
                if (j8 > 0) {
                    this.u = j8 + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void a(long j, String str, boolean z) {
        if (this.bN == null || this.bL == null) {
            return;
        }
        try {
            JSONObject b = b();
            b.put("event_key", "abr_switch").put("auto_switch", z ? 1 : 0).put("target_resoultion", str).put("predict_bitrate", j).put("abr_switch_info", this.at).put("cur_download_speed", this.ap).put("cur_audio_buffer_time", this.aq).put("cur_video_buffer_time", this.ar).put("stall_count", this.cA).put("switch_cost", this.as).put("use_expect_bitrate", this.bh);
            this.bh = 0;
            this.bL.onMonitorLog(b, "live_client_monitor_log");
            long j2 = this.u;
            if (j2 > 0) {
                this.u = j2 + 1;
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void a(long j, boolean z) {
        if (j > System.currentTimeMillis() - this.bM.a) {
            MyLog.i(bI, "abnormal rtc decode stall time" + j);
            return;
        }
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "rtc_decode_stall").put("type", z ? "video" : "audio").put("decode_stall_time", j);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j2 = this.u;
                if (j2 > 0) {
                    this.u = j2 + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void a(LiveError liveError) {
        int i;
        long j;
        JSONObject b = b();
        if (b == null) {
            return;
        }
        try {
            JSONObject put = b.put("event_key", "prepare_result").put("error_msg", liveError.getInfoJSON()).put(a2.c, liveError.code);
            String str = this.bZ;
            if (str == null) {
                str = SchedulerSupport.NONE;
            }
            JSONObject put2 = put.put("sdk_params", str).put("stream_type", this.bM.aI).put("suggest_format", this.dp).put("suggest_protocol", this.dr);
            if (!this.bN.getSRState() && !this.bN.getSharpenState()) {
                i = 0;
                put2.put("nnsr_enabled", i);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                j = this.u;
                if (j <= 0) {
                    this.u = j + 1;
                    return;
                }
                return;
            }
            i = 1;
            put2.put("nnsr_enabled", i);
            this.bL.onMonitorLog(b, "live_client_monitor_log");
            j = this.u;
            if (j <= 0) {
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void a(String str) {
        if (this.bP) {
            this.bP = false;
            this.bK.removeCallbacksAndMessages(null);
            C0809a c0809a = this.da;
            if (c0809a != null) {
                c0809a.b.removeCallbacksAndMessages(null);
            }
            this.df = false;
        }
        w();
        e(str);
        i();
    }

    public void a(String str, String str2) {
        if (this.bl != null) {
            this.bn = System.currentTimeMillis();
        }
        this.bM.a = System.currentTimeMillis();
        this.bM.ar = str2;
        this.bS = str;
        this.bT = str;
        JSONObject b = b();
        this.u = 0L;
        if (b != null) {
            try {
                b.put("event_key", "start_play").put("rule_ids", this.s).put("set_surface_cost", this.V).put("start_play_time", this.bM.a).put("stream_data", this.X).put("suggest_format", this.dp).put("play_format", this.cs).put("suggest_protocol", this.dr).put("origin_url", this.dt).put("log_total_count_when_playing", this.u);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                this.u++;
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void a(String str, String str2, String str3, int i) {
        if (this.bN == null || this.bL == null) {
            return;
        }
        try {
            JSONObject b = b();
            JSONObject put = b.put("event_key", "switch_url");
            if (str == null) {
                str = com.ksdk.ssds.manager.b.p;
            }
            JSONObject put2 = put.put("last_cdn_play_url", str);
            if (str2 == null) {
                str2 = com.ksdk.ssds.manager.b.p;
            }
            put2.put("next_cdn_play_url", str2).put("res_bitrate", this.al).put("last_res", this.ak).put(COSHttpResponseKey.CODE, i).put("reason", str3);
            this.bL.onMonitorLog(b, "live_client_monitor_log");
            long j = this.u;
            if (j > 0) {
                this.u = j + 1;
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void a(String str, boolean z) {
        this.bU = str;
        this.bV = z;
    }

    public void a(boolean z) {
        this.bX = z;
    }

    public void a(boolean z, boolean z2) {
        this.bM.b = System.currentTimeMillis();
        b bVar = this.bl;
        if (bVar != null) {
            bVar.b = System.currentTimeMillis();
        }
        this.cp = z2;
        this.cr = z;
    }

    public JSONObject b() {
        this.bN.getVideoCodecType();
        try {
            JSONObject put = new JSONObject().put("report_version", "5").put("live_sdk_version", "1.4.6.26-lite").put("product_line", "live").put("client_timestamp", System.currentTimeMillis());
            String str = this.bW;
            String str2 = "-1";
            if (str == null) {
                str = "-1";
            }
            JSONObject put2 = put.put("player_sdk_version", str);
            String str3 = this.bR;
            if (str3 == null) {
                str3 = "-1";
            }
            JSONObject put3 = put2.put("project_key", str3);
            String str4 = this.a;
            if (str4 == null) {
                str4 = SchedulerSupport.NONE;
            }
            JSONObject put4 = put3.put("live_stream_enter_method", str4);
            String str5 = this.b;
            if (str5 == null) {
                str5 = SchedulerSupport.NONE;
            }
            JSONObject put5 = put4.put("live_stream_enter_action", str5);
            String str6 = this.bS;
            if (str6 != null) {
                str2 = str6;
            }
            JSONObject put6 = put5.put("cdn_play_url", str2);
            String str7 = this.bU;
            if (str7 == null) {
                str7 = SchedulerSupport.NONE;
            }
            JSONObject put7 = put6.put("cdn_ip", str7).put("request_url", this.bb).put("ip_from_player_core", this.bV ? 1 : 0).put("is_preview", this.bX ? 1 : 0).put("push_client_sdk_version", this.ca).put("push_client_platform", this.cb).put("push_client_os_version", this.cc).put("push_client_model", this.f1696cd).put("push_client_start_time", this.ce).put("push_client_is_hardware_encode", this.cf).put("push_client_min_bitrate", this.cg).put("push_client_max_bitrate", this.ch).put("push_client_default_bitrate", this.ci).put("push_client_push_protocol", this.ck).put("push_client_qid", this.cl).put("push_client_hit_node_optimize", this.cj).put("open_dns_optimizer", this.cn ? 1 : 0).put("hit_node_optimize", this.cp ? 1 : 0).put("evaluator_symbol", this.co).put("remote_sorted", this.cq ? 1 : 0).put("common_tag", this.bQ).put("codec_type", this.c).put("codec_name", this.e).put("hardware_decode", this.d ? 1 : 0).put("sharp", this.cS ? 1 : 0).put("enable_hurry", this.f ? 1 : 0).put("hurry_time", this.g).put("catch_speed", new DecimalFormat("0.00").format(this.h)).put("slow_play_time", this.i).put("slow_speed", new DecimalFormat("0.00").format(this.j)).put("first_screen", this.ct ? 1 : 0).put("enable_httpDns", this.K ? 1 : 0).put("enable_ntp", this.y).put("enable_media_codec_async", this.L).put("default_codec_id", this.M).put("url_ability", this.N).put("max_cache_seconds", this.P).put("enable_fast_open", this.T).put("enable_mdl", this.B).put("enable_p2p", this.C).put("p2p_loader_type", this.F).put("used_p2p", this.D);
            String str8 = this.G;
            if (str8 == null) {
                str8 = SchedulerSupport.NONE;
            }
            JSONObject put8 = put7.put("mdl_version", str8).put("enable_mdl_proto", this.H).put("enable_low_latency_flv", this.aH);
            String str9 = this.bM.ar;
            if (str9 == null) {
                str9 = SchedulerSupport.NONE;
            }
            JSONObject put9 = put8.put("dns_ip", str9).put("in_main_looper", this.U).put("start_play_buffer_threshold", this.m).put("fast_open_gop_cache", this.n).put("buffering_end_ignore_video", this.o).put("start_direct_after_prepared", this.p).put("check_buffering_end_advance", this.q).put("channel_id", this.bM.ah);
            b bVar = this.bl;
            if (bVar == null) {
                bVar = this.bM;
            }
            JSONObject put10 = put9.put("sei_delay", bVar.af);
            b bVar2 = this.bl;
            if (bVar2 == null) {
                bVar2 = this.bM;
            }
            JSONObject put11 = put10.put("sei_source", bVar2.ag).put("chip_board", this.du).put("chip_hardware", this.dv).put("width", this.I).put("height", this.J).put("settings_info", this.ad).put("ttnet_nqe_info", this.ae).put("play_format", this.cs).put("play_protocol", this.dq).put("url_set_method", this.bN.getUrlSettingMethod()).put("enable_resolution_auto_degrade", this.af).put("has_abr_info", this.ah).put("quic_load_succ", this.ds).put("link_info", this.cm).put("used_texturerender", this.aa ? 1 : 0).put("settings_res", this.ai).put("is_too_large_av_diff", this.bM.aL).put("stall_retry_time_interval", this.w).put("is_too_large_av_diff", this.bM.aL).put("enable_rtc_play", this.aK).put("enable_mini_sdp", this.aL).put("rtc_play_fallback", this.aM).put("fallback_type", this.aT).put("mute_audio", this.be).put("volume_setting", this.bf).put("player_volume_setting", this.bg).put("enable_liveio_play", this.E).put("liveio_play", this.bq).put("liveio_p2p", this.br);
            if (this.E == 1) {
                put11.put("liveio_error_msg", this.bs);
                put11.put("liveio_version", this.bu);
            }
            if (y()) {
                put11.put("rtc_get_width", this.bN.getVideoWidth());
                put11.put("rtc_get_height", this.bN.getVideoHeight());
            }
            put11.put("live_stream_session_id", !this.aU.equals(SchedulerSupport.NONE) ? this.aU : this.t);
            if (this.ai.equals(v0.c)) {
                put11.put("auto_res", this.aj);
            }
            if (this.bN.getEnableTexturerender() == 1) {
                put11.put("texturerender_error", this.Y);
            }
            if (this.bN.getEnableSR() == 1 && this.bN.getEnableTexturerender() == 1) {
                if (this.bN.isUsedSR()) {
                    put11.put("sr_width", this.I * 2).put("sr_height", this.J * 2);
                    this.Z = true;
                } else {
                    put11.put("sr_width", this.I).put("sr_height", this.J);
                }
            }
            VideoLiveManager videoLiveManager = this.bN;
            if (videoLiveManager.mEnableSharpen == 1 && videoLiveManager.getEnableTexturerender() == 1) {
                put11.put("used_sharpen", this.bN.isUsedSharpen() ? 1 : 0);
                if (!this.eh) {
                    this.eh = this.bN.isUsedSharpen();
                }
            }
            if ((this.af || this.ah) && put11 != null) {
                put11.put("abr_strategy", this.ag).put("defualt_res_bitrate", this.am).put("stall_count_rad", this.au);
            }
            if (TextUtils.equals(this.dq, "quic") || TextUtils.equals(this.dq, "quicu")) {
                put11.put("quic_config_cached", this.bM.av).put("quic_CHLO_count", this.bM.aw);
            }
            if (this.bN.mEnableRadioLiveDisableRender == 1) {
                put11.put("disable_video_render", this.bd);
            }
            int i = this.R;
            if (i > 0) {
                put11.put("tsl_timeshift", i);
            }
            Map<String, String> map = this.bc;
            if (map != null) {
                Iterator<Map.Entry<String, String>> it = map.entrySet().iterator();
                while (true) {
                    if (!it.hasNext()) {
                        break;
                    }
                    Map.Entry<String, String> next = it.next();
                    if (next.getKey().equals("Host")) {
                        put11.put("headers_host", next.getValue().replace(" ", ""));
                        break;
                    }
                }
            }
            int i2 = this.bi;
            if (i2 != -1) {
                put11.put("fcdn_res_type", i2);
            }
            return put11;
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void b(int i) {
        VideoLiveManager videoLiveManager;
        if (this.ct || (videoLiveManager = this.bN) == null || this.bL == null) {
            return;
        }
        videoLiveManager.getLogInfo(this.bM, 2);
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "first_frame_failed").put("start_time", System.currentTimeMillis()).put("reason", i);
                a(b);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(int i, String str) {
        JSONObject b = b();
        if (b != null) {
            try {
                if (str.equals("cdn_to_p2p")) {
                    this.D = 1;
                }
                b.put("event_key", "p2p_switch").put("switch_info", str).put("p2p_vendor", SchedulerSupport.NONE).put("reason", i);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(long j) {
        this.bM.l = j;
        if (this.bk == 1) {
            this.bp = j;
        }
    }

    public void b(long j, int i, boolean z) {
        if (j > System.currentTimeMillis() - this.bM.a || j <= i) {
            MyLog.i(bI, "abnormal decode stall time" + j);
            return;
        }
        if (z) {
            this.dZ++;
            this.ea += j;
        } else {
            this.eb++;
            this.ec += j;
        }
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "decode_stall").put("type", z ? "video" : "audio").put("decode_stall_time", j);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j2 = this.u;
                if (j2 > 0) {
                    this.u = j2 + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(long j, long j2) {
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "timestamp_rollback").put("packet_type", "audio").put("timestamp_type", "dts").put("latest_ts", j2).put("previous_ts", j);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j3 = this.u;
                if (j3 > 0) {
                    this.u = j3 + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(long j, boolean z) {
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "pts_back").put("type", z ? "video" : "audio").put("pts_back_diff", j);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void b(String str) {
        this.dt = str;
    }

    public void b(String str, String str2) {
        this.dp = str;
        this.cs = str2;
    }

    public void b(boolean z) {
        this.cn = z;
    }

    public long c() {
        return this.bM.T;
    }

    public void c(int i) {
        if (this.cv == -100015) {
            this.cv = 0;
        }
        if (this.cG) {
            this.cG = false;
            JSONObject b = b();
            if (this.dk == null) {
                this.dk = new ArrayList<>();
            }
            this.dk.add(Long.valueOf(-(System.currentTimeMillis() - this.bM.a)));
            if (this.cO == 0) {
                this.cO = System.currentTimeMillis();
            }
            if (this.bk == 1 && this.dV == 0) {
                this.dV = System.currentTimeMillis();
            }
            this.bN.getLogInfo(this.bM, 6);
            if (b == null || this.cx == 0) {
                return;
            }
            try {
                if (this.cy != 0) {
                    this.cH++;
                    this.cI = (int) (this.cI + (System.currentTimeMillis() - this.cy));
                }
                this.cA++;
                this.cB += System.currentTimeMillis() - this.cx;
                if (this.bk == 1) {
                    this.dO++;
                    this.dP += System.currentTimeMillis() - this.cx;
                }
                b.put("event_key", "stall").put("stall_start", this.cx).put("stall_end", System.currentTimeMillis()).put("video_buffer_time_stall_start", this.bM.az).put("audio_buffer_time_stall_start", this.bM.aA).put("video_buffer_time_stall_end", this.bM.aB).put("audio_buffer_time_stall_end", this.bM.aC).put("last_res", this.ak).put("reason", this.cz).put("recover_reason", i);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void c(int i, String str) {
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "p2p_error").put("error_msg", str).put(COSHttpResponseKey.CODE, i);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void c(long j) {
        if (this.dD == null) {
            this.dD = new LinkedBlockingQueue<>(600);
        }
        if (this.dD.remainingCapacity() == 0 && this.dD.size() > 0) {
            this.dD.poll();
        }
        this.dD.offer(Long.valueOf(j));
    }

    public void c(String str) {
        this.bT = str;
    }

    public void c(String str, String str2) {
        this.dr = str;
        this.dq = str2;
    }

    public void c(boolean z) {
        this.d = z;
    }

    public int d() {
        return this.cQ;
    }

    public void d(int i) {
        this.cP++;
        this.cQ++;
        this.bN.getLogInfo(this.bM, 2);
        JSONObject b = b();
        r();
        if (b != null) {
            try {
                b.put("event_key", "retry").put("reason", this.cv).put(COSHttpResponseKey.CODE, i).put("render_fail_type", this.cw);
                a(b);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void d(long j) {
        if (j >= 1000) {
            this.ei = j;
        }
    }

    public void d(String str) {
        if (str == null) {
            return;
        }
        try {
            JSONObject jSONObject = new JSONObject(str);
            if (jSONObject.has("sdk_version")) {
                this.ca = jSONObject.getString("sdk_version");
            }
            if (jSONObject.has("platform")) {
                this.cb = jSONObject.getString("platform");
            }
            if (jSONObject.has("os_version")) {
                this.cc = jSONObject.getString("os_version");
            }
            if (jSONObject.has("model")) {
                this.f1696cd = jSONObject.getString("model");
            }
            if (jSONObject.has("start_time")) {
                this.ce = jSONObject.getString("start_time");
            }
            if (jSONObject.has("is_hardware_encode")) {
                this.cf = jSONObject.getInt("is_hardware_encode");
            }
            if (jSONObject.has("min_bitrate")) {
                this.cg = jSONObject.getInt("min_bitrate");
            }
            if (jSONObject.has("max_bitrate")) {
                this.ch = jSONObject.getInt("max_bitrate");
            }
            if (jSONObject.has("default_bitrate")) {
                this.ci = jSONObject.getInt("default_bitrate");
            }
            if (jSONObject.has("hit_node_optimize")) {
                this.cj = jSONObject.getInt("hit_node_optimize");
            }
            if (jSONObject.has("push_protocol")) {
                this.ck = jSONObject.getString("push_protocol");
            }
            if (jSONObject.has("qId")) {
                this.cl = jSONObject.getString("qId");
            }
            if (jSONObject.has("link_info")) {
                this.cm = jSONObject.getString("link_info");
            }
            if (jSONObject.has("h_id")) {
                this.bi = jSONObject.getInt("h_id");
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public int e() {
        return (int) this.cA;
    }

    public void e(int i) {
        boolean z;
        String str;
        long j;
        if (this.bN == null) {
            return;
        }
        JSONObject b = b();
        this.bN.getLogInfo(this.bM, 7);
        int i2 = this.bk;
        String str2 = SchedulerSupport.NONE;
        int i3 = 1;
        if (i2 == 1) {
            this.dX = i;
            this.dY = i != 0 ? this.bN.getPlayerErrorInfo() : SchedulerSupport.NONE;
        }
        if (b == null) {
            return;
        }
        try {
            long j2 = this.ay;
            if (j2 > 0) {
                long j3 = this.az;
                if (j3 > 0 && j2 < j3) {
                    z = true;
                    JSONObject put = b.put("event_key", "prepare_result").put("error_msg", i == 0 ? this.bN.getPlayerErrorInfo() : SchedulerSupport.NONE).put(a2.c, i);
                    str = this.bZ;
                    if (str == null) {
                        str2 = str;
                    }
                    JSONObject put2 = put.put("sdk_params", str2).put("first_audio_packet_dts_rollback", !z ? 1 : 0).put("first_audio_packet_dts", this.ay).put("previous_audio_packet_dts", this.az).put("stream_type", this.bM.aI).put("suggest_format", this.dp).put("suggest_protocol", this.dr);
                    if (!this.bN.getSRState() && !this.bN.getSharpenState()) {
                        i3 = 0;
                    }
                    put2.put("nnsr_enabled", i3);
                    this.bL.onMonitorLog(b, "live_client_monitor_log");
                    j = this.u;
                    if (j <= 0) {
                        this.u = j + 1;
                        return;
                    }
                    return;
                }
            }
            z = false;
            JSONObject put3 = b.put("event_key", "prepare_result").put("error_msg", i == 0 ? this.bN.getPlayerErrorInfo() : SchedulerSupport.NONE).put(a2.c, i);
            str = this.bZ;
            if (str == null) {
            }
            JSONObject put22 = put3.put("sdk_params", str2).put("first_audio_packet_dts_rollback", !z ? 1 : 0).put("first_audio_packet_dts", this.ay).put("previous_audio_packet_dts", this.az).put("stream_type", this.bM.aI).put("suggest_format", this.dp).put("suggest_protocol", this.dr);
            if (!this.bN.getSRState()) {
                i3 = 0;
            }
            put22.put("nnsr_enabled", i3);
            this.bL.onMonitorLog(b, "live_client_monitor_log");
            j = this.u;
            if (j <= 0) {
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void e(String str) {
        long j;
        long j2;
        long j3;
        long j4;
        long j5;
        int i;
        if (this.ct) {
            d(true);
        } else {
            this.bN.getLogInfo(this.bM, 2);
            this.dw = this.cQ;
            this.dx = this.aA;
        }
        h();
        A();
        JSONObject b = b();
        if (b != null) {
            try {
                if (this.ct) {
                    j = System.currentTimeMillis() - this.cu;
                    j2 = 0;
                } else if (this.cv != 0 || this.bM.a == 0) {
                    j = 0;
                    j2 = 0;
                } else {
                    j2 = System.currentTimeMillis() - this.bM.a;
                    j = 0;
                }
                long j6 = this.cN;
                if (j6 > 0) {
                    j4 = j6 - this.bM.k;
                    j3 = this.cO - j6;
                } else {
                    j3 = 0;
                    j4 = 0;
                }
                if (l()) {
                    this.cA++;
                    this.cB += System.currentTimeMillis() - this.cx;
                }
                if (!u() || this.cV == 0) {
                    j5 = j2;
                } else {
                    this.cW++;
                    j5 = j2;
                    this.cX += System.currentTimeMillis() - this.cV;
                }
                r();
                long j7 = this.ax + this.bM.T;
                JSONObject put = b.put("event_key", "play_stop").put("stop_time", System.currentTimeMillis()).put("play_time", j).put("is_stream_received", this.ct ? 1 : 0).put("render_fail_type", this.cw).put(COSHttpResponseKey.CODE, this.cv).put("stall_count", this.cA).put("stall_time", this.cB).put("audio_render_stall_count", this.cE).put("audio_render_stall_time", this.cF).put("video_render_stall_count", this.cC).put("video_render_stall_time", this.cD).put("video_decode_stall_count", this.dZ).put("video_decode_stall_time", this.ea).put("audio_decode_stall_count", this.eb).put("audio_decode_stall_time", this.ec).put("video_demux_stall_count", this.ed).put("video_demux_stall_time", this.ee).put("audio_demux_stall_count", this.ef).put("audio_demux_stall_time", this.eg).put("error_recover_count", this.cW).put("error_recover_time", this.cX).put(IntentAction.start, this.bM.a).put("sdk_dns_analysis_end", this.bM.b).put("http_req_finish_time", this.bM.R).put("http_res_finish_time", this.bM.S).put("first_video_package_end", this.bM.g).put("first_audio_package_end", this.bM.h).put("first_video_frame_decode_end", this.bM.i).put("first_audio_frame_decode_end", this.bM.j).put("first_frame_render_end", this.bM.k).put("first_audio_frame_end", this.bM.l).put("video_device_open_start", this.bM.o).put("video_device_open_end", this.bM.p).put("audio_device_open_start", this.bM.q).put("audio_device_open_end", this.bM.r).put("video_device_wait_start", this.bM.ap).put("video_device_wait_end", this.bM.aq).put("find_stream_info_start", this.bM.an).put("find_stream_info_end", this.bM.ao).put("video_param_send_outlet_time", this.bM.ak).put("first_video_frame_send_outlet_time", this.bM.al).put("video_first_pkt_pos", this.bM.L).put("video_first_pkt_pts", this.bM.M).put("audio_first_pkt_pos", this.bM.N).put("audio_first_pkt_pts", this.bM.O).put("set_surface_time", this.W).put("set_surface_cost", this.V).put("video_render_type", this.bM.am).put("prepare_block_end", this.bM.c).put("prepare_end", this.bM.n).put("retry_count", this.cQ).put("download_speed", this.bM.ab).put("video_buffer_time", this.bM.ac).put("audio_buffer_time", this.bM.ad);
                long j8 = this.bM.ae;
                if (j8 <= 0) {
                    j8 = -j8;
                }
                JSONObject put2 = put.put("wait_time", j8).put("is_waiting", this.bM.ae >= 0 ? 0 : 1).put("first_stall_time", j4).put("first_stall_duration", j3).put("call_api_name", str).put("play_time_on_no_frame", j5).put("abr_switch_count", this.an).put("abr_switch_count_info", this.ao);
                String str2 = this.bZ;
                if (str2 == null) {
                    str2 = SchedulerSupport.NONE;
                }
                put2.put("sdk_params", str2).put("total_download_size", j7).put("drop_audio_pts_diff", this.bM.P).put("drop_audio_cost", this.bM.Q).put("first_frame_retry_count", this.dw).put("first_frame_retry_duration", this.dx).put("abr_check_enhance", this.aJ).put("sr_used", this.Z ? 1 : 0).put("sharpen_used", this.eh ? 1 : 0).put("network_timeout", this.aB).put("suggest_format", this.dp).put("suggest_protocol", this.dr).put("session_num", this.dN).put("use_live_threadpool", this.bH);
                JSONArray jSONArray = this.bM.aJ;
                if (jSONArray != null) {
                    b.put("abr_stream_info", jSONArray);
                }
                int i2 = this.r;
                if (i2 != -1) {
                    b.put("audio_timescale_enable", i2);
                }
                JSONArray jSONArray2 = this.bM.aM;
                if (jSONArray2 != null) {
                    b.put("avph_stream_info", jSONArray2);
                }
                if (this.bN.getEnableTexturerender() == 1) {
                    b.put("render_start_timestamp", this.ac);
                    b.put("texturerender_renderstart_timestamp", this.bj);
                }
                int i3 = this.bx;
                if (i3 > 0) {
                    b.put("av_out_sync_count", i3).put("av_out_sync_duration", this.bz).put("av_out_sync_info", this.bF);
                }
                a(b);
                if (y()) {
                    b.put("player_dns_analysis_end", this.aP);
                    b.put("rtc_use_sdk_dns", this.aO);
                    b.put("tcp_connect_end", this.aQ);
                    b.put("rtc_tls_handshake_end", this.aR);
                    b.put("tcp_first_package_end", this.aS);
                    b.put("rtc_inited_end", this.bM.aD);
                    b.put("rtc_offer_send_end", this.bM.aE);
                    b.put("rtc_answer_recv_end", this.bM.aF);
                    b.put("rtc_start_end", this.bM.aG);
                    b.put("rtc_playstop_info", this.aV);
                } else {
                    b.put("tcp_first_package_end", this.bM.f);
                    b.put("player_dns_analysis_end", this.bM.d);
                    b.put("tcp_connect_end", this.bS == null ? this.bM.e : this.dq.equals("kcp") ? this.bM.d : this.bM.e);
                }
                String str3 = this.cs;
                if (str3 != null && (str3.equals("cmaf") || this.cs.equals("avph"))) {
                    b.put("video_dns_analysis_end", this.bM.D).put("audio_dns_analysis_end", this.bM.E).put("video_tcp_connect_time", this.bM.B).put("audio_tcp_connect_time", this.bM.C).put("video_tcp_first_packet_time", this.bM.F).put("audio_tcp_first_packet_time", this.bM.G).put("video_http_req_finish_time", this.bM.H).put("audio_http_req_finish_time", this.bM.I).put("video_http_res_finish_time", this.bM.J).put("audio_http_res_finish_time", this.bM.K);
                    if (this.cs.equals("cmaf")) {
                        b.put("cmaf_mpd_dns_analysis_end", this.bM.t).put("cmaf_mpd_tcp_connect_time", this.bM.u).put("cmaf_mpd_tcp_first_package_end", this.bM.w).put("cmaf_mpd_http_req_finish_time", this.bM.v).put("cmaf_mpd_http_res_finish_time", this.bM.x).put("cmaf_audio_firstseg_connect_time", this.bM.z).put("cmaf_video_firstseg_connect_time", this.bM.A).put("cmaf_mpd_connect_time", this.bM.y);
                    }
                }
                if (this.O) {
                    b.put("session_time_series", z());
                }
                if (this.cT) {
                    b.put("expected_sei_count", this.dJ);
                    b.put("received_sei_count", this.dK);
                    b.put("expected_unique_sei_count", this.dL);
                    b.put("received_unique_sei_count", this.dM);
                }
                int i4 = this.aW;
                if (i4 != 0) {
                    b.put("bitrate_amnormal", i4);
                }
                int i5 = this.aX;
                if (i5 != 0) {
                    b.put("abr_codec_not_same", i5);
                }
                if (this.aY == 0) {
                    i = 1;
                    b.put("abr_list_not_match", 1);
                } else {
                    i = 1;
                }
                if (TextUtils.equals(this.dq, "quic") || TextUtils.equals(this.dq, "quicu")) {
                    b.put("scfg", this.aC).put("mtu", this.aD).put("pad_hello", this.aE).put("timer_version", this.aF);
                }
                boolean z = this.aZ;
                if (z) {
                    if (!z) {
                        i = 0;
                    }
                    b.put("cdn_abr_switch_performed", i).put("cdn_abr_switch_code", this.ba);
                }
                long j9 = this.u + 1;
                this.u = j9;
                b.put("log_total_count_when_playing", j9);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                this.u = 0L;
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void f() {
        if (this.ct) {
            return;
        }
        this.bM.c = System.currentTimeMillis();
        b bVar = this.bl;
        if (bVar != null) {
            bVar.c = System.currentTimeMillis();
        }
    }

    public void f(int i) {
        this.cR = i > 0;
        this.v = i <= 0 ? -1 : 0;
    }

    public void f(String str) {
        VideoLiveManager videoLiveManager = this.bN;
        if (videoLiveManager == null || this.bL == null) {
            return;
        }
        videoLiveManager.getLogInfo(this.bM, 2);
        JSONObject b = b();
        if (b != null) {
            try {
                b.put("event_key", "illegal_call").put(z0.i, str);
                a(b);
                this.bL.onMonitorLog(b, "live_client_monitor_log");
                long j = this.u;
                if (j > 0) {
                    this.u = j + 1;
                }
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
    }

    public void g() {
        b bVar = this.bl;
        if (bVar != null) {
            bVar.n = System.currentTimeMillis();
        }
        if (this.ct) {
            return;
        }
        this.bM.n = System.currentTimeMillis();
    }

    public void g(String str) {
        JSONObject b;
        if (this.bN == null || this.bL == null || (b = b()) == null) {
            return;
        }
        try {
            b.put("event_key", "call_not_in_main_thread").put(z0.i, str);
            this.bL.onMonitorLog(b, "live_client_monitor_log");
            long j = this.u;
            if (j > 0) {
                this.u = j + 1;
            }
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    public void h() {
        b bVar;
        long j;
        long j2;
        long j3;
        long j4;
        if (this.bk == 0 || (bVar = this.bl) == null) {
            return;
        }
        this.bN.getSessionlogInfo(bVar);
        JSONObject b = b();
        boolean z = this.bm;
        long currentTimeMillis = System.currentTimeMillis();
        if (z) {
            j2 = currentTimeMillis - this.bo;
            j = 0;
        } else {
            j = currentTimeMillis - this.bn;
            j2 = 0;
        }
        this.dN++;
        long j5 = this.dU;
        if (j5 > 0) {
            j3 = j5 - this.bo;
            j4 = this.dV - j5;
        } else {
            j3 = 0;
            j4 = 0;
        }
        if (l()) {
            this.dO++;
            this.dP += System.currentTimeMillis() - this.cx;
        }
        s();
        long j6 = this.bl.T;
        if (b != null) {
            try {
                JSONObject put = b.put("event_key", "session_stop").put("index", this.dN).put("stop_time", System.currentTimeMillis()).put("play_time", j2).put("is_stream_received", this.bm ? 1 : 0).put("render_fail_type", this.dW).put(COSHttpResponseKey.CODE, this.dX).put("stall_count", this.dO).put("stall_time", this.dP).put("audio_render_stall_count", this.dS).put("audio_render_stall_time", this.dT).put("video_render_stall_count", this.dQ).put("video_render_stall_time", this.dR).put(IntentAction.start, this.bn).put("sdk_dns_analysis_end", this.bl.b).put("player_dns_analysis_end", this.bM.d).put("http_req_finish_time", this.bl.R).put("http_res_finish_time", this.bl.S).put("tcp_first_package_end", this.bM.f).put("first_video_package_end", this.bl.g).put("first_audio_package_end", this.bl.h).put("first_video_frame_decode_end", this.bl.i).put("first_audio_frame_decode_end", this.bl.j).put("video_device_open_start", this.bl.o).put("video_device_open_end", this.bl.p).put("audio_device_open_start", this.bl.q).put("audio_device_open_end", this.bl.r).put("video_device_wait_start", this.bl.ap).put("video_device_wait_end", this.bl.aq).put("find_stream_info_start", this.bl.an).put("find_stream_info_end", this.bl.ao).put("video_param_send_outlet_time", this.bl.ak).put("first_video_frame_send_outlet_time", this.bl.al).put("first_frame_render_end", this.bo).put("first_audio_frame_end", this.bp).put("prepare_end", this.bl.n).put("prepare_block_end", this.bl.c).put("video_first_pkt_pos", this.bl.L).put("video_first_pkt_pts", this.bl.M).put("audio_first_pkt_pos", this.bl.N).put("audio_first_pkt_pts", this.bl.O).put("video_render_type", this.bl.am).put("download_speed", this.bl.ab).put("video_buffer_time", this.bl.ac).put("audio_buffer_time", this.bl.ad).put("wait_time", this.bl.ae > 0 ? this.bM.ae : -this.bM.ae).put("is_waiting", this.bl.ae >= 0 ? 0 : 1).put("first_stall_time", j3).put("first_stall_duration", j4).put("play_time_on_no_frame", j);
                String str = this.bZ;
                if (str == null) {
                    str = SchedulerSupport.NONE;
                }
                put.put("sdk_params", str).put("total_download_size", j6).put("drop_audio_pts_diff", this.bl.P).put("drop_audio_cost", this.bl.Q).put("sr_used", this.Z ? 1 : 0).put("sharpen_used", this.eh ? 1 : 0).put("network_timeout", this.aB).put("suggest_format", this.dp).put("suggest_protocol", this.dr).put("error_msg", this.dY);
                b.put("tcp_connect_end", this.bS == null ? this.bl.e : this.dq.equals("kcp") ? this.bl.d : this.bl.e);
                this.u++;
                this.bL.onMonitorLog(b, "live_client_monitor_log");
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        A();
    }

    public void h(String str) {
        this.bR = str;
    }

    @Override
    public boolean handleMessage(Message message) {
        int i = message.what;
        if (101 == i) {
            d(false);
        }
        if (102 != i) {
            return true;
        }
        C();
        return true;
    }

    public void i() {
        this.bS = SchedulerSupport.NONE;
        this.bT = SchedulerSupport.NONE;
        this.bU = SchedulerSupport.NONE;
        this.bV = false;
        this.bY = 0L;
        this.ca = SchedulerSupport.NONE;
        this.cb = SchedulerSupport.NONE;
        this.cc = SchedulerSupport.NONE;
        this.f1696cd = SchedulerSupport.NONE;
        this.ce = SchedulerSupport.NONE;
        this.cf = -1;
        this.cg = -1;
        this.ch = -1;
        this.ci = -1;
        this.cj = -1;
        this.ck = SchedulerSupport.NONE;
        this.cl = SchedulerSupport.NONE;
        this.co = SchedulerSupport.NONE;
        this.cp = false;
        this.cq = false;
        this.cr = false;
        this.av = false;
        this.dg = -1;
        this.f = false;
        this.g = -1;
        this.h = -1.0f;
        this.i = -1;
        this.j = -1.0f;
        this.k = 0;
        this.l = SchedulerSupport.NONE;
        this.m = 0L;
        this.n = -1;
        this.o = 0;
        this.p = 0;
        this.q = 0;
        this.M = -1;
        this.L = 0;
        this.ct = false;
        this.cu = 0L;
        this.cv = 0;
        this.cx = 0L;
        this.cz = -1L;
        this.cA = 0L;
        this.cB = 0L;
        this.cD = 0L;
        this.cC = 0L;
        this.cF = 0L;
        this.cE = 0L;
        this.cW = 0L;
        this.cX = 0L;
        this.cU = false;
        this.cG = false;
        this.cH = 0;
        this.cI = 0;
        this.cL = 0;
        this.cM = 0;
        this.cJ = 0;
        this.cK = 0;
        this.cy = 0L;
        this.cN = 0L;
        this.cO = 0L;
        this.cP = 0;
        this.cQ = 0;
        this.v = -1;
        this.dc = false;
        this.A = 0L;
        this.y = 0;
        this.z = 0;
        this.I = 0;
        this.J = 0;
        this.P = -1;
        this.Z = false;
        this.Y = 0;
        this.aa = false;
        this.ab = -1.0f;
        this.ac = 0L;
        this.bj = 0L;
        this.dh = null;
        this.di = null;
        this.dj = null;
        this.dm = null;
        this.dn = null;
        this.dl = null;
        this.dk = null;
        b bVar = this.bM;
        if (bVar != null) {
            bVar.a();
        }
        this.e = SchedulerSupport.NONE;
        this.c = SchedulerSupport.NONE;
        this.U = 1;
        this.s = SchedulerSupport.NONE;
        this.t = SchedulerSupport.NONE;
        this.ad = SchedulerSupport.NONE;
        this.ae = SchedulerSupport.NONE;
        this.C = 0;
        this.B = 0;
        this.D = 0;
        this.F = -1;
        this.ax = 0L;
        this.aw = 0L;
        this.af = false;
        this.ah = false;
        this.ag = "rad";
        this.ai = s0.a.P;
        this.aj = s0.a.P;
        this.ak = SchedulerSupport.NONE;
        this.am = -1;
        this.al = -1L;
        this.an = 0;
        this.ao = SchedulerSupport.NONE;
        this.at = SchedulerSupport.NONE;
        this.ap = -1L;
        this.aq = -1L;
        this.ar = -1L;
        this.as = -1L;
        this.au = 4;
        this.aB = -1;
        this.aD = -1;
        this.aC = -1;
        this.aE = -1;
        this.aF = -1;
        this.dw = 0;
        this.dx = 0L;
        this.aA = 0L;
        this.aG = 0;
        this.aH = 0;
        this.aI = null;
        this.aJ = 0;
        this.aQ = 0L;
        this.aS = 0L;
        this.aR = 0L;
        this.aM = 0;
        this.aT = 0;
        this.aU = SchedulerSupport.NONE;
        this.aV = SchedulerSupport.NONE;
        this.bd = 0;
        this.bb = SchedulerSupport.NONE;
        this.bc = null;
        this.bh = 0;
        this.bi = -1;
        this.bk = 0;
        this.dN = 0;
        this.dZ = 0L;
        this.ea = 0L;
        this.eb = 0L;
        this.ec = 0L;
        this.ed = 0L;
        this.ee = 0L;
        this.ef = 0L;
        this.eg = 0L;
        this.bx = 0;
        this.by = 0;
        this.bz = 0L;
        this.bA = 0L;
        this.bB = 0L;
        this.bC = 0L;
        this.bG = "";
        this.bF = "";
        this.E = 0;
        this.bq = 0;
        this.br = 0;
        this.bs = SchedulerSupport.NONE;
        this.bt = 0L;
        this.bu = SchedulerSupport.NONE;
        this.bH = 0;
    }

    public void i(String str) {
        this.bW = str;
    }

    public void j() {
        this.z = 1;
        this.y = 1;
        if (this.da == null) {
            C0809a c0809a = new C0809a(this);
            this.da = c0809a;
            c0809a.a(104, 0L);
        }
    }

    public void j(String str) {
        if (str != null) {
            this.bQ = str;
        }
    }

    public void k() {
        this.cS = true;
    }

    public void k(String str) {
        this.c = str;
    }

    public void l(String str) {
        this.bZ = str;
    }

    public boolean l() {
        return this.cG;
    }

    public boolean m() {
        return this.bX;
    }

    public void n() {
        this.cT = true;
    }

    public void o() {
        b bVar;
        VideoLiveManager videoLiveManager = this.bN;
        if (videoLiveManager == null || (bVar = this.bM) == null) {
            return;
        }
        videoLiveManager.getLogInfo(bVar, 8);
    }

    public void p() {
        b bVar;
        VideoLiveManager videoLiveManager = this.bN;
        if (videoLiveManager == null || (bVar = this.bM) == null) {
            return;
        }
        videoLiveManager.getLogInfo(bVar, 9);
    }

    public JSONObject q() {
        b bVar = new b();
        this.bN.getLogInfo(bVar, 1);
        try {
            JSONObject put = new JSONObject().put("playing_time:", System.currentTimeMillis() - this.cu).put("live_sdk_version:", "1.4.6.26-lite");
            String str = this.bW;
            String str2 = "-1";
            if (str == null) {
                str = "-1";
            }
            JSONObject put2 = put.put("player_sdk_version:", str);
            String str3 = this.bU;
            if (str3 != null) {
                str2 = str3;
            }
            JSONObject put3 = put2.put("cdn_ip:", str2).put("push_client_sdk_version:", this.ca).put("push_client_platform:", this.cb).put("push_client_model:", this.f1696cd).put("push_client_os_version:", this.cc).put("push_client_is_hardware_encode:", this.cf).put("push_client_push_protocol:", this.ck).put("push_client_qid:", this.cl).put("push_client_bitrate:", this.bM.ai).put("push_client_fps:", this.bM.aj).put("Hit_Node_Optimizer:", this.cp ? 1 : 0).put("Evaluator_Symbol:", this.co).put("Is_Remote_Sorted:", this.cq ? 1 : 0).put("Stall_Total_Count:", this.cA).put("Stall_Total_Time:", this.cB);
            long j = this.cz;
            JSONObject put4 = put3.put("Stall_Reason:", j == -1 ? "no stall" : j == 0 ? "network stall" : "decode stall").put("audio_Render_Stall_Total_Count:", this.cE).put("audio_Render_Stall_Total_Time:", this.cF).put("video_Render_Stall_Total_Count:", this.cC).put("video_Render_Stall_Total_Time:", this.cD);
            b bVar2 = this.bM;
            return put4.put("first_frame_time:", bVar2.k - bVar2.a).put("video_Buffer_Time:", bVar.Z).put("audio_Buffer_Time:", bVar.aa).put("delay:", this.bM.af).put("render_fps:", bVar.X).put("sei_source:", this.bM.ag).put("download_Speed:", bVar.Y).put("Error_Code:", this.cv).put("HardDecode:", this.d).put("Codec_Type:", this.c).put("Codec_Name:", this.e).put("MDL_Vendor:", this.D == 1 ? "PCDN" : this.B == 1 ? "Http-CDN" : SchedulerSupport.NONE).put("audio_Buffer_Time_On_First_Frame:", this.bM.ad).put("waiting_Time_After_First_Frame:", this.bM.ae).put("dns_ip:", this.bM.ar).put("url:", this.bS).put("width:", this.I).put("height:", this.J).put("resolution:", bVar.as).put("play_format:", this.cs).put("play_protocol:", this.dq).put("settings_res:", this.ai).put("enable_resolution_auto_degrade:", this.af);
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
    }

    public void r() {
        b bVar = this.bM;
        long j = bVar.l;
        this.cw = (j <= 0 || bVar.k <= 0) ? (j <= 0 || bVar.k > 0) ? (j > 0 || bVar.k <= 0) ? 3 : 2 : 1 : 0;
    }

    public void s() {
        long j = this.bp;
        this.dW = (j <= 0 || this.bo <= 0) ? (j <= 0 || this.bo > 0) ? (j > 0 || this.bo <= 0) ? 3 : 2 : 1 : 0;
    }

    public void t() {
        this.cU = true;
        this.cV = System.currentTimeMillis();
    }

    public boolean u() {
        return this.cU;
    }

    public void v() {
        this.cU = false;
        String str = "recover from error time " + (System.currentTimeMillis() - this.cV);
        if (this.cV != 0) {
            this.cW++;
            this.cX += System.currentTimeMillis() - this.cV;
        }
    }

    public void w() {
        LinkedBlockingQueue<Long> linkedBlockingQueue = this.dD;
        if (linkedBlockingQueue != null) {
            linkedBlockingQueue.clear();
            this.dD = null;
        }
        this.dF = -1;
        this.dG = -1;
        this.dH = -1L;
        this.dI = -1;
        this.dF = -1;
    }

    public JSONObject x() {
        Long l = 0L;
        ArrayList<Long> arrayList = this.di;
        if (arrayList != null && !arrayList.isEmpty()) {
            Iterator<Long> it = this.di.iterator();
            while (it.hasNext()) {
                l = Long.valueOf(l.longValue() + it.next().longValue());
            }
            l = Long.valueOf(l.longValue() / this.di.size());
        }
        try {
            JSONObject jSONObject = new JSONObject();
            String str = this.bS;
            if (str == null) {
                str = "-1";
            }
            JSONObject put = jSONObject.put("cdn_play_url", str);
            String str2 = this.bU;
            if (str2 == null) {
                str2 = SchedulerSupport.NONE;
            }
            return put.put("cdn_ip", str2).put("pull_stream_bitrate", l);
        } catch (JSONException e) {
            e.printStackTrace();
            return null;
        }
    }

    public boolean y() {
        return this.aK == 1 && this.aM == 0;
    }
}