2021-12-17 21:59:34 +00:00
|
|
|
package b.a.q.m0.c;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.os.Build;
|
|
|
|
import androidx.annotation.AnyThread;
|
2021-12-17 21:59:34 +00:00
|
|
|
import b.a.q.e0;
|
2021-07-24 02:37:17 +00:00
|
|
|
import co.discord.media_engine.RtcRegion;
|
|
|
|
import co.discord.media_engine.VideoInputDeviceDescription;
|
|
|
|
import com.discord.rtcconnection.mediaengine.MediaEngine;
|
|
|
|
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
|
|
|
|
import com.discord.utilities.logging.Logger;
|
|
|
|
import com.hammerandchisel.libdiscord.Discord;
|
2021-11-02 06:38:17 +00:00
|
|
|
import d0.t.n0;
|
|
|
|
import d0.t.u;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import d0.z.d.o;
|
2021-07-24 02:37:17 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.List;
|
2021-09-07 06:52:02 +00:00
|
|
|
import java.util.Objects;
|
2021-07-24 02:37:17 +00:00
|
|
|
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;
|
2021-08-17 07:10:14 +00:00
|
|
|
import org.webrtc.voiceengine.WebRtcAudioUtils;
|
2021-07-24 02:37:17 +00:00
|
|
|
import rx.Emitter;
|
|
|
|
import rx.Observable;
|
|
|
|
import rx.functions.Action1;
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public final class k implements MediaEngine {
|
|
|
|
public static final Set<String> a = n0.setOf((Object[]) new String[]{"Pixel", "Pixel XL", "Pixel 3a XL", "Pixel 4", "Pixel 4 XL", "Pixel 5"});
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
|
|
public static final Set<String> f266b = n0.setOf((Object[]) new String[]{"Pixel 3a", "Redmi Note 8 Pro", "Redmi Note 8 pro"});
|
|
|
|
public final u c;
|
2021-07-24 02:37:17 +00:00
|
|
|
public final List<MediaEngineConnection> d;
|
|
|
|
public boolean e;
|
|
|
|
public Discord f;
|
2021-12-17 21:59:34 +00:00
|
|
|
public List<b.a.q.m0.a> g;
|
2021-07-24 02:37:17 +00:00
|
|
|
public MediaEngine.OpenSLUsageMode h;
|
2021-09-07 06:52:02 +00:00
|
|
|
public MediaEngine.EchoCancellationInfo i;
|
|
|
|
public final Context j;
|
|
|
|
public final MediaEngine.c k;
|
2021-12-17 21:59:34 +00:00
|
|
|
public final b.a.q.c l;
|
2021-09-07 06:52:02 +00:00
|
|
|
public final MediaEngine.OpenSLESConfig m;
|
|
|
|
public final Logger n;
|
2021-12-17 21:59:34 +00:00
|
|
|
public final b.a.q.k0.g o;
|
2021-09-07 06:52:02 +00:00
|
|
|
public final MediaEngine.b p;
|
|
|
|
public final Set<String> q;
|
2021-11-02 06:38:17 +00:00
|
|
|
public final Set<String> r;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class a extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ k this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(k kVar) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = kVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
k kVar = this.this$0;
|
2021-12-02 18:53:44 +00:00
|
|
|
j jVar = j.j;
|
2021-07-24 02:37:17 +00:00
|
|
|
Set<String> set = k.a;
|
|
|
|
kVar.n(jVar);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-09-07 06:52:02 +00:00
|
|
|
public static final class b extends o implements Function1<MediaEngine.c, Unit> {
|
2021-07-24 02:37:17 +00:00
|
|
|
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
|
2021-09-07 06:52:02 +00:00
|
|
|
public Unit invoke(MediaEngine.c cVar) {
|
|
|
|
MediaEngine.c cVar2 = cVar;
|
|
|
|
m.checkNotNullParameter(cVar2, "it");
|
|
|
|
cVar2.onNewConnection(this.$connection);
|
2021-07-24 02:37:17 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class c extends MediaEngineConnection.a {
|
|
|
|
public final /* synthetic */ k a;
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class a extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ c this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(c cVar) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = cVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
k kVar = this.this$0.a;
|
2021-12-02 18:53:44 +00:00
|
|
|
l lVar = l.j;
|
2021-07-24 02:37:17 +00:00
|
|
|
Set<String> set = k.a;
|
|
|
|
kVar.n(lVar);
|
|
|
|
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 */ c this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public b(c cVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = cVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
k.m(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b.a.q.m0.c.k$c$c reason: collision with other inner class name */
|
|
|
|
public static final class C0036c extends o implements Function0<Unit> {
|
2021-07-24 02:37:17 +00:00
|
|
|
public final /* synthetic */ MediaEngineConnection $connection;
|
|
|
|
public final /* synthetic */ c this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-17 21:59:34 +00:00
|
|
|
public C0036c(c cVar, MediaEngineConnection mediaEngineConnection) {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(0);
|
|
|
|
this.this$0 = cVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
k.m(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class d extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ MediaEngineConnection $connection;
|
|
|
|
public final /* synthetic */ c this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public d(c cVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = cVar;
|
|
|
|
this.$connection = mediaEngineConnection;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-07-24 02:37:17 +00:00
|
|
|
k.m(this.this$0.a, this.$connection);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public c(k kVar) {
|
|
|
|
this.a = kVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.a, com.discord.rtcconnection.mediaengine.MediaEngineConnection.d
|
2021-12-17 21:59:34 +00:00
|
|
|
public void onConnected(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.TransportInfo transportInfo, List<b.a.q.m0.a> list) {
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(transportInfo, "transportInfo");
|
|
|
|
m.checkNotNullParameter(list, "supportedVideoCodecs");
|
|
|
|
this.a.o(new a(this));
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.a, com.discord.rtcconnection.mediaengine.MediaEngineConnection.d
|
|
|
|
public void onConnectionStateChange(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.ConnectionState connectionState) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(connectionState, "connectionState");
|
|
|
|
if (connectionState == MediaEngineConnection.ConnectionState.DISCONNECTED) {
|
|
|
|
this.a.o(new b(this, mediaEngineConnection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.a, com.discord.rtcconnection.mediaengine.MediaEngineConnection.d
|
|
|
|
public void onDestroy(MediaEngineConnection mediaEngineConnection) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
2021-12-17 21:59:34 +00:00
|
|
|
this.a.o(new C0036c(this, mediaEngineConnection));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngineConnection.a, com.discord.rtcconnection.mediaengine.MediaEngineConnection.d
|
|
|
|
public void onError(MediaEngineConnection mediaEngineConnection, MediaEngineConnection.FailedConnectionException failedConnectionException) {
|
|
|
|
m.checkNotNullParameter(mediaEngineConnection, "connection");
|
|
|
|
m.checkNotNullParameter(failedConnectionException, "exception");
|
|
|
|
this.a.o(new d(this, mediaEngineConnection));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class d<T> implements Action1<Emitter<MediaEngine.AudioInfo>> {
|
2021-12-02 18:53:44 +00:00
|
|
|
public final /* synthetic */ k j;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public d(k kVar) {
|
2021-12-02 18:53:44 +00:00
|
|
|
this.j = kVar;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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;
|
2021-12-02 18:53:44 +00:00
|
|
|
Discord discord = this.j.f;
|
2021-07-24 02:37:17 +00:00
|
|
|
if (discord != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
discord.getAudioSubsystem(new o(emitter2));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final class e<T> implements Action1<List<? extends b.a.q.m0.a>> {
|
2021-12-02 18:53:44 +00:00
|
|
|
public final /* synthetic */ k j;
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
public e(k kVar) {
|
2021-12-02 18:53:44 +00:00
|
|
|
this.j = kVar;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
2021-12-17 21:59:34 +00:00
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r3v0, resolved type: java.util.List<? extends b.a.q.m0.a> */
|
2021-07-24 02:37:17 +00:00
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
@Override // rx.functions.Action1
|
2021-12-17 21:59:34 +00:00
|
|
|
public void call(List<? extends b.a.q.m0.a> list) {
|
|
|
|
List<? extends b.a.q.m0.a> list2 = list;
|
2021-12-02 18:53:44 +00:00
|
|
|
k kVar = this.j;
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullExpressionValue(list2, "codecs");
|
|
|
|
kVar.g = list2;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
public static final class f<T, R> implements j0.k.b<List<? extends b.a.q.m0.a>, Unit> {
|
2021-12-02 18:53:44 +00:00
|
|
|
public static final f j = new f();
|
2021-07-24 02:37:17 +00:00
|
|
|
|
|
|
|
/* 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] */
|
2021-11-02 06:38:17 +00:00
|
|
|
@Override // j0.k.b
|
2021-12-17 21:59:34 +00:00
|
|
|
public Unit call(List<? extends b.a.q.m0.a> list) {
|
2021-07-24 02:37:17 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class g implements Discord.LocalVoiceLevelChangedCallback {
|
|
|
|
public final /* synthetic */ Function1 a;
|
|
|
|
|
|
|
|
public g(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 */
|
2021-09-07 06:52:02 +00:00
|
|
|
public static final class h implements Discord.BuiltinAECCallback {
|
2021-12-17 21:59:34 +00:00
|
|
|
public final /* synthetic */ b.a.q.k0.g a;
|
|
|
|
|
|
|
|
/* renamed from: b reason: collision with root package name */
|
|
|
|
public final /* synthetic */ k f267b;
|
2021-09-07 06:52:02 +00:00
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class a extends o implements Function0<Unit> {
|
|
|
|
public final /* synthetic */ boolean $available;
|
|
|
|
public final /* synthetic */ boolean $enabled;
|
|
|
|
public final /* synthetic */ boolean $requestEnabled;
|
|
|
|
public final /* synthetic */ h this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
|
|
public a(h hVar, boolean z2, boolean z3, boolean z4) {
|
|
|
|
super(0);
|
|
|
|
this.this$0 = hVar;
|
|
|
|
this.$enabled = z2;
|
|
|
|
this.$requestEnabled = z3;
|
|
|
|
this.$available = z4;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-09-07 06:52:02 +00:00
|
|
|
this.this$0.a.d = this.$enabled;
|
2021-12-17 21:59:34 +00:00
|
|
|
k kVar = this.this$0.f267b;
|
2021-09-07 06:52:02 +00:00
|
|
|
boolean z2 = this.$requestEnabled;
|
|
|
|
boolean z3 = this.$available;
|
|
|
|
Objects.requireNonNull(kVar.o);
|
|
|
|
kVar.i = new MediaEngine.EchoCancellationInfo(z2, z3, WebRtcAudioUtils.isAcousticEchoCancelerSupported(), this.$enabled, false, false, false, false, false, 496);
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public h(b.a.q.k0.g gVar, Discord discord, k kVar) {
|
2021-09-07 06:52:02 +00:00
|
|
|
this.a = gVar;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f267b = kVar;
|
2021-09-07 06:52:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.hammerandchisel.libdiscord.Discord.BuiltinAECCallback
|
|
|
|
public final void onConfigureBuiltinAEC(boolean z2, boolean z3, boolean z4) {
|
2021-12-17 21:59:34 +00:00
|
|
|
this.f267b.o(new a(this, z4, z2, z3));
|
2021-09-07 06:52:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
|
|
|
public static final class i implements Logging.ExternalReporter {
|
2021-07-24 02:37:17 +00:00
|
|
|
public final /* synthetic */ k a;
|
|
|
|
|
2021-09-07 06:52:02 +00:00
|
|
|
public i(k kVar) {
|
2021-07-24 02:37:17 +00:00
|
|
|
this.a = kVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // org.webrtc.Logging.ExternalReporter
|
|
|
|
public final void e(String str, String str2, Throwable th) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger logger = this.a.n;
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullExpressionValue(str, "tag");
|
|
|
|
m.checkNotNullExpressionValue(str2, "message");
|
|
|
|
Logger.e$default(logger, str, str2, th, null, 8, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-11-02 06:38:17 +00:00
|
|
|
public static final /* synthetic */ class j extends d0.z.d.k implements Function1<MediaEngine.c, Unit> {
|
2021-12-02 18:53:44 +00:00
|
|
|
public static final j j = new j();
|
2021-07-24 02:37:17 +00:00
|
|
|
|
2021-09-07 06:52:02 +00:00
|
|
|
public j() {
|
|
|
|
super(1, MediaEngine.c.class, "onNativeEngineInitialized", "onNativeEngineInitialized()V", 0);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 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
|
2021-09-07 06:52:02 +00:00
|
|
|
public Unit invoke(MediaEngine.c cVar) {
|
|
|
|
MediaEngine.c cVar2 = cVar;
|
|
|
|
m.checkNotNullParameter(cVar2, "p1");
|
|
|
|
cVar2.onNativeEngineInitialized();
|
2021-07-24 02:37:17 +00:00
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* compiled from: MediaEngineLegacy.kt */
|
2021-12-17 21:59:34 +00:00
|
|
|
/* renamed from: b.a.q.m0.c.k$k reason: collision with other inner class name */
|
|
|
|
public static final class C0037k extends o implements Function0<Unit> {
|
2021-07-24 02:37:17 +00:00
|
|
|
public final /* synthetic */ MediaEngine.VoiceConfig $voiceConfig;
|
|
|
|
public final /* synthetic */ k this$0;
|
|
|
|
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
2021-12-17 21:59:34 +00:00
|
|
|
public C0037k(k kVar, MediaEngine.VoiceConfig voiceConfig) {
|
2021-07-24 02:37:17 +00:00
|
|
|
super(0);
|
|
|
|
this.this$0 = kVar;
|
|
|
|
this.$voiceConfig = voiceConfig;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
|
|
@Override // kotlin.jvm.functions.Function0
|
|
|
|
/* renamed from: invoke */
|
2021-11-02 06:38:17 +00:00
|
|
|
public Unit mo1invoke() {
|
2021-08-17 07:10:14 +00:00
|
|
|
boolean z2;
|
2021-12-17 21:59:34 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("updateVoiceConfig: ");
|
2021-11-05 06:48:17 +00:00
|
|
|
R.append(this.$voiceConfig);
|
2021-12-17 21:59:34 +00:00
|
|
|
b.c.a.a0.d.a1("MediaEngineLegacy", R.toString());
|
2021-07-24 02:37:17 +00:00
|
|
|
MediaEngine.VoiceConfig voiceConfig = this.$voiceConfig;
|
|
|
|
k kVar = this.this$0;
|
|
|
|
float f = voiceConfig.a;
|
|
|
|
Discord discord = kVar.f;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setSpeakerVolume(Math.min(300.0f, Math.max(0.0f, f)) / 100.0f);
|
|
|
|
}
|
|
|
|
k kVar2 = this.this$0;
|
2021-12-20 07:27:17 +00:00
|
|
|
boolean z3 = voiceConfig.f2754b;
|
2021-09-07 06:52:02 +00:00
|
|
|
kVar2.l.a();
|
2021-12-17 21:59:34 +00:00
|
|
|
b.a.q.k0.g gVar = kVar2.o;
|
2021-08-17 07:10:14 +00:00
|
|
|
if (gVar.g && gVar.d) {
|
|
|
|
z2 = false;
|
|
|
|
} else {
|
2021-12-17 21:59:34 +00:00
|
|
|
b.a.q.k0.g gVar2 = kVar2.o;
|
2021-08-17 07:10:14 +00:00
|
|
|
z2 = gVar2.f && !gVar2.d ? true : z3;
|
|
|
|
}
|
|
|
|
if (z2 != z3) {
|
2021-12-17 21:59:34 +00:00
|
|
|
b.c.a.a0.d.a1("MediaEngineLegacy", "ignoring call to setEchoCancellation(" + z3 + "), config=" + kVar2.o);
|
2021-08-17 07:10:14 +00:00
|
|
|
}
|
2021-07-24 02:37:17 +00:00
|
|
|
Discord discord2 = kVar2.f;
|
|
|
|
if (discord2 != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
discord2.setEchoCancellation(z2, false, new m(kVar2));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
k kVar3 = this.this$0;
|
2021-12-17 21:59:34 +00:00
|
|
|
boolean z4 = voiceConfig.c;
|
2021-07-24 02:37:17 +00:00
|
|
|
Discord discord3 = kVar3.f;
|
|
|
|
if (discord3 != null) {
|
2021-08-17 07:10:14 +00:00
|
|
|
discord3.setNoiseSuppression(z4);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
k kVar4 = this.this$0;
|
2021-08-17 07:10:14 +00:00
|
|
|
boolean z5 = voiceConfig.d;
|
2021-12-17 21:59:34 +00:00
|
|
|
kVar4.c.a = z5;
|
2021-07-24 02:37:17 +00:00
|
|
|
Discord discord4 = kVar4.f;
|
|
|
|
if (discord4 != null) {
|
2021-08-17 07:10:14 +00:00
|
|
|
discord4.setNoiseCancellation(z5);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
k kVar5 = this.this$0;
|
2021-08-17 07:10:14 +00:00
|
|
|
boolean z6 = voiceConfig.e;
|
2021-07-24 02:37:17 +00:00
|
|
|
Discord discord5 = kVar5.f;
|
|
|
|
if (discord5 != null) {
|
2021-08-17 07:10:14 +00:00
|
|
|
discord5.setAutomaticGainControl(z6);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
for (MediaEngineConnection mediaEngineConnection : this.this$0.getConnections()) {
|
|
|
|
mediaEngineConnection.k(voiceConfig.f, voiceConfig.g);
|
|
|
|
mediaEngineConnection.v(voiceConfig.h);
|
|
|
|
mediaEngineConnection.c(voiceConfig.i || mediaEngineConnection.getType() == MediaEngineConnection.Type.STREAM);
|
|
|
|
}
|
|
|
|
return Unit.a;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-17 21:59:34 +00:00
|
|
|
public k(Context context, MediaEngine.c cVar, b.a.q.c cVar2, MediaEngine.OpenSLESConfig openSLESConfig, Logger logger, b.a.q.k0.g gVar, MediaEngine.b bVar, Set set, Set set2, int i2) {
|
2021-07-24 02:37:17 +00:00
|
|
|
Set<String> set3 = null;
|
2021-09-07 06:52:02 +00:00
|
|
|
Set<String> set4 = (i2 & 128) != 0 ? a : null;
|
2021-12-17 21:59:34 +00:00
|
|
|
set3 = (i2 & 256) != 0 ? f266b : set3;
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullParameter(context, "context");
|
2021-09-07 06:52:02 +00:00
|
|
|
m.checkNotNullParameter(cVar, "listener");
|
|
|
|
m.checkNotNullParameter(cVar2, "mediaEngineThreadExecutor");
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullParameter(openSLESConfig, "openSLESConfig");
|
|
|
|
m.checkNotNullParameter(logger, "logger");
|
2021-08-17 07:10:14 +00:00
|
|
|
m.checkNotNullParameter(gVar, "echoCancellation");
|
2021-09-07 06:52:02 +00:00
|
|
|
m.checkNotNullParameter(bVar, "echoCancellationCallback");
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullParameter(set4, "defaultOpenSLAllowList");
|
|
|
|
m.checkNotNullParameter(set3, "defaultOpenSLExcludeList");
|
2021-09-07 06:52:02 +00:00
|
|
|
this.j = context;
|
2021-07-24 02:37:17 +00:00
|
|
|
this.k = cVar;
|
2021-09-07 06:52:02 +00:00
|
|
|
this.l = cVar2;
|
|
|
|
this.m = openSLESConfig;
|
|
|
|
this.n = logger;
|
|
|
|
this.o = gVar;
|
|
|
|
this.p = bVar;
|
|
|
|
this.q = set4;
|
2021-11-02 06:38:17 +00:00
|
|
|
this.r = set3;
|
2021-12-17 21:59:34 +00:00
|
|
|
this.c = new u();
|
2021-07-24 02:37:17 +00:00
|
|
|
this.d = new ArrayList();
|
|
|
|
this.e = true;
|
|
|
|
this.h = MediaEngine.OpenSLUsageMode.ALLOW_LIST;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final void m(k kVar, MediaEngineConnection mediaEngineConnection) {
|
|
|
|
synchronized (kVar) {
|
|
|
|
Discord discord = kVar.f;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setLocalVoiceLevelChangedCallback(null);
|
|
|
|
}
|
|
|
|
kVar.d.remove(mediaEngineConnection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Observable<Unit> a() {
|
|
|
|
if (this.g != null) {
|
2021-12-02 18:53:44 +00:00
|
|
|
j0.l.e.k kVar = new j0.l.e.k(Unit.a);
|
|
|
|
m.checkNotNullExpressionValue(kVar, "Observable.just(Unit)");
|
|
|
|
return kVar;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
p();
|
|
|
|
if (this.f == null) {
|
2021-11-02 06:38:17 +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-07-24 02:37:17 +00:00
|
|
|
}
|
2021-09-07 06:52:02 +00:00
|
|
|
Observable n = Observable.n(new q(this), Emitter.BackpressureMode.NONE);
|
2021-07-24 02:37:17 +00:00
|
|
|
m.checkNotNullExpressionValue(n, "Observable.create({ emit…er.BackpressureMode.NONE)");
|
2021-12-02 18:53:44 +00:00
|
|
|
Observable<Unit> F = n.t(new e(this)).F(f.j);
|
2021-10-22 06:43:45 +00:00
|
|
|
m.checkNotNullExpressionValue(F, "getSupportedVideoCodecs(…s }\n .map { Unit }");
|
|
|
|
return F;
|
2021-07-24 02:37:17 +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");
|
|
|
|
p();
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
discord.getRankedRtcRegions(rtcRegionArr, new r(function1));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
2021-12-17 21:59:34 +00:00
|
|
|
public b.a.q.c c() {
|
2021-09-07 06:52:02 +00:00
|
|
|
return this.l;
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
@AnyThread
|
|
|
|
public void d(MediaEngine.VoiceConfig voiceConfig) {
|
|
|
|
m.checkNotNullParameter(voiceConfig, "voiceConfig");
|
2021-12-17 21:59:34 +00:00
|
|
|
o(new C0037k(this, voiceConfig));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Observable<MediaEngine.AudioInfo> e() {
|
|
|
|
Observable<MediaEngine.AudioInfo> n = Observable.n(new d(this), Emitter.BackpressureMode.LATEST);
|
|
|
|
m.checkNotNullExpressionValue(n, "Observable.create({ emit….BackpressureMode.LATEST)");
|
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void f(int i2) {
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setVideoInputDevice(i2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public synchronized MediaEngineConnection g(long j2, MediaEngine.a aVar, MediaEngineConnection.Type type, Function1<? super Exception, Unit> function1) {
|
|
|
|
m.checkNotNullParameter(aVar, "options");
|
|
|
|
m.checkNotNullParameter(type, "type");
|
|
|
|
m.checkNotNullParameter(function1, "onFailure");
|
|
|
|
if (!(this.g != null)) {
|
2021-08-03 07:33:18 +00:00
|
|
|
((e0) function1).invoke(new IllegalStateException("connect() called on unprepared media engine."));
|
2021-07-24 02:37:17 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord == null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "connect() called without voiceEngineLegacy.", null, null, 12, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
return null;
|
|
|
|
}
|
|
|
|
o(new a(this));
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger logger = this.n;
|
2021-07-24 02:37:17 +00:00
|
|
|
Logger.i$default(logger, "MediaEngineLegacy", "Connecting with options: " + aVar, null, 4, null);
|
|
|
|
c cVar = new c(this);
|
2021-12-17 21:59:34 +00:00
|
|
|
b.a.q.c cVar2 = this.l;
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger logger2 = this.n;
|
2021-12-17 21:59:34 +00:00
|
|
|
u uVar = this.c;
|
|
|
|
List<b.a.q.m0.a> list = this.g;
|
2021-07-24 02:37:17 +00:00
|
|
|
if (list == null) {
|
|
|
|
m.throwUninitializedPropertyAccessException("supportedVideoCodecs");
|
|
|
|
}
|
2021-11-02 06:38:17 +00:00
|
|
|
e eVar = new e(cVar2, logger2, uVar, discord, list, type, j2, aVar, d0.t.m.listOf(cVar));
|
2021-07-24 02:37:17 +00:00
|
|
|
this.d.add(eVar);
|
|
|
|
n(new b(eVar));
|
|
|
|
return eVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public synchronized List<MediaEngineConnection> getConnections() {
|
|
|
|
return u.toList(this.d);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void h(MediaEngine.OpenSLUsageMode openSLUsageMode) {
|
|
|
|
m.checkNotNullParameter(openSLUsageMode, "openSLUsageMode");
|
|
|
|
if (this.f != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "setting openSLUsageMode too late", null, null, 12, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
this.h = openSLUsageMode;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public Discord i() {
|
|
|
|
return this.f;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void j(Function1<? super VideoInputDeviceDescription[], Unit> function1) {
|
|
|
|
m.checkNotNullParameter(function1, "devicesCallback");
|
|
|
|
p();
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
discord.getVideoInputDevices(new s(function1));
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void k(boolean z2) {
|
|
|
|
this.e = z2;
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setAudioInputEnabled(z2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override // com.discord.rtcconnection.mediaengine.MediaEngine
|
|
|
|
public void l(Function1<? super MediaEngine.LocalVoiceStatus, Unit> function1) {
|
|
|
|
if (function1 != null) {
|
|
|
|
p();
|
|
|
|
Discord discord = this.f;
|
|
|
|
if (discord != null) {
|
|
|
|
discord.setLocalVoiceLevelChangedCallback(new g(function1));
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Discord discord2 = this.f;
|
|
|
|
if (discord2 != null) {
|
|
|
|
discord2.setLocalVoiceLevelChangedCallback(null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-09-07 06:52:02 +00:00
|
|
|
public final void n(Function1<? super MediaEngine.c, Unit> function1) {
|
2021-07-24 02:37:17 +00:00
|
|
|
try {
|
2021-09-07 06:52:02 +00:00
|
|
|
function1.invoke(this.k);
|
2021-07-24 02:37:17 +00:00
|
|
|
} catch (Exception e2) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "Error in listener", e2, null, 8, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
|
|
/* JADX WARNING: Unknown variable types count: 1 */
|
|
|
|
public final Future<?> o(Function0<Unit> function0) {
|
2021-12-17 21:59:34 +00:00
|
|
|
b.a.q.c cVar = this.l;
|
2021-07-24 02:37:17 +00:00
|
|
|
if (function0 != null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
function0 = new t(function0);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
return cVar.submit((Runnable) function0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void p() {
|
|
|
|
if (this.f == null) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger logger = this.n;
|
2021-12-17 21:59:34 +00:00
|
|
|
StringBuilder R = b.d.b.a.a.R("initializing voice engine. OpenSL ES: ");
|
2021-11-05 06:48:17 +00:00
|
|
|
R.append(this.m);
|
|
|
|
R.append(", OpenSL usage mode: ");
|
|
|
|
R.append(this.h);
|
|
|
|
Logger.i$default(logger, "MediaEngineLegacy", R.toString(), null, 4, null);
|
2021-09-07 06:52:02 +00:00
|
|
|
int ordinal = this.m.ordinal();
|
2021-07-24 02:37:17 +00:00
|
|
|
boolean z2 = false;
|
|
|
|
if (ordinal == 0) {
|
|
|
|
if (this.h == MediaEngine.OpenSLUsageMode.ALLOW_LIST) {
|
2021-09-07 06:52:02 +00:00
|
|
|
z2 = this.q.contains(Build.MODEL);
|
2021-11-02 06:38:17 +00:00
|
|
|
} else if (!this.r.contains(Build.MODEL)) {
|
2021-07-24 02:37:17 +00:00
|
|
|
z2 = true;
|
|
|
|
}
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger logger2 = this.n;
|
2021-12-17 21:59:34 +00:00
|
|
|
StringBuilder R2 = b.d.b.a.a.R("OpenSL ES default. mode: ");
|
2021-11-05 06:48:17 +00:00
|
|
|
R2.append(this.h);
|
|
|
|
R2.append(", enableOpenSL: ");
|
|
|
|
R2.append(z2);
|
|
|
|
R2.append(", model: '");
|
2021-12-17 21:59:34 +00:00
|
|
|
Logger.i$default(logger2, "MediaEngineLegacy", b.d.b.a.a.G(R2, Build.MODEL, '\''), null, 4, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(!z2);
|
|
|
|
} else if (ordinal == 1) {
|
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(false);
|
|
|
|
} else if (ordinal == 2) {
|
|
|
|
WebRtcAudioManager.setBlacklistDeviceForOpenSLESUsage(true);
|
|
|
|
}
|
2021-09-07 06:52:02 +00:00
|
|
|
Logging.externalReporter = new i(this);
|
2021-07-24 02:37:17 +00:00
|
|
|
try {
|
2021-09-07 06:52:02 +00:00
|
|
|
Discord discord = new Discord(this.j, 2);
|
2021-12-17 21:59:34 +00:00
|
|
|
b.a.q.k0.g gVar = this.o;
|
2021-08-17 07:10:14 +00:00
|
|
|
if (gVar.e) {
|
2021-09-07 06:52:02 +00:00
|
|
|
discord.enableBuiltInAEC(true, new h(gVar, discord, this));
|
2021-08-17 07:10:14 +00:00
|
|
|
}
|
2021-07-24 02:37:17 +00:00
|
|
|
discord.setAudioInputEnabled(this.e);
|
|
|
|
this.f = discord;
|
|
|
|
} catch (ExceptionInInitializerError e2) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "Unable to initialize voice engine.", e2, null, 8, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
} catch (UnsatisfiedLinkError e3) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "Unable to initialize voice engine.", e3, null, 8, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
} catch (Throwable th) {
|
2021-09-07 06:52:02 +00:00
|
|
|
Logger.e$default(this.n, "MediaEngineLegacy", "Unable to initialize voice engine, new error discovered", th, null, 8, null);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
if (this.f != null) {
|
2021-12-02 18:53:44 +00:00
|
|
|
n(j.j);
|
2021-07-24 02:37:17 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|