142 lines
6.1 KiB
Java
142 lines
6.1 KiB
Java
package com.discord.views.calls;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Point;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import androidx.annotation.MainThread;
|
|
import c.a.y.i0.a;
|
|
import c.a.y.i0.b;
|
|
import c.a.y.i0.c;
|
|
import c.a.y.i0.d;
|
|
import c.a.y.i0.e;
|
|
import co.discord.media_engine.VideoStreamRenderer;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$1;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt$filterNull$2;
|
|
import d0.z.d.e0;
|
|
import d0.z.d.m;
|
|
import java.util.HashMap;
|
|
import java.util.Objects;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import org.webrtc.RendererCommon;
|
|
import rx.Observable;
|
|
import rx.Subscription;
|
|
import rx.subjects.BehaviorSubject;
|
|
/* compiled from: AppVideoStreamRenderer.kt */
|
|
public final class AppVideoStreamRenderer extends VideoStreamRenderer {
|
|
public boolean i;
|
|
public final BehaviorSubject<Unit> j = BehaviorSubject.l0(Unit.a);
|
|
public Subscription k;
|
|
public Integer l;
|
|
public BehaviorSubject<Point> m = BehaviorSubject.l0(null);
|
|
public Function1<? super Point, Unit> n;
|
|
public RendererCommon.ScalingType o;
|
|
public RendererCommon.ScalingType p;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AppVideoStreamRenderer(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
RendererCommon.ScalingType scalingType = RendererCommon.ScalingType.SCALE_ASPECT_BALANCED;
|
|
this.o = scalingType;
|
|
this.p = scalingType;
|
|
}
|
|
|
|
@MainThread
|
|
public final void b() {
|
|
Subscription subscription = this.k;
|
|
if (subscription != null) {
|
|
subscription.unsubscribe();
|
|
}
|
|
HashMap<Integer, VideoStreamRenderer> hashMap = d.a;
|
|
Integer num = this.l;
|
|
Objects.requireNonNull(hashMap, "null cannot be cast to non-null type kotlin.collections.MutableMap<K, V>");
|
|
e0.asMutableMap(hashMap).remove(num);
|
|
this.m.onNext(null);
|
|
hashMap.isEmpty();
|
|
VideoStreamRenderer.attachToStream$default(this, StoreStream.Companion.getMediaEngine().getVoiceEngineNative(), null, null, 4, null);
|
|
}
|
|
|
|
@MainThread
|
|
public final void c(Integer num, RendererCommon.ScalingType scalingType, RendererCommon.ScalingType scalingType2, boolean z2) {
|
|
if (num != null) {
|
|
boolean z3 = !m.areEqual(num, this.l);
|
|
if (z3) {
|
|
b();
|
|
}
|
|
if (z3) {
|
|
int intValue = num.intValue();
|
|
HashMap<Integer, VideoStreamRenderer> hashMap = d.a;
|
|
VideoStreamRenderer videoStreamRenderer = hashMap.get(Integer.valueOf(intValue));
|
|
if (!(videoStreamRenderer == null || videoStreamRenderer == this)) {
|
|
VideoStreamRenderer.attachToStream$default(videoStreamRenderer, StoreStream.Companion.getMediaEngine().getVoiceEngineNative(), null, null, 4, null);
|
|
hashMap.remove(Integer.valueOf(intValue));
|
|
hashMap.isEmpty();
|
|
}
|
|
hashMap.put(Integer.valueOf(intValue), this);
|
|
e eVar = new e();
|
|
Subscription subscription = this.k;
|
|
if (subscription != null) {
|
|
subscription.unsubscribe();
|
|
}
|
|
Observable<R> z4 = this.j.z(new a(eVar));
|
|
m.checkNotNullExpressionValue(z4, "onSizeChangedSubject\n …rameResolutionSampled() }");
|
|
Observable F = z4.x(ObservableExtensionsKt$filterNull$1.INSTANCE).F(ObservableExtensionsKt$filterNull$2.INSTANCE);
|
|
m.checkNotNullExpressionValue(F, "filter { it != null }.map { it!! }");
|
|
Observable ui = ObservableExtensionsKt.ui(F);
|
|
b bVar = new b(this);
|
|
String simpleName = AppVideoStreamRenderer.class.getSimpleName();
|
|
m.checkNotNullExpressionValue(simpleName, "javaClass.simpleName");
|
|
ObservableExtensionsKt.appSubscribe$default(ui, (Context) null, simpleName, new c(this), bVar, (Function1) null, (Function0) null, (Function0) null, 113, (Object) null);
|
|
StringBuilder K = c.d.b.a.a.K("binding native renderer ");
|
|
K.append(hashCode());
|
|
K.append(" to stream id: ");
|
|
K.append(intValue);
|
|
Log.d("AppVideoStreamRenderer", K.toString());
|
|
attachToStream(StoreStream.Companion.getMediaEngine().getVoiceEngineNative(), String.valueOf(intValue), eVar);
|
|
this.l = num;
|
|
}
|
|
RendererCommon.ScalingType scalingType3 = scalingType != null ? scalingType : this.o;
|
|
RendererCommon.ScalingType scalingType4 = scalingType2 != null ? scalingType2 : this.p;
|
|
setMirror(z2);
|
|
setZOrderMediaOverlay(this.i);
|
|
if (scalingType3 != this.o || scalingType4 != this.p) {
|
|
setScalingType(scalingType3, scalingType4);
|
|
this.o = scalingType3;
|
|
this.p = scalingType4;
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
b();
|
|
this.l = null;
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super android.graphics.Point, kotlin.Unit>, kotlin.jvm.functions.Function1<android.graphics.Point, kotlin.Unit> */
|
|
public final Function1<Point, Unit> getOnFrameRenderedListener() {
|
|
return this.n;
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void onSizeChanged(int i, int i2, int i3, int i4) {
|
|
super.onSizeChanged(i, i2, i3, i4);
|
|
this.j.onNext(Unit.a);
|
|
}
|
|
|
|
public final void setIsOverlay(boolean z2) {
|
|
this.i = z2;
|
|
}
|
|
|
|
public final void setMatchVideoOrientation(boolean z2) {
|
|
}
|
|
|
|
public final void setOnFrameRenderedListener(Function1<? super Point, Unit> function1) {
|
|
this.n = function1;
|
|
}
|
|
}
|