b.smali

.class public Lcom/kwai/player/qos/b;
.super Ljava/lang/Object;


# instance fields
.field a:Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;

.field private b:Lcom/kwai/player/qos/a;

.field private c:Ljava/lang/Object;

.field private d:Ljava/util/Timer;

.field private e:Ljava/util/TimerTask;

.field private f:I

.field private g:Z

.field private h:Z

.field private i:J

.field private final j:J

.field private k:J

.field private l:J

.field private m:J

.field private n:J

.field private o:J

.field private p:J

.field private q:J

.field private r:I

.field private s:J


# direct methods
.method public constructor <init>(JJLcom/kwai/player/qos/a;Ljava/lang/Object;)V
    .registers 10

    const/4 v2, 0x0

    const-wide/16 v0, 0x0

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->k:J

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->l:J

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->m:J

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->n:J

    iput-wide p1, p0, Lcom/kwai/player/qos/b;->i:J

    iput-wide p3, p0, Lcom/kwai/player/qos/b;->j:J

    iput-object p5, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    iput-object p6, p0, Lcom/kwai/player/qos/b;->c:Ljava/lang/Object;

    iput-boolean v2, p0, Lcom/kwai/player/qos/b;->g:Z

    iput v2, p0, Lcom/kwai/player/qos/b;->f:I

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->p:J

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->q:J

    iput v2, p0, Lcom/kwai/player/qos/b;->r:I

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->s:J

    return-void
.end method

.method static synthetic a(Lcom/kwai/player/qos/b;)J
    .registers 3

    iget-wide v0, p0, Lcom/kwai/player/qos/b;->l:J

    return-wide v0
.end method

.method static synthetic a(Lcom/kwai/player/qos/b;J)J
    .registers 4

    iput-wide p1, p0, Lcom/kwai/player/qos/b;->l:J

    return-wide p1
.end method

.method static synthetic b(Lcom/kwai/player/qos/b;)J
    .registers 3

    iget-wide v0, p0, Lcom/kwai/player/qos/b;->j:J

    return-wide v0
.end method


# virtual methods
.method public a()V
    .registers 5

    const/4 v1, 0x0

    iget-boolean v0, p0, Lcom/kwai/player/qos/b;->g:Z

    if-nez v0, :cond_6

    :goto_5
    return-void

    :cond_6
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/kwai/player/qos/b;->g:Z

    iget-object v0, p0, Lcom/kwai/player/qos/b;->e:Ljava/util/TimerTask;

    if-eqz v0, :cond_14

    iget-object v0, p0, Lcom/kwai/player/qos/b;->e:Ljava/util/TimerTask;

    invoke-virtual {v0}, Ljava/util/TimerTask;->cancel()Z

    iput-object v1, p0, Lcom/kwai/player/qos/b;->e:Ljava/util/TimerTask;

    :cond_14
    iget-object v0, p0, Lcom/kwai/player/qos/b;->d:Ljava/util/Timer;

    if-eqz v0, :cond_1f

    iget-object v0, p0, Lcom/kwai/player/qos/b;->d:Ljava/util/Timer;

    invoke-virtual {v0}, Ljava/util/Timer;->cancel()V

    iput-object v1, p0, Lcom/kwai/player/qos/b;->d:Ljava/util/Timer;

    :cond_1f
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iget-wide v2, p0, Lcom/kwai/player/qos/b;->l:J

    sub-long v2, v0, v2

    invoke-virtual {p0, v2, v3}, Lcom/kwai/player/qos/b;->b(J)V

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->l:J

    goto :goto_5
.end method

.method public a(J)V
    .registers 4

    iput-wide p1, p0, Lcom/kwai/player/qos/b;->n:J

    return-void
.end method

