2021-08-12 06:36:45 +00:00
package c.a.q.m0.c ;
2021-07-24 02:37:17 +00:00
import android.content.Intent ;
import android.media.projection.MediaProjection ;
import co.discord.media_engine.AudioDecoder ;
import co.discord.media_engine.AudioEncoder ;
import co.discord.media_engine.Connection ;
import co.discord.media_engine.EncryptionSettings ;
import co.discord.media_engine.Stats ;
2021-08-06 20:07:13 +00:00
import co.discord.media_engine.StreamParameters ;
2021-07-24 02:37:17 +00:00
import co.discord.media_engine.VideoDecoder ;
import co.discord.media_engine.VideoEncoder ;
import com.discord.rtcconnection.KrispOveruseDetector ;
import com.discord.rtcconnection.mediaengine.MediaEngine ;
import com.discord.rtcconnection.mediaengine.MediaEngineConnection ;
import com.discord.rtcconnection.mediaengine.ThumbnailEmitter ;
import com.discord.utilities.logging.Logger ;
import com.hammerandchisel.libdiscord.Discord ;
import d0.t.g0 ;
import d0.t.h0 ;
import java.util.ArrayList ;
import java.util.Iterator ;
import java.util.LinkedHashMap ;
import java.util.LinkedHashSet ;
import java.util.List ;
import java.util.Map ;
import java.util.Objects ;
import java.util.Set ;
import java.util.concurrent.CopyOnWriteArrayList ;
import kotlin.Unit ;
import kotlin.jvm.functions.Function0 ;
import kotlin.jvm.functions.Function1 ;
/* compiled from: MediaEngineConnectionLegacy.kt */
public final class e implements MediaEngineConnection {
public static final String a = " e " ;
public final CopyOnWriteArrayList < MediaEngineConnection . d > b ;
/* renamed from: c reason: collision with root package name */
2021-08-12 06:36:45 +00:00
public MediaEngineConnection . ConnectionState f216c ;
2021-07-24 02:37:17 +00:00
public boolean d ;
public final Map < Long , Integer > e ;
public final Map < Long , Long > f = new LinkedHashMap ( ) ;
public final Set < Long > g = new LinkedHashSet ( ) ;
public final Set < Long > h = new LinkedHashSet ( ) ;
public final Set < Long > i = new LinkedHashSet ( ) ;
2021-08-12 06:36:45 +00:00
public final List < c . a . q . m0 . a > j = new ArrayList ( ) ;
2021-07-24 02:37:17 +00:00
public final Connection k ;
2021-08-11 06:37:47 +00:00
public final c . a . q . c l ;
2021-07-24 02:37:17 +00:00
public final Logger m ;
public final t n ;
public final Discord o ;
2021-08-12 06:36:45 +00:00
public final List < c . a . q . m0 . a > p ;
2021-07-24 02:37:17 +00:00
public final MediaEngineConnection . Type q ;
public final long r ;
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class a extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ int $audioSsrc ;
public final /* synthetic */ boolean $isMuted ;
public final /* synthetic */ long $resolvedVideoSsrc ;
public final /* synthetic */ long $userId ;
public final /* synthetic */ float $volume ;
public final /* synthetic */ e this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public a ( e eVar , long j , int i , long j2 , boolean z2 , float f ) {
super ( 1 ) ;
this . this$0 = eVar ;
this . $userId = j ;
this . $audioSsrc = i ;
this . $resolvedVideoSsrc = j2 ;
this . $isMuted = z2 ;
this . $volume = f ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
long j = this . $userId ;
int i = this . $audioSsrc ;
int i2 = ( int ) this . $resolvedVideoSsrc ;
e eVar = this . this$0 ;
String str = e . a ;
Objects . requireNonNull ( eVar ) ;
connection2 . connectUser ( j , i , i2 , i2 > 0 ? i2 + 1 : 0 , this . $isMuted , this . $volume ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final /* synthetic */ class b extends d0 . z . d . k implements Function1 < Connection , Unit > {
public static final b i = new b ( ) ;
public b ( ) {
super ( 1 , Connection . class , " dispose " , " dispose()V " , 0 ) ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " p1 " ) ;
connection2 . dispose ( ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class c extends d0 . z . d . o implements Function1 < MediaEngineConnection . d , Unit > {
public final /* synthetic */ e this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public c ( e eVar ) {
super ( 1 ) ;
this . this$0 = eVar ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( MediaEngineConnection . d dVar ) {
MediaEngineConnection . d dVar2 = dVar ;
d0 . z . d . m . checkNotNullParameter ( dVar2 , " it " ) ;
dVar2 . onConnectionStateChange ( this . this$0 , MediaEngineConnection . ConnectionState . DISCONNECTED ) ;
dVar2 . onDestroy ( this . this$0 ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class d extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $disabled ;
public final /* synthetic */ long $userId ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public d ( long j , boolean z2 ) {
super ( 1 ) ;
this . $userId = j ;
this . $disabled = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . disableVideo ( this . $userId , this . $disabled ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
2021-08-12 06:36:45 +00:00
/* renamed from: c.a.q.m0.c.e$e reason: collision with other inner class name */
2021-08-13 06:23:11 +00:00
public static final class C0038e extends d0 . z . d . o implements Function1 < MediaEngineConnection . d , Unit > {
2021-07-24 02:37:17 +00:00
public final /* synthetic */ KrispOveruseDetector . Status $status ;
public final /* synthetic */ e this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-08-13 06:23:11 +00:00
public C0038e ( e eVar , KrispOveruseDetector . Status status ) {
2021-07-24 02:37:17 +00:00
super ( 1 ) ;
this . this$0 = eVar ;
this . $status = status ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( MediaEngineConnection . d dVar ) {
MediaEngineConnection . d dVar2 = dVar ;
d0 . z . d . m . checkNotNullParameter ( dVar2 , " it " ) ;
dVar2 . onKrispStatus ( this . this$0 , this . $status ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class f extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ Function1 $onStats ;
public final /* synthetic */ e this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public f ( e eVar , Function1 function1 ) {
super ( 1 ) ;
this . this$0 = eVar ;
this . $onStats = function1 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . getStats ( new f ( this ) ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class g extends d0 . z . d . o implements Function1 < MediaEngineConnection . d , Unit > {
public final /* synthetic */ MediaEngineConnection . FailedConnectionException $e ;
public final /* synthetic */ e this $0 ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public g ( e eVar , MediaEngineConnection . FailedConnectionException failedConnectionException ) {
super ( 1 ) ;
this . this$0 = eVar ;
this . $e = failedConnectionException ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( MediaEngineConnection . d dVar ) {
MediaEngineConnection . d dVar2 = dVar ;
d0 . z . d . m . checkNotNullParameter ( dVar2 , " it " ) ;
dVar2 . onError ( this . this$0 , this . $e ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class h extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ AudioDecoder $audioDecoder ;
public final /* synthetic */ AudioEncoder $audioEncoder ;
public final /* synthetic */ VideoDecoder $videoDecoder ;
public final /* synthetic */ VideoEncoder $videoEncoder ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public h ( AudioEncoder audioEncoder , VideoEncoder videoEncoder , AudioDecoder audioDecoder , VideoDecoder videoDecoder ) {
super ( 1 ) ;
this . $audioEncoder = audioEncoder ;
this . $videoEncoder = videoEncoder ;
this . $audioDecoder = audioDecoder ;
this . $videoDecoder = videoDecoder ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setCodecs ( this . $audioEncoder , this . $videoEncoder , new AudioDecoder [ ] { this . $audioDecoder } , new VideoDecoder [ ] { this . $videoDecoder } ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class i extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ EncryptionSettings $encryptionSettings ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public i ( EncryptionSettings encryptionSettings ) {
super ( 1 ) ;
this . $encryptionSettings = encryptionSettings ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setEncryptionSettings ( this . $encryptionSettings ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class j extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ MediaEngineConnection . InputMode $inputMode ;
public final /* synthetic */ MediaEngineConnection . c $inputModeOptions ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public j ( MediaEngineConnection . c cVar , MediaEngineConnection . InputMode inputMode ) {
super ( 1 ) ;
this . $inputModeOptions = cVar ;
this . $inputMode = inputMode ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setVADLeadingFramesToBuffer ( this . $inputModeOptions . b ) ;
2021-08-12 06:36:45 +00:00
connection2 . setVADTrailingFramesToSend ( this . $inputModeOptions . f2139c ) ;
2021-07-24 02:37:17 +00:00
connection2 . setVADTriggerThreshold ( ( float ) this . $inputModeOptions . a ) ;
connection2 . setVADAutoThreshold ( this . $inputModeOptions . d ? 3 : - 1 ) ;
connection2 . setVADUseKrisp ( this . $inputModeOptions . e ) ;
connection2 . setAudioInputMode ( this . $inputMode . getNumeral ( ) ) ;
connection2 . enableForwardErrorCorrection ( true ) ;
connection2 . setExpectedPacketLossRate ( 0 . 3f ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class k extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $mute ;
public final /* synthetic */ long $userId ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public k ( long j , boolean z2 ) {
super ( 1 ) ;
this . $userId = j ;
this . $mute = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . muteUser ( this . $userId , this . $mute ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class l extends d0 . z . d . o implements Function1 < MediaEngineConnection . d , Unit > {
public final /* synthetic */ boolean $mute ;
public final /* synthetic */ long $userId ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public l ( long j , boolean z2 ) {
super ( 1 ) ;
this . $userId = j ;
this . $mute = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( MediaEngineConnection . d dVar ) {
MediaEngineConnection . d dVar2 = dVar ;
d0 . z . d . m . checkNotNullParameter ( dVar2 , " it " ) ;
dVar2 . onLocalMute ( this . $userId , this . $mute ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class m extends d0 . z . d . o implements Function1 < MediaEngineConnection . d , Unit > {
public final /* synthetic */ boolean $offScreen ;
public final /* synthetic */ long $userId ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public m ( long j , boolean z2 ) {
super ( 1 ) ;
this . $userId = j ;
this . $offScreen = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( MediaEngineConnection . d dVar ) {
MediaEngineConnection . d dVar2 = dVar ;
d0 . z . d . m . checkNotNullParameter ( dVar2 , " it " ) ;
dVar2 . onLocalVideoOffScreen ( this . $userId , this . $offScreen ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class n extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ long $userId ;
public final /* synthetic */ float $volume ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public n ( long j , float f ) {
super ( 1 ) ;
this . $userId = j ;
this . $volume = f ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setUserPlayoutVolume ( this . $userId , this . $volume / 100 . 0f ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class o extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $active ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public o ( boolean z2 ) {
super ( 1 ) ;
this . $active = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setPTTActive ( this . $active ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class p extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ int $framerate ;
public final /* synthetic */ MediaEngineConnection . b $quality ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public p ( MediaEngineConnection . b bVar , int i ) {
super ( 1 ) ;
this . $quality = bVar ;
this . $framerate = i ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
MediaEngineConnection . b bVar = this . $quality ;
2021-08-12 06:36:45 +00:00
connection2 . setEncodingQuality ( bVar . a , bVar . b , bVar . f2138c , bVar . d , this . $framerate ) ;
2021-07-24 02:37:17 +00:00
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class q extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $selfDeaf ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public q ( boolean z2 ) {
super ( 1 ) ;
this . $selfDeaf = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . deafenLocalUser ( this . $selfDeaf ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class r extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $selfMute ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public r ( boolean z2 ) {
super ( 1 ) ;
this . $selfMute = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . muteLocalUser ( this . $selfMute ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class s extends d0 . z . d . o implements Function1 < Connection , Unit > {
public final /* synthetic */ boolean $isVideoBroadcast ;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public s ( boolean z2 ) {
super ( 1 ) ;
this . $isVideoBroadcast = z2 ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . setVideoBroadcast ( this . $isVideoBroadcast ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class t extends d0 . z . d . o implements Function1 < Connection , Unit > {
2021-08-12 06:36:45 +00:00
public final /* synthetic */ c . a . q . m0 . b $screenCapturer ;
2021-07-24 02:37:17 +00:00
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-08-12 06:36:45 +00:00
public t ( c . a . q . m0 . b bVar ) {
2021-07-24 02:37:17 +00:00
super ( 1 ) ;
this . $screenCapturer = bVar ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
2021-08-12 06:36:45 +00:00
c . a . q . m0 . b bVar = this . $screenCapturer ;
2021-07-24 02:37:17 +00:00
connection2 . startScreenshareBroadcast ( bVar , bVar . n . getNativeInstance ( ) ) ;
return Unit . a ;
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class u extends MediaProjection . Callback {
@Override // android.media.projection.MediaProjection.Callback
public void onStop ( ) {
}
}
/* compiled from: MediaEngineConnectionLegacy.kt */
public static final class v extends d0 . z . d . o implements Function1 < Connection , Unit > {
public static final v i = new v ( ) ;
public v ( ) {
super ( 1 ) ;
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // kotlin.jvm.functions.Function1
public Unit invoke ( Connection connection ) {
Connection connection2 = connection ;
d0 . z . d . m . checkNotNullParameter ( connection2 , " $receiver " ) ;
connection2 . stopScreenshareBroadcast ( ) ;
return Unit . a ;
}
}
2021-08-12 06:36:45 +00:00
public e ( c . a . q . c cVar , Logger logger , t tVar , Discord discord , List < c . a . q . m0 . a > list , MediaEngineConnection . Type type , long j2 , MediaEngine . a aVar , List < ? extends MediaEngineConnection . d > list2 ) {
2021-07-24 02:37:17 +00:00
d0 . z . d . m . checkNotNullParameter ( cVar , " mediaEngineThreadExecutor " ) ;
d0 . z . d . m . checkNotNullParameter ( logger , " logger " ) ;
d0 . z . d . m . checkNotNullParameter ( tVar , " noiseCancellationConfig " ) ;
d0 . z . d . m . checkNotNullParameter ( discord , " voiceEngineLegacy " ) ;
d0 . z . d . m . checkNotNullParameter ( list , " supportedVideoCodecs " ) ;
d0 . z . d . m . checkNotNullParameter ( type , " type " ) ;
d0 . z . d . m . checkNotNullParameter ( aVar , " connectionOptions " ) ;
d0 . z . d . m . checkNotNullParameter ( list2 , " listeners " ) ;
this . l = cVar ;
this . m = logger ;
this . n = tVar ;
this . o = discord ;
this . p = list ;
this . q = type ;
this . r = j2 ;
MediaEngineConnection . ConnectionState connectionState = MediaEngineConnection . ConnectionState . CONNECTING ;
2021-08-12 06:36:45 +00:00
this . f216c = connectionState ;
2021-07-24 02:37:17 +00:00
this . e = h0 . mutableMapOf ( d0 . o . to ( Long . valueOf ( j2 ) , Integer . valueOf ( aVar . a ) ) ) ;
2021-08-06 20:07:13 +00:00
boolean z2 = type = = MediaEngineConnection . Type . STREAM ;
int i2 = aVar . a ;
String str = aVar . b ;
2021-08-12 06:36:45 +00:00
int i3 = aVar . f2136c ;
2021-08-06 20:07:13 +00:00
Object [ ] array = aVar . d . toArray ( new StreamParameters [ 0 ] ) ;
Objects . requireNonNull ( array , " null cannot be cast to non-null type kotlin.Array<T> " ) ;
Connection connectToServer = discord . connectToServer ( i2 , j2 , str , i3 , ( StreamParameters [ ] ) array , z2 , new d ( this ) ) ;
2021-07-24 02:37:17 +00:00
d0 . z . d . m . checkNotNullExpressionValue ( connectToServer , " voiceEngineLegacy.connec…fo, errorMessage) } \ n } " ) ;
connectToServer . setOnVideoCallback ( new b ( this ) ) ;
connectToServer . setUserSpeakingStatusChangedCallback ( new c ( this ) ) ;
this . k = connectToServer ;
this . b = new CopyOnWriteArrayList < > ( list2 ) ;
2021-08-12 06:36:45 +00:00
this . f216c = connectionState ;
2021-07-24 02:37:17 +00:00
y ( new a ( this , connectionState ) ) ;
}
public static final void x ( e eVar , Function0 function0 ) {
2021-08-11 06:37:47 +00:00
c . a . q . c cVar = eVar . l ;
2021-07-24 02:37:17 +00:00
cVar . k . execute ( new i ( function0 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public synchronized void a ( Intent intent , ThumbnailEmitter thumbnailEmitter ) {
d0 . z . d . m . checkNotNullParameter ( intent , " permission " ) ;
2021-08-12 06:36:45 +00:00
z ( new t ( new c . a . q . m0 . b ( intent , new u ( ) , this . m , thumbnailEmitter ) ) ) ;
2021-07-24 02:37:17 +00:00
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public boolean b ( ) {
return this . n . a ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void c ( boolean z2 ) {
this . d = z2 ;
z ( new r ( z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void d ( long j2 , boolean z2 ) {
if ( z2 ) {
this . i . add ( Long . valueOf ( j2 ) ) ;
} else {
this . i . remove ( Long . valueOf ( j2 ) ) ;
}
y ( new m ( j2 , z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void destroy ( ) {
Logger logger = this . m ;
String str = a ;
d0 . z . d . m . checkNotNullExpressionValue ( str , " TAG " ) ;
Logger . i$default ( logger , str , " destroy(). Disconnecting from server " , null , 4 , null ) ;
z ( b . i ) ;
y ( new c ( this ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void e ( long j2 , float f2 ) {
z ( new n ( j2 , f2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void f ( KrispOveruseDetector . Status status ) {
d0 . z . d . m . checkNotNullParameter ( status , " status " ) ;
2021-08-13 06:23:11 +00:00
y ( new C0038e ( this , status ) ) ;
2021-07-24 02:37:17 +00:00
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public boolean g ( long j2 ) {
return this . h . contains ( Long . valueOf ( j2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public MediaEngineConnection . Type getType ( ) {
return this . q ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public synchronized void h ( ) {
z ( v . i ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void i ( long j2 , boolean z2 ) {
z ( new d ( j2 , z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void j ( boolean z2 ) {
z ( new s ( z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void k ( MediaEngineConnection . InputMode inputMode , MediaEngineConnection . c cVar ) {
d0 . z . d . m . checkNotNullParameter ( inputMode , " inputMode " ) ;
d0 . z . d . m . checkNotNullParameter ( cVar , " inputModeOptions " ) ;
t tVar = this . n ;
if ( inputMode = = MediaEngineConnection . InputMode . VOICE_ACTIVITY ) {
boolean z2 = cVar . d ;
}
Objects . requireNonNull ( tVar ) ;
z ( new j ( cVar , inputMode ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void l ( MediaEngineConnection . d dVar ) {
d0 . z . d . m . checkNotNullParameter ( dVar , " listener " ) ;
this . b . add ( dVar ) ;
2021-08-12 06:36:45 +00:00
dVar . onConnectionStateChange ( this , this . f216c ) ;
2021-07-24 02:37:17 +00:00
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void m ( MediaEngineConnection . b bVar ) {
d0 . z . d . m . checkNotNullParameter ( bVar , " quality " ) ;
z ( new p ( bVar , this . d ? bVar . e : bVar . f ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void n ( Function1 < ? super Stats , Unit > function1 ) {
d0 . z . d . m . checkNotNullParameter ( function1 , " onStats " ) ;
z ( new f ( this , function1 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void o ( MediaEngineConnection . d dVar ) {
d0 . z . d . m . checkNotNullParameter ( dVar , " listener " ) ;
this . b . remove ( dVar ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public boolean p ( long j2 ) {
return this . i . contains ( Long . valueOf ( j2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void q ( boolean z2 ) {
z ( new o ( z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void r ( String str , String str2 ) {
Object obj ;
Object obj2 ;
d0 . z . d . m . checkNotNullParameter ( str , " audioCodec " ) ;
d0 . z . d . m . checkNotNullParameter ( str2 , " videoCodec " ) ;
Iterator < T > it = this . j . iterator ( ) ;
while ( true ) {
obj = null ;
if ( ! it . hasNext ( ) ) {
obj2 = null ;
break ;
}
obj2 = it . next ( ) ;
2021-08-12 06:36:45 +00:00
if ( d0 . z . d . m . areEqual ( ( ( c . a . q . m0 . a ) obj2 ) . a , str ) ) {
2021-07-24 02:37:17 +00:00
break ;
}
}
2021-08-12 06:36:45 +00:00
c . a . q . m0 . a aVar = ( c . a . q . m0 . a ) obj2 ;
2021-07-24 02:37:17 +00:00
Iterator < T > it2 = this . j . iterator ( ) ;
while ( true ) {
if ( ! it2 . hasNext ( ) ) {
break ;
}
Object next = it2 . next ( ) ;
2021-08-12 06:36:45 +00:00
if ( d0 . z . d . m . areEqual ( ( ( c . a . q . m0 . a ) next ) . a , str2 ) ) {
2021-07-24 02:37:17 +00:00
obj = next ;
break ;
}
}
2021-08-12 06:36:45 +00:00
c . a . q . m0 . a aVar2 = ( c . a . q . m0 . a ) obj ;
2021-07-24 02:37:17 +00:00
if ( aVar = = null ) {
throw new MediaEngineConnection . FailedConnectionException ( " Missing audio codec: " + str + '.' , MediaEngineConnection . FailedConnectionException . FailureType . CODEC_NEGOTIATION_FAILED ) ;
} else if ( aVar2 ! = null ) {
try {
Integer num = aVar2 . e ;
if ( num ! = null ) {
num . intValue ( ) ;
AudioEncoder audioEncoder = new AudioEncoder ( aVar . d , str , 48000 , 960 , 1 , 64000 ) ;
AudioDecoder audioDecoder = new AudioDecoder ( aVar . d , str , 48000 , 2 , g0 . mapOf ( d0 . o . to ( " stereo " , " 1 " ) ) ) ;
Map mapOf = h0 . mapOf ( d0 . o . to ( " level-asymmetry-allowed " , " 1 " ) , d0 . o . to ( " packetization-mode " , " 1 " ) , d0 . o . to ( " profile-level-id " , " 42e01f " ) ) ;
z ( new h ( audioEncoder , new VideoEncoder ( str2 , aVar2 . d , aVar2 . e . intValue ( ) , mapOf ) , audioDecoder , new VideoDecoder ( str2 , aVar2 . d , aVar2 . e . intValue ( ) , mapOf ) ) ) ;
return ;
}
throw new MediaEngineConnection . FailedConnectionException ( " Video codec " + str2 + " rtxPayloadType was null. " , MediaEngineConnection . FailedConnectionException . FailureType . CODEC_NEGOTIATION_FAILED ) ;
} catch ( MediaEngineConnection . FailedConnectionException e ) {
y ( new g ( this , e ) ) ;
}
} else {
throw new MediaEngineConnection . FailedConnectionException ( " Missing video codec: " + str2 + '.' , MediaEngineConnection . FailedConnectionException . FailureType . CODEC_NEGOTIATION_FAILED ) ;
}
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void s ( long j2 , int i2 , Integer num , boolean z2 , float f2 ) {
if ( i2 = = 0 ) {
Logger logger = this . m ;
String str = a ;
d0 . z . d . m . checkNotNullExpressionValue ( str , " TAG " ) ;
Logger . w$default ( logger , str , " Attempting to create user " + j2 + " with 0 audio SSRC " , null , 4 , null ) ;
return ;
}
Long valueOf = num ! = null ? Long . valueOf ( ( long ) num . intValue ( ) ) : this . f . get ( Long . valueOf ( j2 ) ) ;
long longValue = valueOf ! = null ? valueOf . longValue ( ) : 0 ;
Integer num2 = this . e . get ( Long . valueOf ( j2 ) ) ;
boolean z3 = false ;
boolean z4 = num2 = = null | | num2 . intValue ( ) ! = i2 ;
Long l2 = this . f . get ( Long . valueOf ( j2 ) ) ;
if ( l2 = = null | | l2 . longValue ( ) ! = longValue ) {
z3 = true ;
}
if ( z4 | | z3 ) {
Logger logger2 = this . m ;
String str2 = a ;
d0 . z . d . m . checkNotNullExpressionValue ( str2 , " TAG " ) ;
Logger . i$default ( logger2 , str2 , " creating user: " + j2 + " with audio SSRC: " + i2 + " and video SSRC: " + num , null , 4 , null ) ;
z ( new a ( this , j2 , i2 , longValue , z2 , f2 ) ) ;
}
if ( z2 ) {
this . g . add ( Long . valueOf ( j2 ) ) ;
} else {
this . g . remove ( Long . valueOf ( j2 ) ) ;
}
this . e . put ( Long . valueOf ( j2 ) , Integer . valueOf ( i2 ) ) ;
this . f . put ( Long . valueOf ( j2 ) , Long . valueOf ( longValue ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void t ( String str , int [ ] iArr ) {
d0 . z . d . m . checkNotNullParameter ( str , " mode " ) ;
d0 . z . d . m . checkNotNullParameter ( iArr , " secretKey " ) ;
z ( new i ( new EncryptionSettings ( str , iArr ) ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public boolean u ( long j2 ) {
return this . g . contains ( Long . valueOf ( j2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void v ( boolean z2 ) {
z ( new q ( z2 ) ) ;
}
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection
public void w ( long j2 , boolean z2 ) {
z ( new k ( j2 , z2 ) ) ;
if ( z2 ) {
this . g . add ( Long . valueOf ( j2 ) ) ;
} else {
this . g . remove ( Long . valueOf ( j2 ) ) ;
}
y ( new l ( j2 , z2 ) ) ;
}
public final void y ( Function1 < ? super MediaEngineConnection . d , Unit > function1 ) {
for ( MediaEngineConnection . d dVar : this . b ) {
try {
d0 . z . d . m . checkNotNullExpressionValue ( dVar , " it " ) ;
function1 . invoke ( dVar ) ;
} catch ( Exception e ) {
Logger logger = this . m ;
String str = a ;
d0 . z . d . m . checkNotNullExpressionValue ( str , " TAG " ) ;
Logger . e$default ( logger , str , " Error in listener " , e , null , 8 , null ) ;
}
}
}
public final synchronized void z ( Function1 < ? super Connection , Unit > function1 ) {
function1 . invoke ( this . k ) ;
}
}