discord-jadx/app/src/main/java/com/discord/rtcconnection/RtcConnection.java

911 lines
30 KiB
Java

package com.discord.rtcconnection;
import android.content.Intent;
import android.util.Log;
import c.a.r.a0;
import c.a.r.d0;
import c.a.r.e0;
import c.a.r.f0;
import c.a.r.g;
import c.a.r.j;
import c.a.r.p;
import c.a.r.q;
import c.a.r.r;
import c.a.r.y;
import c.a.r.z;
import co.discord.media_engine.InboundRtpAudio;
import co.discord.media_engine.OutboundRtpAudio;
import co.discord.media_engine.Stats;
import co.discord.media_engine.VoiceQuality;
import com.discord.rtcconnection.MediaSinkWantsManager;
import com.discord.rtcconnection.mediaengine.MediaEngine;
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
import com.discord.rtcconnection.mediaengine.ThumbnailEmitter;
import com.discord.utilities.debug.DebugPrintBuilder;
import com.discord.utilities.debug.DebugPrintable;
import com.discord.utilities.logging.Logger;
import com.discord.utilities.networking.Backoff;
import com.discord.utilities.networking.NetworkMonitor;
import com.discord.utilities.time.Clock;
import d0.g0.s;
import d0.t.g0;
import d0.t.h0;
import d0.t.u;
import d0.z.d.m;
import d0.z.d.o;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.Future;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.DefaultConstructorMarker;
import rx.Observable;
import rx.Subscription;
import rx.subjects.BehaviorSubject;
/* compiled from: RtcConnection.kt */
public final class RtcConnection implements DebugPrintable, MediaSinkWantsManager.a {
public static int i;
public static final a j = new a(null);
public Long A;
public Long B;
public int C;
public Subscription D;
public final MediaSinkWantsManager E;
public final Subscription F;
public boolean G;
public String H;
public int I;
public final d0 J;
public final a0 K;
public final Long L;
public final long M;
public String N;
public final boolean O;
public final String P;
public final long Q;
public final MediaEngine R;
public final Logger S;
public final Clock T;
public final d U;
public final Map<Long, Boolean> V;
public final Map<Long, Float> W;
public final String X;
public final boolean Y;
public final String Z;
/* renamed from: a0 reason: collision with root package name */
public final String f2080a0;
public final String k;
public final String l;
public final List<c> m;
public c.a.r.m0.d n;
public boolean o;
public final Backoff p;
public MediaEngineConnection.TransportInfo q;
public StateChange r;
/* renamed from: s reason: collision with root package name */
public BehaviorSubject<StateChange> f2081s;
public boolean t;
public List<Long> u;
public c.a.r.l0.a v;
public MediaEngineConnection w;
/* renamed from: x reason: collision with root package name */
public String f2082x;
/* renamed from: y reason: collision with root package name */
public Integer f2083y;
/* renamed from: z reason: collision with root package name */
public int f2084z;
/* compiled from: RtcConnection.kt */
public enum AnalyticsEvent {
VOICE_CONNECTION_SUCCESS,
VOICE_CONNECTION_FAILURE,
VOICE_DISCONNECT,
VIDEO_STREAM_ENDED,
MEDIA_SESSION_JOINED
}
/* compiled from: RtcConnection.kt */
public static final class Metadata {
public final String a;
public final String b;
/* renamed from: c reason: collision with root package name */
public final Long f2085c;
public final Long d;
public final String e;
public Metadata(String str, String str2, Long l, Long l2, String str3) {
m.checkNotNullParameter(str, "rtcConnectionId");
this.a = str;
this.b = str2;
this.f2085c = l;
this.d = l2;
this.e = str3;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof Metadata)) {
return false;
}
Metadata metadata = (Metadata) obj;
return m.areEqual(this.a, metadata.a) && m.areEqual(this.b, metadata.b) && m.areEqual(this.f2085c, metadata.f2085c) && m.areEqual(this.d, metadata.d) && m.areEqual(this.e, metadata.e);
}
public int hashCode() {
String str = this.a;
int i = 0;
int hashCode = (str != null ? str.hashCode() : 0) * 31;
String str2 = this.b;
int hashCode2 = (hashCode + (str2 != null ? str2.hashCode() : 0)) * 31;
Long l = this.f2085c;
int hashCode3 = (hashCode2 + (l != null ? l.hashCode() : 0)) * 31;
Long l2 = this.d;
int hashCode4 = (hashCode3 + (l2 != null ? l2.hashCode() : 0)) * 31;
String str3 = this.e;
if (str3 != null) {
i = str3.hashCode();
}
return hashCode4 + i;
}
public String toString() {
StringBuilder L = c.d.b.a.a.L("Metadata(rtcConnectionId=");
L.append(this.a);
L.append(", mediaSessionId=");
L.append(this.b);
L.append(", channelId=");
L.append(this.f2085c);
L.append(", guildId=");
L.append(this.d);
L.append(", streamKey=");
return c.d.b.a.a.D(L, this.e, ")");
}
}
/* compiled from: RtcConnection.kt */
public enum Quality {
UNKNOWN,
BAD,
AVERAGE,
FINE;
public static final a Companion = new a(null);
/* compiled from: RtcConnection.kt */
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
}
/* compiled from: RtcConnection.kt */
public static abstract class State {
/* compiled from: RtcConnection.kt */
public static final class a extends State {
public static final a a = new a();
public a() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class b extends State {
public static final b a = new b();
public b() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class c extends State {
public static final c a = new c();
public c() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class d extends State {
public final boolean a;
public d(boolean z2) {
super(null);
this.a = z2;
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof d) && this.a == ((d) obj).a;
}
return true;
}
public int hashCode() {
boolean z2 = this.a;
if (z2) {
return 1;
}
return z2 ? 1 : 0;
}
public String toString() {
return c.d.b.a.a.G(c.d.b.a.a.L("Disconnected(willReconnect="), this.a, ")");
}
}
/* compiled from: RtcConnection.kt */
public static final class e extends State {
public static final e a = new e();
public e() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class f extends State {
public static final f a = new f();
public f() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class g extends State {
public static final g a = new g();
public g() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class h extends State {
public static final h a = new h();
public h() {
super(null);
}
}
public State() {
}
public State(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: RtcConnection.kt */
public static final class StateChange {
public final State a;
public final Metadata b;
public StateChange(State state, Metadata metadata) {
m.checkNotNullParameter(state, "state");
this.a = state;
this.b = metadata;
}
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof StateChange)) {
return false;
}
StateChange stateChange = (StateChange) obj;
return m.areEqual(this.a, stateChange.a) && m.areEqual(this.b, stateChange.b);
}
public int hashCode() {
State state = this.a;
int i = 0;
int hashCode = (state != null ? state.hashCode() : 0) * 31;
Metadata metadata = this.b;
if (metadata != null) {
i = metadata.hashCode();
}
return hashCode + i;
}
public String toString() {
StringBuilder L = c.d.b.a.a.L("StateChange(state=");
L.append(this.a);
L.append(", metadata=");
L.append(this.b);
L.append(")");
return L.toString();
}
}
/* compiled from: RtcConnection.kt */
public static final class a {
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: RtcConnection.kt */
public static abstract class b implements c {
@Override // com.discord.rtcconnection.RtcConnection.c
public void onAnalyticsEvent(AnalyticsEvent analyticsEvent, Map<String, Object> map) {
m.checkNotNullParameter(analyticsEvent, "event");
m.checkNotNullParameter(map, "properties");
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onFatalClose() {
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onMediaEngineConnectionConnected(RtcConnection rtcConnection) {
m.checkNotNullParameter(rtcConnection, "connection");
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onMediaSessionIdReceived() {
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onQualityUpdate(Quality quality) {
m.checkNotNullParameter(quality, "quality");
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onSpeaking(long j, boolean z2) {
}
@Override // com.discord.rtcconnection.RtcConnection.c
public abstract void onStateChange(StateChange stateChange);
@Override // com.discord.rtcconnection.RtcConnection.c
public void onUserCreated(RtcConnection rtcConnection, long j) {
m.checkNotNullParameter(rtcConnection, "connection");
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onVideoMetadata(VideoMetadata videoMetadata) {
m.checkNotNullParameter(videoMetadata, "metadata");
}
@Override // com.discord.rtcconnection.RtcConnection.c
public void onVideoStream(long j, Integer num) {
}
}
/* compiled from: RtcConnection.kt */
public interface c {
void onAnalyticsEvent(AnalyticsEvent analyticsEvent, Map<String, Object> map);
void onFatalClose();
void onMediaEngineConnectionConnected(RtcConnection rtcConnection);
void onMediaSessionIdReceived();
void onQualityUpdate(Quality quality);
void onSpeaking(long j, boolean z2);
void onStateChange(StateChange stateChange);
void onUserCreated(RtcConnection rtcConnection, long j);
void onVideoMetadata(VideoMetadata videoMetadata);
void onVideoStream(long j, Integer num);
}
/* compiled from: RtcConnection.kt */
public static abstract class d {
/* compiled from: RtcConnection.kt */
public static final class a extends d {
public static final a a = new a();
public a() {
super(null);
}
}
/* compiled from: RtcConnection.kt */
public static final class b extends d {
public final long a;
public b(long j) {
super(null);
this.a = j;
}
public boolean equals(Object obj) {
if (this != obj) {
return (obj instanceof b) && this.a == ((b) obj).a;
}
return true;
}
public int hashCode() {
return a0.a.a.b.a(this.a);
}
public String toString() {
return c.d.b.a.a.A(c.d.b.a.a.L("Stream(senderId="), this.a, ")");
}
}
public d(DefaultConstructorMarker defaultConstructorMarker) {
}
}
/* compiled from: RtcConnection.kt */
public static final class e extends o implements Function0<Unit> {
public final /* synthetic */ RtcConnection this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public e(RtcConnection rtcConnection) {
super(0);
this.this$0 = rtcConnection;
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public Unit mo1invoke() {
this.this$0.f("Force Close");
return Unit.a;
}
}
public RtcConnection(Long l, long j2, String str, boolean z2, String str2, long j3, MediaEngine mediaEngine, Logger logger, Clock clock, d dVar, NetworkMonitor networkMonitor, Map map, Map map2, String str3, boolean z3, String str4, String str5, int i2) {
d dVar2 = (i2 & 512) != 0 ? d.a.a : dVar;
Map linkedHashMap = (i2 & 2048) != 0 ? new LinkedHashMap() : map;
LinkedHashMap linkedHashMap2 = (i2 & 4096) != 0 ? new LinkedHashMap() : null;
String str6 = (i2 & 8192) != 0 ? null : str3;
boolean z4 = (i2 & 16384) != 0 ? false : z3;
String str7 = (i2 & 65536) != 0 ? null : str5;
m.checkNotNullParameter(str, "sessionId");
m.checkNotNullParameter(str2, "rtcServerId");
m.checkNotNullParameter(mediaEngine, "mediaEngine");
m.checkNotNullParameter(logger, "logger");
m.checkNotNullParameter(clock, "clock");
m.checkNotNullParameter(dVar2, "rtcConnectionType");
m.checkNotNullParameter(networkMonitor, "networkMonitor");
m.checkNotNullParameter(linkedHashMap, "mutedUsers");
m.checkNotNullParameter(linkedHashMap2, "userVolumes");
m.checkNotNullParameter(str4, "loggingTagPrefix");
this.L = l;
this.M = j2;
this.N = str;
this.O = z2;
this.P = str2;
this.Q = j3;
this.R = mediaEngine;
this.S = logger;
this.T = clock;
this.U = dVar2;
this.V = linkedHashMap;
this.W = linkedHashMap2;
this.X = str6;
this.Y = z4;
this.Z = str4;
this.f2080a0 = str7;
StringBuilder P = c.d.b.a.a.P(str4, "->RtcConnection ");
int i3 = i + 1;
i = i3;
P.append(i3);
this.k = P.toString();
String uuid = UUID.randomUUID().toString();
m.checkNotNullExpressionValue(uuid, "UUID.randomUUID().toString()");
this.l = uuid;
ArrayList arrayList = new ArrayList();
this.m = arrayList;
this.p = new Backoff(1000, 10000, 0, false, null, 28, null);
Subscription subscription = null;
StateChange stateChange = new StateChange(new State.d(false), null);
this.r = stateChange;
this.f2081s = BehaviorSubject.l0(stateChange);
this.u = new ArrayList();
MediaSinkWantsManager mediaSinkWantsManager = z4 ? new MediaSinkWantsManager(j3, mediaEngine.c(), new c.a.r.e(null, 1), logger, this) : null;
this.E = mediaSinkWantsManager;
if (z4) {
m.checkNotNull(mediaSinkWantsManager);
Observable<Map<String, EncodeQuality>> r = mediaSinkWantsManager.f.r();
m.checkNotNullExpressionValue(r, "mediaSinkWantsSubject.distinctUntilChanged()");
subscription = Observable.j(r, this.f2081s, y.i).V(new f0(new z(this)));
}
this.F = subscription;
r("Created RtcConnection. GuildID: " + l + " ChannelID: " + j2);
networkMonitor.observeIsConnected().S(1).W(new p(this), new q(this));
arrayList.add(new r(this));
this.J = new d0(this);
this.K = new a0(this);
}
public static void j(RtcConnection rtcConnection, boolean z2, String str, Throwable th, boolean z3, int i2) {
if ((i2 & 4) != 0) {
th = null;
}
if ((i2 & 8) != 0) {
z3 = true;
}
if (z3) {
o(rtcConnection, str, th, null, 4);
} else {
rtcConnection.S.i(rtcConnection.k, str, th);
}
c.a.r.m0.d dVar = rtcConnection.n;
if (dVar != null) {
dVar.a();
}
rtcConnection.n = null;
MediaEngineConnection mediaEngineConnection = rtcConnection.w;
if (mediaEngineConnection != null) {
mediaEngineConnection.destroy();
}
rtcConnection.w = null;
rtcConnection.o = false;
rtcConnection.p.cancel();
rtcConnection.u(new State.d(z2));
if (z2) {
rtcConnection.q();
return;
}
for (c cVar : rtcConnection.m) {
cVar.onFatalClose();
}
rtcConnection.f(str);
}
public static void o(RtcConnection rtcConnection, String str, Throwable th, Map map, int i2) {
if ((i2 & 2) != 0) {
th = null;
}
int i3 = i2 & 4;
rtcConnection.S.e(rtcConnection.k, str, th, null);
}
@Override // com.discord.rtcconnection.MediaSinkWantsManager.a
public void a(long j2, int i2, int i3, VideoMetadata videoMetadata) {
d(j2, i2, i3, videoMetadata);
}
public final Map<String, Object> b(Map<String, Object> map) {
String str = this.f2082x;
if (str != null) {
map.put("hostname", str);
}
Integer num = this.f2083y;
if (num != null) {
map.put("port", Integer.valueOf(num.intValue()));
}
return map;
}
public final void c(c cVar) {
m.checkNotNullParameter(cVar, "listener");
this.m.add(cVar);
}
public final void d(long j2, int i2, int i3, VideoMetadata videoMetadata) {
MediaEngineConnection mediaEngineConnection = this.w;
if (mediaEngineConnection != null) {
mediaEngineConnection.s(j2, i2, Integer.valueOf(i3), g(j2), h(j2));
}
for (c cVar : this.m) {
cVar.onUserCreated(this, j2);
}
if (videoMetadata != null) {
for (c cVar2 : this.m) {
cVar2.onVideoMetadata(videoMetadata);
}
}
}
@Override // com.discord.utilities.debug.DebugPrintable
public void debugPrint(DebugPrintBuilder debugPrintBuilder) {
m.checkNotNullParameter(debugPrintBuilder, "dp");
debugPrintBuilder.appendKeyValue("id", this.l);
debugPrintBuilder.appendKeyValue("mediaSessionId", this.H);
debugPrintBuilder.appendKeyValue("parentMediaSessionId", this.X);
debugPrintBuilder.appendKeyValue("hostname", this.f2082x);
debugPrintBuilder.appendKeyValue("channelId", Long.valueOf(this.M));
debugPrintBuilder.appendKeyValue("guildId", this.L);
debugPrintBuilder.appendKeyValue("streamKey", this.f2080a0);
debugPrintBuilder.appendKeyValue("isVideoEnabled", Boolean.valueOf(this.O));
debugPrintBuilder.appendKeyValue("rtcServerId", this.P);
debugPrintBuilder.appendKeyValue("userId", Long.valueOf(this.Q));
debugPrintBuilder.appendKeyValue("rtcConnectionType", this.U);
debugPrintBuilder.appendKeyValue("enableMediaSinkWants", Boolean.valueOf(this.Y));
debugPrintBuilder.appendKeyValue("socket", (DebugPrintable) this.v);
debugPrintBuilder.appendKeyValue("sentVideo", Boolean.valueOf(this.o));
}
public final void e() {
s(new e(this));
}
public final void f(String str) {
c.a.r.m0.e eVar;
c.a.r.m0.e eVar2;
Map<String, Object> b2;
this.p.cancel();
c.a.r.l0.a aVar = this.v;
if (aVar != null) {
aVar.p.clear();
aVar.e();
}
this.v = null;
if (!(this.r.a instanceof State.d)) {
n(false, str);
d dVar = this.U;
if (dVar instanceof d.b) {
long j2 = ((d.b) dVar).a;
c.a.r.m0.d dVar2 = this.n;
if (!(dVar2 == null || (eVar2 = dVar2.g) == null || (b2 = eVar2.b(String.valueOf(j2))) == null)) {
l(((d.b) this.U).a, b2);
}
if (this.o) {
long j3 = this.Q;
c.a.r.m0.d dVar3 = this.n;
m(j3, (dVar3 == null || (eVar = dVar3.g) == null) ? null : eVar.c());
}
}
}
MediaSinkWantsManager mediaSinkWantsManager = this.E;
if (mediaSinkWantsManager != null) {
mediaSinkWantsManager.b(new g(mediaSinkWantsManager));
}
Subscription subscription = this.F;
if (subscription != null) {
subscription.unsubscribe();
}
Subscription subscription2 = this.D;
if (subscription2 != null) {
subscription2.unsubscribe();
}
this.D = null;
MediaEngineConnection mediaEngineConnection = this.w;
if (mediaEngineConnection != null) {
mediaEngineConnection.destroy();
}
this.w = null;
u(new State.d(false));
r("Destroy internal RTC connection: " + str);
this.m.clear();
this.o = false;
this.t = true;
}
public final boolean g(long j2) {
Boolean bool = this.V.get(Long.valueOf(j2));
if (bool != null) {
return bool.booleanValue();
}
return false;
}
public final float h(long j2) {
Float f = this.W.get(Long.valueOf(j2));
if (f != null) {
return f.floatValue();
}
return 1.0f;
}
public final Metadata i() {
return new Metadata(this.l, this.H, Long.valueOf(this.M), this.L, this.f2080a0);
}
public final void k(long j2, Map<String, ? extends Object> map) {
HashMap hashMap = new HashMap();
Long l = this.L;
if (l != null) {
l.longValue();
hashMap.put("guild_id", this.L);
}
hashMap.put("channel_id", Long.valueOf(this.M));
hashMap.put("sender_user_id", Long.valueOf(j2));
hashMap.putAll(map);
p(AnalyticsEvent.VIDEO_STREAM_ENDED, hashMap);
}
public final void l(long j2, Map<String, ? extends Object> map) {
if (map != null) {
k(j2, h0.plus(map, g0.mapOf(d0.o.to("participant_type", "receiver"))));
}
}
public final void m(long j2, Map<String, ? extends Object> map) {
if (map != null) {
k(j2, h0.plus(map, g0.mapOf(d0.o.to("participant_type", this.U instanceof d.b ? "streamer" : "sender"))));
}
}
public final void n(boolean z2, String str) {
c.a.r.m0.d dVar;
c.a.r.m0.e eVar;
String str2;
Stats stats;
VoiceQuality voiceQuality;
int i2 = 0;
Map<String, Object> mutableMapOf = h0.mutableMapOf(d0.o.to("ping_bad_count", Integer.valueOf(this.f2084z)), d0.o.to("connect_count", Integer.valueOf(this.C)), d0.o.to("channel_count", 1));
b(mutableMapOf);
mutableMapOf.put("reconnect", Boolean.valueOf(z2));
if (str != null) {
mutableMapOf.put("reason", str);
}
double averageOfLong = u.averageOfLong(this.u);
if (!Double.isNaN(averageOfLong)) {
mutableMapOf.put("ping_average", Integer.valueOf(d0.a0.a.roundToInt(averageOfLong)));
}
String str3 = this.H;
if (str3 != null) {
mutableMapOf.put("media_session_id", str3);
}
c.a.r.m0.d dVar2 = this.n;
if (!(dVar2 == null || (stats = (Stats) u.lastOrNull(dVar2.a)) == null)) {
OutboundRtpAudio outboundRtpAudio = stats.getOutboundRtpAudio();
if (outboundRtpAudio != null) {
mutableMapOf.put("packets_sent", Integer.valueOf(outboundRtpAudio.getPacketsSent()));
mutableMapOf.put("packets_sent_lost", Integer.valueOf(outboundRtpAudio.getPacketsLost()));
}
int i3 = 0;
for (InboundRtpAudio inboundRtpAudio : stats.getInboundRtpAudio().values()) {
i3 += inboundRtpAudio.getPacketsLost();
i2 += inboundRtpAudio.getPacketsReceived();
}
mutableMapOf.put("packets_received", Integer.valueOf(i2));
mutableMapOf.put("packets_received_lost", Integer.valueOf(i3));
c.a.r.m0.d dVar3 = this.n;
if (!(dVar3 == null || (voiceQuality = dVar3.f) == null)) {
voiceQuality.getDurationStats(mutableMapOf);
voiceQuality.getMosStats(mutableMapOf);
voiceQuality.getPacketStats(mutableMapOf);
voiceQuality.getBufferStats(mutableMapOf);
voiceQuality.getFrameOpStats(mutableMapOf);
}
}
Long l = this.B;
MediaEngineConnection.TransportInfo.Protocol protocol = null;
Long valueOf = l != null ? Long.valueOf(this.T.currentTimeMillis() - l.longValue()) : null;
if (valueOf != null) {
mutableMapOf.put("duration", Long.valueOf(valueOf.longValue()));
}
MediaEngineConnection.TransportInfo transportInfo = this.q;
if (transportInfo != null) {
protocol = transportInfo.f2096c;
}
if (protocol != null) {
int ordinal = protocol.ordinal();
if (ordinal == 0) {
str2 = "udp";
} else if (ordinal == 1) {
str2 = "tcp";
} else {
throw new NoWhenBranchMatchedException();
}
mutableMapOf.put("protocol", str2);
}
p(AnalyticsEvent.VOICE_DISCONNECT, mutableMapOf);
if (!(!(this.U instanceof d.a) || (dVar = this.n) == null || (eVar = dVar.g) == null)) {
for (String str4 : u.toList(eVar.j.keySet())) {
Long longOrNull = s.toLongOrNull(str4);
if (longOrNull != null) {
l(longOrNull.longValue(), eVar.b(str4));
}
}
if (this.o) {
m(this.Q, eVar.c());
}
}
}
public final void p(AnalyticsEvent analyticsEvent, Map<String, Object> map) {
String str;
map.put("rtc_connection_id", this.l);
d dVar = this.U;
if (m.areEqual(dVar, d.a.a)) {
str = "default";
} else if (dVar instanceof d.b) {
str = "stream";
} else {
throw new NoWhenBranchMatchedException();
}
map.put("context", str);
String str2 = this.H;
if (str2 != null) {
map.put("media_session_id", str2);
}
String str3 = this.X;
if (str3 != null) {
map.put("parent_media_session_id", str3);
}
for (c cVar : this.m) {
cVar.onAnalyticsEvent(analyticsEvent, map);
}
}
public final void q() {
this.S.recordBreadcrumb("reconnect", this.k);
if (this.G) {
this.A = Long.valueOf(this.T.currentTimeMillis());
}
this.C++;
c.a.r.l0.a aVar = this.v;
if (aVar != null) {
aVar.e();
aVar.f();
}
}
public final void r(String str) {
this.S.recordBreadcrumb(str, this.k);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARNING: Unknown variable types count: 1 */
public final Future<?> s(Function0<Unit> function0) {
c.a.r.c c2 = this.R.c();
if (function0 != null) {
function0 = new e0(function0);
}
return c2.submit((Runnable) function0);
}
public final void t(Intent intent, ThumbnailEmitter thumbnailEmitter) {
if (this.U instanceof d.b) {
r("Setting screenshare " + intent + ' ' + this.w);
MediaEngineConnection mediaEngineConnection = this.w;
if (mediaEngineConnection == null) {
Log.e("RtcConnection", "MediaEngine not connected for setScreenshare.");
} else if (intent != null) {
mediaEngineConnection.a(intent, thumbnailEmitter);
} else {
mediaEngineConnection.h();
}
}
}
public final void u(State state) {
if (!m.areEqual(this.r.a, state)) {
StateChange stateChange = new StateChange(state, i());
this.r = stateChange;
for (c cVar : this.m) {
cVar.onStateChange(stateChange);
}
}
}
public final void v(long j2, float f) {
this.W.put(Long.valueOf(j2), Float.valueOf(f));
MediaEngineConnection mediaEngineConnection = this.w;
if (mediaEngineConnection != null) {
mediaEngineConnection.e(j2, f);
}
}
public final void w(Long l) {
MediaSinkWantsManager mediaSinkWantsManager = this.E;
if (mediaSinkWantsManager != null) {
mediaSinkWantsManager.b(new j(mediaSinkWantsManager, l));
}
}
}