.method public a(Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;)V
    .registers 8

    iget-boolean v0, p0, Lcom/kwai/player/qos/b;->g:Z

    if-eqz v0, :cond_5

    :goto_4
    return-void

    :cond_5
    const/4 v0, 0x1

    iput-boolean v0, p0, Lcom/kwai/player/qos/b;->g:Z

    iput-object p1, p0, Lcom/kwai/player/qos/b;->a:Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->m:J

    new-instance v0, Ljava/util/Timer;

    invoke-direct {v0}, Ljava/util/Timer;-><init>()V

    iput-object v0, p0, Lcom/kwai/player/qos/b;->d:Ljava/util/Timer;

    new-instance v0, Lcom/kwai/player/qos/b$1;

    invoke-direct {v0, p0}, Lcom/kwai/player/qos/b$1;-><init>(Lcom/kwai/player/qos/b;)V

    iput-object v0, p0, Lcom/kwai/player/qos/b;->e:Ljava/util/TimerTask;

    iget-object v0, p0, Lcom/kwai/player/qos/b;->d:Ljava/util/Timer;

    iget-object v1, p0, Lcom/kwai/player/qos/b;->e:Ljava/util/TimerTask;

    iget-wide v2, p0, Lcom/kwai/player/qos/b;->i:J

    iget-wide v4, p0, Lcom/kwai/player/qos/b;->i:J

    invoke-virtual/range {v0 .. v5}, Ljava/util/Timer;->schedule(Ljava/util/TimerTask;JJ)V

    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->k:J

    iget-wide v0, p0, Lcom/kwai/player/qos/b;->k:J

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->l:J

    goto :goto_4
.end method

.method public a(Z)V
    .registers 2

    iput-boolean p1, p0, Lcom/kwai/player/qos/b;->h:Z

    return-void
.end method

.method public b(J)V
    .registers 6

    iget-object v0, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v0}, Lcom/kwai/player/qos/a;->isMediaPlayerValid()Z

    move-result v0

    if-eqz v0, :cond_1f

    invoke-virtual {p0, p1, p2}, Lcom/kwai/player/qos/b;->c(J)Lorg/json/JSONObject;

    move-result-object v0

    iget-object v1, p0, Lcom/kwai/player/qos/b;->a:Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;

    if-eqz v1, :cond_19

    if-eqz v0, :cond_19

    iget-object v1, p0, Lcom/kwai/player/qos/b;->a:Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;

    iget-object v2, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v1, v2, v0}, Lcom/kwai/video/player/IMediaPlayer$OnLiveAdaptiveQosStatListener;->onLiveAdaptiveQosStat(Lcom/kwai/video/player/IMediaPlayer;Lorg/json/JSONObject;)V

    :cond_19
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v0

    iput-wide v0, p0, Lcom/kwai/player/qos/b;->m:J

    :cond_1f
    return-void
.end method

