.class public final Le/a/f/m;
.super Ljava/lang/Object;
.source "RtcConnection.kt"

# interfaces
.implements Le/a/f/p/a$c;


# instance fields
.field public final synthetic a:Lcom/discord/rtcconnection/RtcConnection;


# direct methods
.method public constructor <init>(Lcom/discord/rtcconnection/RtcConnection;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()V"
        }
    .end annotation

    iput-object p1, p0, Le/a/f/m;->a:Lcom/discord/rtcconnection/RtcConnection;

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

    return-void
.end method


# virtual methods
.method public a(J)V
    .locals 4

    iget-object v0, p0, Le/a/f/m;->a:Lcom/discord/rtcconnection/RtcConnection;

    iget-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->i:Ljava/util/LinkedList;

    invoke-static {p1, p2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/util/LinkedList;->add(Ljava/lang/Object;)Z

    iget-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->i:Ljava/util/LinkedList;

    invoke-virtual {v1}, Ljava/util/LinkedList;->size()I

    move-result v1

    const/4 v2, 0x5

    if-le v1, v2, :cond_0

    iget-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->i:Ljava/util/LinkedList;

    invoke-virtual {v1}, Ljava/util/LinkedList;->removeFirst()Ljava/lang/Object;

    :cond_0
    const/16 v1, 0x1f4

    int-to-long v1, v1

    cmp-long v3, p1, v1

    if-lez v3, :cond_1

    iget v1, v0, Lcom/discord/rtcconnection/RtcConnection;->n:I

    add-int/lit8 v1, v1, 0x1

    iput v1, v0, Lcom/discord/rtcconnection/RtcConnection;->n:I

    :cond_1
    sget-object v1, Lcom/discord/rtcconnection/RtcConnection$Quality;->Companion:Lcom/discord/rtcconnection/RtcConnection$Quality$a;

    long-to-double p1, p1

    invoke-virtual {v1, p1, p2}, Lcom/discord/rtcconnection/RtcConnection$Quality$a;->a(D)Lcom/discord/rtcconnection/RtcConnection$Quality;

    move-result-object p1

    new-instance p2, Le/a/f/l;

    invoke-direct {p2, p1}, Le/a/f/l;-><init>(Lcom/discord/rtcconnection/RtcConnection$Quality;)V

    invoke-virtual {v0, p2}, Lcom/discord/rtcconnection/RtcConnection;->a(Lkotlin/jvm/functions/Function1;)V

    return-void
.end method

.method public a(Ljava/lang/String;)V
    .locals 1

    if-eqz p1, :cond_1

    iget-object v0, p0, Le/a/f/m;->a:Lcom/discord/rtcconnection/RtcConnection;

    iput-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->s:Ljava/lang/String;

    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->c:Ljava/util/List;

    invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator;

    move-result-object p1

    :goto_0
    invoke-interface {p1}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_0

    invoke-interface {p1}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/discord/rtcconnection/RtcConnection$b;

    invoke-interface {v0}, Lcom/discord/rtcconnection/RtcConnection$b;->onMediaSessionIdReceived()V

    goto :goto_0

    :cond_0
    return-void

    :cond_1
    const-string p1, "mediaSessionId"

    invoke-static {p1}, Lx/u/b/j;->a(Ljava/lang/String;)V

    const/4 p1, 0x0

    throw p1
.end method

.method public a(ZLjava/lang/Integer;Ljava/lang/String;)V
    .locals 10

    iget-object v0, p0, Le/a/f/m;->a:Lcom/discord/rtcconnection/RtcConnection;

    iget-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;

    new-instance v2, Ljava/lang/StringBuilder;

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

    const-string v3, "Disconnected from RTC server. wasFatal: "

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Z)Ljava/lang/StringBuilder;

    const-string p1, " -- code: "

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string p1, " -- reason: "

    invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    iget-object v3, v0, Lcom/discord/rtcconnection/RtcConnection;->b:Ljava/lang/String;

    const/4 v4, 0x0

    const/4 v5, 0x4

    const/4 v6, 0x0

    invoke-static/range {v1 .. v6}, Lcom/discord/utilities/logging/Logger;->recordBreadcrumb$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;ILjava/lang/Object;)V

    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->k:Lcom/discord/rtcconnection/mediaengine/MediaEngineConnection;

    if-eqz p1, :cond_0

    invoke-interface {p1}, Lcom/discord/rtcconnection/mediaengine/MediaEngineConnection;->a()V

    :cond_0
    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->k:Lcom/discord/rtcconnection/mediaengine/MediaEngineConnection;

    if-eqz p1, :cond_1

    iget-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->u:Le/a/f/g;

    invoke-interface {p1, v1}, Lcom/discord/rtcconnection/mediaengine/MediaEngineConnection;->a(Lcom/discord/rtcconnection/mediaengine/MediaEngineConnection$b;)V

    :cond_1
    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->g:Lcom/discord/rtcconnection/RtcConnection$State;

    instance-of p1, p1, Lcom/discord/rtcconnection/RtcConnection$State$d;

    if-nez p1, :cond_2

    invoke-virtual {v0}, Lcom/discord/rtcconnection/RtcConnection;->i()V

    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->d:Le/a/f/q/d;

    invoke-virtual {p1}, Le/a/f/q/d;->a()Lkotlin/Unit;

    :cond_2
    const/4 p1, 0x0

    iput p1, v0, Lcom/discord/rtcconnection/RtcConnection;->n:I

    const/4 v1, 0x0

    iput-object v1, v0, Lcom/discord/rtcconnection/RtcConnection;->p:Ljava/lang/Long;

    const/16 v1, 0x3e8

    if-nez p2, :cond_3

    goto :goto_0

    :cond_3
    invoke-virtual {p2}, Ljava/lang/Integer;->intValue()I

    move-result v2

    if-eq v2, v1, :cond_4

    :goto_0
    const/4 p1, 0x1

    :cond_4
    new-instance v2, Lcom/discord/rtcconnection/RtcConnection$State$d;

    invoke-direct {v2, p1}, Lcom/discord/rtcconnection/RtcConnection$State$d;-><init>(Z)V

    invoke-virtual {v0, v2}, Lcom/discord/rtcconnection/RtcConnection;->a(Lcom/discord/rtcconnection/RtcConnection$State;)V

    if-eqz p1, :cond_5

    iget-object p1, v0, Lcom/discord/rtcconnection/RtcConnection;->e:Lcom/discord/utilities/networking/Backoff;

    new-instance v2, Le/a/f/j;

    invoke-direct {v2, v0}, Le/a/f/j;-><init>(Lcom/discord/rtcconnection/RtcConnection;)V

    invoke-virtual {p1, v2}, Lcom/discord/utilities/networking/Backoff;->fail(Lkotlin/jvm/functions/Function0;)J

    move-result-wide v2

    iget-object v4, v0, Lcom/discord/rtcconnection/RtcConnection;->C:Lcom/discord/utilities/logging/Logger;

    iget-object v5, v0, Lcom/discord/rtcconnection/RtcConnection;->b:Ljava/lang/String;

    new-instance p1, Ljava/lang/StringBuilder;

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

    const-string v0, "Disconnect was not clean! Reason: "

    invoke-virtual {p1, v0}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    const-string p3, ", code: "

    invoke-virtual {p1, p3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder;

    const-string p2, ". Reconnecting in "

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    int-to-long p2, v1

    div-long/2addr v2, p2

    invoke-virtual {p1, v2, v3}, Ljava/lang/StringBuilder;->append(J)Ljava/lang/StringBuilder;

    const-string p2, " seconds."

    invoke-virtual {p1, p2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    invoke-virtual {p1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v6

    const/4 v7, 0x0

    const/4 v8, 0x4

    const/4 v9, 0x0

    invoke-static/range {v4 .. v9}, Lcom/discord/utilities/logging/Logger;->w$default(Lcom/discord/utilities/logging/Logger;Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;ILjava/lang/Object;)V

    :cond_5
    return-void
.end method