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 { 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.i$default(eVar.l, "MediaEngineConnectionLegacy", c.d.b.a.a.u("handleConnection(). errorMessage: ", str), null, 4, null); if (connectionInfo != null) { if (str == null || str.length() == 0) { String str2 = connectionInfo.localAddress; m.checkNotNullExpressionValue(str2, "connectionInfo.localAddress"); int i = connectionInfo.localPort; String str3 = connectionInfo.protocol; m.checkNotNullExpressionValue(str3, "connectionInfo.protocol"); Objects.requireNonNull(str3, "null cannot be cast to non-null type java.lang.String"); String upperCase = str3.toUpperCase(); m.checkNotNullExpressionValue(upperCase, "(this as java.lang.String).toUpperCase()"); MediaEngineConnection.TransportInfo transportInfo = new MediaEngineConnection.TransportInfo(str2, i, MediaEngineConnection.TransportInfo.Protocol.valueOf(upperCase)); MediaEngineConnection.ConnectionState connectionState = MediaEngineConnection.ConnectionState.CONNECTED; eVar.b = 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.i.clear(); eVar.i.add(aVar); eVar.i.addAll(eVar.o); 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)); } }