2021-07-03 23:36:06 +00:00
|
|
|
package c.a.r.k0.c;
|
2021-06-27 20:44:35 +00:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Build;
|
2021-06-27 20:53:42 +00:00
|
|
|
import c.a.r.c0;
|
2021-06-27 20:44:35 +00:00
|
|
|
import co.discord.media_engine.RtcRegion;
|
|
|
|
import co.discord.media_engine.VideoInputDeviceDescription;
|
|
|
|
import com.discord.rtcconnection.KrispOveruseDetector;
|
|
|
|
import com.discord.rtcconnection.mediaengine.MediaEngine;
|
|
|
|
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
|
|
|
|
import com.discord.utilities.logging.Logger;
|
|
|
|
import com.hammerandchisel.libdiscord.Discord;
|
|
|
|
import d0.t.n0;
|
|
|
|
import d0.t.u;
|
|
|
|
import d0.z.d.k;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.Set;
|
|
|
|
import java.util.concurrent.Future;
|
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import org.webrtc.Logging;
|
|
|
|
import org.webrtc.voiceengine.WebRtcAudioManager;
|
|
|
|
import rx.Emitter;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.functions.Action1;
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public final class j implements MediaEngine {
|
|
|
|
public static final Set<String> a = n0.setOf((Object[]) new String[]{"Pixel", "Pixel XL", "Pixel 3a", "Pixel 3a XL", "Pixel 4", "Pixel 4 XL", "Pixel 5"});
|
|
|
|
public static final Set<String> b = n0.setOf((Object[]) new String[]{"Redmi Note 8 Pro", "Redmi Note 8 pro"});
|
|
|
|
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
2021-07-03 23:36:06 +00:00
|
|
|
public final r f212c;
|
2021-06-27 20:44:35 +00:00
|
|
|
public final List<MediaEngineConnection> d;
|
|
|
|
public final List<MediaEngine.b> e;
|
|
|
|
public boolean f;
|
|
|
|
public Discord g;
|
2021-07-03 23:36:06 +00:00
|
|
|
public List<c.a.r.k0.a> h;
|
2021-06-27 20:44:35 +00:00
|
|
|
public MediaEngine.OpenSLUsageMode i;
|
|
|
|
public final Context j;
|
|
|
|
public final c.a.r.c k;
|
|
|
|
public final MediaEngine.OpenSLESConfig l;
|
|
|
|
public final Logger m;
|
|
|
|
public final Set<String> n;
|
|
|
|
public final Set<String> o;
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class a implements MediaEngineConnection.c {
|
|
|
|
public final /* synthetic */ j a;
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-07-03 23:36:06 +00:00
|
|
|
/* renamed from: c.a.r.k0.c.j$a$a reason: collision with other inner class name */
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final class C0037a extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ MediaEngineConnection $connection;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public C0037a(a aVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
|
|
|
public Unit mo1invoke() {
|
|
|
|
j.q(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class b extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ MediaEngineConnection $connection;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public b(a aVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
|
|
|
public Unit mo1invoke() {
|
|
|
|
j.q(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class c extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ MediaEngineConnection $connection;
|
|
|
|
public final /* synthetic */ a this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public c(a aVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = aVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
|
|
|
public Unit mo1invoke() {
|
|
|
|
j.q(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public a(j jVar, MediaEngine.a aVar, MediaEngineConnection.Type type, long j) {
|
|
|
|
this.a = jVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
2021-07-03 23:36:06 +00:00
|
|
|
public void onConnected(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.TransportInfo transportInfo, List<c.a.r.k0.a> list) {
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(transportInfo, "transportInfo");
|
|
|
|
m.checkNotNullParameter(list, "supportedVideoCodecs");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onConnectionStateChange(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.ConnectionState connectionState) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(connectionState, "connectionState");
|
|
|
|
if (connectionState == MediaEngineConnection.ConnectionState.DISCONNECTED) {
|
|
|
|
j.r(this.a, new b(this, mediaEngineConnection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onDestroy(MediaEngineConnection mediaEngineConnection) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
j.r(this.a, new C0037a(this, mediaEngineConnection));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onError(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.FailedConnectionException failedConnectionException) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(failedConnectionException, "exception");
|
|
|
|
j.r(this.a, new c(this, mediaEngineConnection));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onKrispStatus(MediaEngineConnection mediaEngineConnection, KrispOveruseDetector.Status status) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(status, "status");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onLocalMute(long j, boolean z2) {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onLocalVideoOffScreen(long j, boolean z2) {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onSpeaking(long j, int i, boolean z2) {
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.c
|
|
|
|
public void onVideo(long j, Integer num, int i, int i2, int i3) {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class b extends o implements Function1<MediaEngine.b, Unit> {
|
|
|
|
public final /* synthetic */ e $connection;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public b(e eVar) {
|
|
|
|
super(1);
|
|
|
|
this.$connection = 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(MediaEngine.b bVar) {
|
|
|
|
MediaEngine.b bVar2 = bVar;
|
|
|
|
m.checkNotNullParameter(bVar2, "it");
|
|
|
|
bVar2.onNewConnection(this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class c<T> implements Action1<Emitter<MediaEngine.AudioInfo>> {
|
|
|
|
public final /* synthetic */ j i;
|
|
|
|
|
|
|
|
public c(j jVar) {
|
|
|
|
this.i = jVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
|
|
@Override // rx.functions.Action1
|
|
|
|
public void call(Emitter<MediaEngine.AudioInfo> emitter) {
|
|
|
|
Emitter<MediaEngine.AudioInfo> emitter2 = emitter;
|
|
|
|
Discord discord = this.i.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.getAudioSubsystem(new l(emitter2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-07-03 23:36:06 +00:00
|
|
|
public static final class d<T> implements Action1<List<? extends c.a.r.k0.a>> {
|
2021-06-27 20:44:35 +00:00
|
|
|
public final /* synthetic */ j i;
|
|
|
|
|
|
|
|
public d(j jVar) {
|
|
|
|
this.i = jVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
2021-07-03 23:36:06 +00:00
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends c.a.r.k0.a> */
|
2021-06-27 20:44:35 +00:00
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
@Override // rx.functions.Action1
|
2021-07-03 23:36:06 +00:00
|
|
|
public void call(List<? extends c.a.r.k0.a> list) {
|
|
|
|
List<? extends c.a.r.k0.a> list2 = list;
|
2021-06-27 20:44:35 +00:00
|
|
|
j jVar = this.i;
|
|
|
|
m.checkNotNullExpressionValue(list2, "codecs");
|
|
|
|
jVar.h = list2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-07-03 23:36:06 +00:00
|
|
|
public static final class e<T, R> implements j0.k.b<List<? extends c.a.r.k0.a>, Unit> {
|
2021-06-27 20:44:35 +00:00
|
|
|
public static final e i = new e();
|
|
|
|
|
|
|
|
/* 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 // j0.k.b
|
2021-07-03 23:36:06 +00:00
|
|
|
public Unit call(List<? extends c.a.r.k0.a> list) {
|
2021-06-27 20:44:35 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class f implements Discord.LocalVoiceLevelChangedCallback {
|
|
|
|
public final /* synthetic */ Function1 a;
|
|
|
|
|
|
|
|
public f(Function1 function1) {
|
|
|
|
this.a = function1;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.hammerandchisel.libdiscord.Discord.LocalVoiceLevelChangedCallback
|
|
|
|
public final void onLocalVoiceLevelChanged(float f, int i) {
|
|
|
|
boolean z2 = true;
|
|
|
|
if ((i & 1) == 0) {
|
|
|
|
z2 = false;
|
|
|
|
}
|
|
|
|
this.a.invoke(new MediaEngine.LocalVoiceStatus(f, z2));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class g implements Logging.ExternalReporter {
|
|
|
|
public final /* synthetic */ j a;
|
|
|
|
|
|
|
|
public g(j jVar) {
|
|
|
|
this.a = jVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // org.webrtc.Logging.ExternalReporter
|
|
|
|
public final void e(String str, String str2, Throwable th) {
|
|
|
|
Logger logger = this.a.m;
|
|
|
|
m.checkNotNullExpressionValue(str, "tag");
|
|
|
|
m.checkNotNullExpressionValue(str2, "message");
|
|
|
|
Logger.e$default(logger, str, str2, th, null, 8, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final /* synthetic */ class h extends k implements Function1<MediaEngine.b, Unit> {
|
|
|
|
public static final h i = new h();
|
|
|
|
|
|
|
|
public h() {
|
|
|
|
super(1, MediaEngine.b.class, "onNativeEngineInitialized", "onNativeEngineInitialized()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(MediaEngine.b bVar) {
|
|
|
|
MediaEngine.b bVar2 = bVar;
|
|
|
|
m.checkNotNullParameter(bVar2, "p1");
|
|
|
|
bVar2.onNativeEngineInitialized();
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public j(Context context, c.a.r.c cVar, MediaEngine.OpenSLESConfig openSLESConfig, Logger logger, Set set, Set set2, int i) {
|
|
|
|
Set<String> set3 = null;
|
|
|
|
Set<String> set4 = (i & 16) != 0 ? a : null;
|
|
|
|
set3 = (i & 32) != 0 ? b : set3;
|
|
|
|
m.checkNotNullParameter(context, "context");
|
|
|
|
m.checkNotNullParameter(cVar, "mediaEngineThreadExecutor");
|
|
|
|
m.checkNotNullParameter(openSLESConfig, "openSLESConfig");
|
|
|
|
m.checkNotNullParameter(logger, "logger");
|
|
|
|
m.checkNotNullParameter(set4, "defaultOpenSLAllowList");
|
|
|
|
m.checkNotNullParameter(set3, "defaultOpenSLExcludeList");
|
|
|
|
this.j = context;
|
|
|
|
this.k = cVar;
|
|
|
|
this.l = openSLESConfig;
|
|
|
|
this.m = logger;
|
|
|
|
this.n = set4;
|
|
|
|
this.o = set3;
|
2021-07-03 23:36:06 +00:00
|
|
|
this.f212c = new r();
|
2021-06-27 20:44:35 +00:00
|
|
|
this.d = new ArrayList();
|
|
|
|
this.e = new ArrayList();
|
|
|
|
this.f = true;
|
|
|
|
this.i = MediaEngine.OpenSLUsageMode.ALLOW_LIST;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void q(j jVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
synchronized (jVar) {
|
|
|
|
Discord discord = jVar.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setLocalVoiceLevelChangedCallback(null);
|
|
|
|
}
|
|
|
|
jVar.d.remove(mediaEngineConnection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final Future r(j jVar, Function0 function0) {
|
|
|
|
c.a.r.c cVar = jVar.k;
|
2021-06-27 20:53:42 +00:00
|
|
|
return cVar.k.submit(new q(function0));
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Observable<Unit> a() {
|
|
|
|
if (this.h != null) {
|
|
|
|
j0.l.e.j jVar = new j0.l.e.j(Unit.a);
|
|
|
|
m.checkNotNullExpressionValue(jVar, "Observable.just(Unit)");
|
|
|
|
return jVar;
|
|
|
|
}
|
|
|
|
t();
|
|
|
|
if (this.g == null) {
|
2021-07-03 23:36:06 +00:00
|
|
|
Observable<Unit> w = Observable.w(new IllegalStateException("Failed to initialize native media engine"));
|
|
|
|
m.checkNotNullExpressionValue(w, "Observable.error(Illegal…ze native media engine\"))");
|
|
|
|
return w;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
Observable n = Observable.n(new n(this), Emitter.BackpressureMode.NONE);
|
|
|
|
m.checkNotNullExpressionValue(n, "Observable.create({ emit…er.BackpressureMode.NONE)");
|
2021-07-03 23:36:06 +00:00
|
|
|
Observable<Unit> F = n.t(new d(this)).F(e.i);
|
|
|
|
m.checkNotNullExpressionValue(F, "getSupportedVideoCodecs(…s }\n .map { Unit }");
|
|
|
|
return F;
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void b(RtcRegion[] rtcRegionArr, Function1<? super String[], Unit> function1) {
|
|
|
|
m.checkNotNullParameter(rtcRegionArr, "regionsWithIps");
|
|
|
|
m.checkNotNullParameter(function1, "callback");
|
|
|
|
t();
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.getRankedRtcRegions(rtcRegionArr, new o(function1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public c.a.r.c c() {
|
|
|
|
return this.k;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void d(boolean z2) {
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setEchoCancellation(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void e(boolean z2) {
|
2021-07-03 23:36:06 +00:00
|
|
|
this.f212c.a = z2;
|
2021-06-27 20:44:35 +00:00
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setNoiseCancellation(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Observable<MediaEngine.AudioInfo> f() {
|
|
|
|
Observable<MediaEngine.AudioInfo> n = Observable.n(new c(this), Emitter.BackpressureMode.LATEST);
|
|
|
|
m.checkNotNullExpressionValue(n, "Observable.create({ emit….BackpressureMode.LATEST)");
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void g(int i) {
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setVideoInputDevice(i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public synchronized List<MediaEngineConnection> getConnections() {
|
|
|
|
return u.toList(this.d);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public synchronized MediaEngineConnection h(long j, MediaEngine.a aVar, MediaEngineConnection.Type type, Function1<? super Exception, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(aVar, "options");
|
|
|
|
m.checkNotNullParameter(type, "type");
|
|
|
|
m.checkNotNullParameter(function1, "onFailure");
|
|
|
|
e eVar = null;
|
|
|
|
if (!(this.h != null)) {
|
2021-06-27 20:53:42 +00:00
|
|
|
((c0) function1).invoke(new IllegalStateException("connect called on unprepared media engine."));
|
2021-06-27 20:44:35 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
Logger logger = this.m;
|
|
|
|
Logger.i$default(logger, "MediaEngineLegacy", "Connecting with options: " + aVar, null, 4, null);
|
|
|
|
a aVar2 = new a(this, aVar, type, j);
|
|
|
|
c.a.r.c cVar = this.k;
|
|
|
|
Logger logger2 = this.m;
|
2021-07-03 23:36:06 +00:00
|
|
|
r rVar = this.f212c;
|
|
|
|
List<c.a.r.k0.a> list = this.h;
|
2021-06-27 20:44:35 +00:00
|
|
|
if (list == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("supportedVideoCodecs");
|
|
|
|
}
|
|
|
|
eVar = new e(cVar, logger2, rVar, discord, list, type, j, aVar, d0.t.m.listOf(aVar2));
|
|
|
|
}
|
|
|
|
if (eVar != null) {
|
|
|
|
this.d.add(eVar);
|
|
|
|
s(new b(eVar));
|
|
|
|
}
|
|
|
|
return eVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void i(float f2) {
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setSpeakerVolume(Math.min(300.0f, Math.max(0.0f, f2)) / 100.0f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void j(boolean z2) {
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setNoiseSuppression(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void k(MediaEngine.OpenSLUsageMode openSLUsageMode) {
|
|
|
|
m.checkNotNullParameter(openSLUsageMode, "openSLUsageMode");
|
|
|
|
if (this.g != null) {
|
|
|
|
Logger.e$default(this.m, "MediaEngineLegacy", "setting openSLUsageMode too late", null, null, 12, null);
|
|
|
|
}
|
|
|
|
this.i = openSLUsageMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Discord l() {
|
|
|
|
return this.g;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void m(Function1<? super VideoInputDeviceDescription[], Unit> function1) {
|
|
|
|
m.checkNotNullParameter(function1, "devicesCallback");
|
|
|
|
t();
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.getVideoInputDevices(new p(function1));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void n(boolean z2) {
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setAutomaticGainControl(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void o(boolean z2) {
|
|
|
|
this.f = z2;
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setAudioInputEnabled(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void p(Function1<? super MediaEngine.LocalVoiceStatus, Unit> function1) {
|
|
|
|
if (function1 != null) {
|
|
|
|
t();
|
|
|
|
Discord discord = this.g;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setLocalVoiceLevelChangedCallback(new f(function1));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Discord discord2 = this.g;
|
|
|
|
if (discord2 != null) {
|
|
|
|
discord2.setLocalVoiceLevelChangedCallback(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void s(Function1<? super MediaEngine.b, Unit> function1) {
|
|
|
|
for (MediaEngine.b bVar : this.e) {
|
|
|
|
try {
|
|
|
|
function1.invoke(bVar);
|
|
|
|
} catch (Exception e2) {
|
|
|
|
Logger.e$default(this.m, "MediaEngineLegacy", "Error in listener", e2, null, 8, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void t() {
|
|
|
|
if (this.g == null) {
|
|
|
|
Logger logger = this.m;
|
|
|
|
StringBuilder L = c.d.b.a.a.L("initializing voice engine. OpenSL ES: ");
|
|
|
|
L.append(this.l);
|
|
|
|
L.append(", OpenSL usage mode: ");
|
|
|
|
L.append(this.i);
|
|
|
|
Logger.i$default(logger, "MediaEngineLegacy", L.toString(), null, 4, null);
|
|
|
|
int ordinal = this.l.ordinal();
|
|
|
|
boolean z2 = false;
|
|
|
|
if (ordinal == 0) {
|
|
|
|
if (this.i == MediaEngine.OpenSLUsageMode.ALLOW_LIST) {
|
|
|
|
z2 = this.n.contains(Build.MODEL);
|
|
|
|
} else if (!this.o.contains(Build.MODEL)) {
|
|
|
|
z2 = true;
|
|
|
|
}
|
|
|
|
Logger logger2 = this.m;
|
|
|
|
StringBuilder L2 = c.d.b.a.a.L("OpenSL ES default. mode: ");
|
|
|
|
L2.append(this.i);
|
|
|
|
L2.append(", enableOpenSL: ");
|
|
|
|
L2.append(z2);
|
|
|
|
L2.append(", model: '");
|
|
|
|
L2.append(Build.MODEL);
|
|
|
|
L2.append('\'');
|
|
|
|
Logger.i$default(logger2, "MediaEngineLegacy", L2.toString(), null, 4, null);
|
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(!z2);
|
|
|
|
} else if (ordinal == 1) {
|
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false);
|
|
|
|
} else if (ordinal == 2) {
|
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
|
|
|
}
|
|
|
|
Logging.externalReporter = new g(this);
|
|
|
|
try {
|
|
|
|
Discord discord = new Discord(this.j, 2);
|
|
|
|
discord.enableBuiltInAEC(true);
|
|
|
|
discord.setAudioInputEnabled(this.f);
|
|
|
|
this.g = discord;
|
|
|
|
} catch (ExceptionInInitializerError e2) {
|
|
|
|
Logger.e$default(this.m, "MediaEngineLegacy", "Unable to initialize voice engine.", e2, null, 8, null);
|
|
|
|
} catch (UnsatisfiedLinkError e3) {
|
|
|
|
Logger.e$default(this.m, "MediaEngineLegacy", "Unable to initialize voice engine.", e3, null, 8, null);
|
|
|
|
} catch (Throwable th) {
|
|
|
|
Logger.e$default(this.m, "MediaEngineLegacy", "Unable to initialize voice engine, new error discovered", th, null, 8, null);
|
|
|
|
}
|
|
|
|
if (this.g != null) {
|
|
|
|
s(h.i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|