.method public c(J)Lorg/json/JSONObject;
    .registers 13

    const-wide/16 v8, 0x0

    iget-object v2, p0, Lcom/kwai/player/qos/b;->c:Ljava/lang/Object;

    monitor-enter v2

    :try_start_5
    iget-object v0, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v0}, Lcom/kwai/player/qos/a;->getAppLiveAdaptiveRealtimeInfo()Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;

    move-result-object v1

    if-nez v1, :cond_10

    const/4 v0, 0x0

    monitor-exit v2

    :goto_f
    return-object v0

    :cond_10
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0}, Lorg/json/JSONObject;-><init>()V
    :try_end_15
    .catchall {:try_start_5 .. :try_end_15} :catchall_e8

    :try_start_15
    const-string v3, "play_url"

    iget-object v4, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v4}, Lcom/kwai/player/qos/a;->getKflvVideoPlayingUrl()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "play_start_time"

    iget-wide v4, p0, Lcom/kwai/player/qos/b;->n:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "tick_start"

    iget-wide v4, p0, Lcom/kwai/player/qos/b;->m:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "stream_id"

    iget-object v4, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v4}, Lcom/kwai/player/qos/a;->getStreamId()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "server_ip"

    iget-object v4, p0, Lcom/kwai/player/qos/b;->b:Lcom/kwai/player/qos/a;

    invoke-interface {v4}, Lcom/kwai/player/qos/a;->getServerAddress()Ljava/lang/String;

    move-result-object v4

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;Ljava/lang/Object;)Lorg/json/JSONObject;

    const-string v3, "v_buf_time"

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->videoBufferTime:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "a_buf_time"

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->audioBufferTime:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "index"

    iget-wide v4, p0, Lcom/kwai/player/qos/b;->s:J

    const-wide/16 v6, 0x1

    add-long/2addr v4, v6

    iput-wide v4, p0, Lcom/kwai/player/qos/b;->s:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    iget-boolean v3, p0, Lcom/kwai/player/qos/b;->h:Z

    if-eqz v3, :cond_e5

    const-string v3, "bandwidth_current"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->bandwidthCurrent:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "bandwidth_fragment"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->bandwidthFragment:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "bitrate_downloading"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->bitrateDownloading:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "bitrate_playing"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->bitratePlaying:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "current_buffer"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->currentBufferMs:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "estimated_buffer"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->estimateBufferMs:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "predicted_buffer"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->predictedBufferMs:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    const-string v3, "switch_time_gap"

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->repSwitchGapTime:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "cached_tag_duration"

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->cachedTagDurationMs:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "cached_total_duration"

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->cachedTotalDurationMs:J

    invoke-virtual {v0, v3, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v3, "switch_cnt"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->repSwitchCnt:I

    iget v5, p0, Lcom/kwai/player/qos/b;->r:I

    sub-int/2addr v4, v5

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    iget v3, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->repSwitchCnt:I

    iput v3, p0, Lcom/kwai/player/qos/b;->r:I

    const-string v3, "switch_point_v_buf_time"

    iget v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->repSwitchPointVideoBufferTime:I

    invoke-virtual {v0, v3, v4}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;

    iget-wide v4, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->curRepReadStartTime:J

    iget-wide v6, p0, Lcom/kwai/player/qos/b;->p:J

    cmp-long v3, v6, v4

    if-eqz v3, :cond_107

    cmp-long v3, v4, v8

    if-nez v3, :cond_cc

    const/4 v3, 0x0

    iput v3, p0, Lcom/kwai/player/qos/b;->f:I

    :cond_cc
    iget-wide v6, v1, Lcom/kwai/player/qos/AppLiveAdaptiveRealtimeInfo;->curRepFirstDataTime:J

    cmp-long v1, v6, v8

    if-nez v1, :cond_eb

    const-string v1, "cur_rep_first_data_time"

    iget v3, p0, Lcom/kwai/player/qos/b;->f:I

    add-int/lit8 v3, v3, 0x1

    int-to-long v4, v3

    iget-wide v6, p0, Lcom/kwai/player/qos/b;->o:J

    mul-long/2addr v4, v6

    invoke-virtual {v0, v1, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    iget v1, p0, Lcom/kwai/player/qos/b;->f:I

    add-int/lit8 v1, v1, 0x1

    iput v1, p0, Lcom/kwai/player/qos/b;->f:I
    :try_end_e5
    .catch Lorg/json/JSONException; {:try_start_15 .. :try_end_e5} :catch_102
    .catchall {:try_start_15 .. :try_end_e5} :catchall_e8

    :cond_e5
    :goto_e5
    :try_start_e5
    monitor-exit v2

    goto/16 :goto_f

    :catchall_e8
    move-exception v0

    monitor-exit v2
    :try_end_ea
    .catchall {:try_start_e5 .. :try_end_ea} :catchall_e8

    throw v0

    :cond_eb
    sub-long/2addr v6, v4

    :try_start_ec
    iput-wide v6, p0, Lcom/kwai/player/qos/b;->q:J

    const-string v1, "cur_rep_first_data_time"

    iget-wide v6, p0, Lcom/kwai/player/qos/b;->q:J

    invoke-virtual {v0, v1, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v1, "cur_rep_switch_time"

    iget-wide v6, p0, Lcom/kwai/player/qos/b;->q:J

    invoke-virtual {v0, v1, v6, v7}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const/4 v1, 0x0

    iput v1, p0, Lcom/kwai/player/qos/b;->f:I

    iput-wide v4, p0, Lcom/kwai/player/qos/b;->p:J
    :try_end_101
    .catch Lorg/json/JSONException; {:try_start_ec .. :try_end_101} :catch_102
    .catchall {:try_start_ec .. :try_end_101} :catchall_e8

    goto :goto_e5

    :catch_102
    move-exception v1

    :try_start_103
    invoke-virtual {v1}, Lorg/json/JSONException;->printStackTrace()V
    :try_end_106
    .catchall {:try_start_103 .. :try_end_106} :catchall_e8

    goto :goto_e5

    :cond_107
    :try_start_107
    const-string v1, "cur_rep_first_data_time"

    iget-wide v4, p0, Lcom/kwai/player/qos/b;->q:J

    invoke-virtual {v0, v1, v4, v5}, Lorg/json/JSONObject;->put(Ljava/lang/String;J)Lorg/json/JSONObject;

    const-string v1, "cur_rep_switch_time"

    const/4 v3, 0x0

    invoke-virtual {v0, v1, v3}, Lorg/json/JSONObject;->put(Ljava/lang/String;I)Lorg/json/JSONObject;
    :try_end_114
    .catch Lorg/json/JSONException; {:try_start_107 .. :try_end_114} :catch_102
    .catchall {:try_start_107 .. :try_end_114} :catchall_e8

    goto :goto_e5
.end method