discord-jadx/app/src/main/java/c/a/q/m0/c/d.java

83 lines
3.7 KiB
Java

package c.a.q.m0.c;
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
import com.discord.utilities.logging.Logger;
import com.hammerandchisel.libdiscord.Discord;
import d0.z.d.m;
import d0.z.d.o;
import java.util.Objects;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import org.webrtc.MediaStreamTrack;
/* compiled from: MediaEngineConnectionLegacy.kt */
public final class d implements Discord.ConnectToServerCallback {
public final /* synthetic */ e a;
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class a extends o implements Function0<Unit> {
public final /* synthetic */ Discord.ConnectionInfo $connectionInfo;
public final /* synthetic */ String $errorMessage;
public final /* synthetic */ d this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a(d dVar, Discord.ConnectionInfo connectionInfo, String str) {
super(0);
this.this$0 = dVar;
this.$connectionInfo = connectionInfo;
this.$errorMessage = str;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public Unit mo1invoke() {
e eVar = this.this$0.a;
Discord.ConnectionInfo connectionInfo = this.$connectionInfo;
String str = this.$errorMessage;
Logger logger = eVar.m;
String str2 = e.a;
m.checkNotNullExpressionValue(str2, "TAG");
Logger.i$default(logger, str2, "handleConnection(). errorMessage: " + str, null, 4, null);
if (connectionInfo != null) {
if (str == null || str.length() == 0) {
String str3 = connectionInfo.localAddress;
m.checkNotNullExpressionValue(str3, "connectionInfo.localAddress");
int i = connectionInfo.localPort;
String str4 = connectionInfo.protocol;
m.checkNotNullExpressionValue(str4, "connectionInfo.protocol");
Objects.requireNonNull(str4, "null cannot be cast to non-null type java.lang.String");
String upperCase = str4.toUpperCase();
m.checkNotNullExpressionValue(upperCase, "(this as java.lang.String).toUpperCase()");
MediaEngineConnection.TransportInfo transportInfo = new MediaEngineConnection.TransportInfo(str3, i, MediaEngineConnection.TransportInfo.Protocol.valueOf(upperCase));
MediaEngineConnection.ConnectionState connectionState = MediaEngineConnection.ConnectionState.CONNECTED;
eVar.f217c = connectionState;
eVar.y(new a(eVar, connectionState));
c.a.q.m0.a aVar = new c.a.q.m0.a("opus", 1, MediaStreamTrack.AUDIO_TRACK_KIND, 120, null);
eVar.j.clear();
eVar.j.add(aVar);
eVar.j.addAll(eVar.p);
eVar.y(new l(0, eVar, transportInfo));
return Unit.a;
}
}
if (connectionInfo == null) {
eVar.y(new l(1, eVar, str));
} else {
eVar.y(new l(2, eVar, str));
}
return Unit.a;
}
}
public d(e eVar) {
this.a = eVar;
}
@Override // com.hammerandchisel.libdiscord.Discord.ConnectToServerCallback
public final void onConnectToServer(Discord.ConnectionInfo connectionInfo, String str) {
m.checkNotNullParameter(connectionInfo, "connectionInfo");
m.checkNotNullParameter(str, "errorMessage");
e.x(this.a, new a(this, connectionInfo, str));
}
}