114 lines
5.9 KiB
Java
114 lines
5.9 KiB
Java
package c.a.r.m0;
|
|
|
|
import c.a.r.m0.e;
|
|
import co.discord.media_engine.InboundRtpVideo;
|
|
import co.discord.media_engine.OutboundRtpAudio;
|
|
import co.discord.media_engine.OutboundRtpVideo;
|
|
import co.discord.media_engine.ReceiverReport;
|
|
import co.discord.media_engine.Stats;
|
|
import co.discord.media_engine.Transport;
|
|
import com.discord.rtcconnection.KrispOveruseDetector;
|
|
import com.discord.rtcconnection.mediaengine.MediaEngineConnection;
|
|
import d0.z.d.k;
|
|
import d0.z.d.m;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import kotlin.Pair;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: RtcStatsCollector.kt */
|
|
public final /* synthetic */ class a extends k implements Function1<Stats, Unit> {
|
|
public a(d dVar) {
|
|
super(1, dVar, d.class, "onStatsReceived", "onStatsReceived(Lco/discord/media_engine/Stats;)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(Stats stats) {
|
|
OutboundRtpVideo outboundRtpVideo;
|
|
ReceiverReport[] receiverReports;
|
|
Stats stats2 = stats;
|
|
m.checkNotNullParameter(stats2, "p1");
|
|
d dVar = (d) this.receiver;
|
|
dVar.a.add(stats2);
|
|
if (dVar.a.size() > dVar.i) {
|
|
dVar.a.removeFirst();
|
|
}
|
|
dVar.f.update(stats2);
|
|
e eVar = dVar.g;
|
|
Objects.requireNonNull(eVar);
|
|
m.checkNotNullParameter(stats2, "stats");
|
|
long currentTimeMillis = eVar.l.currentTimeMillis();
|
|
Transport transport = stats2.getTransport();
|
|
Integer valueOf = Integer.valueOf((transport == null || (receiverReports = transport.getReceiverReports()) == null) ? 0 : receiverReports.length);
|
|
if (valueOf != null) {
|
|
eVar.g.b(valueOf.intValue() == 0, currentTimeMillis);
|
|
}
|
|
boolean z2 = eVar.f.a() || eVar.g.a();
|
|
if (z2 != eVar.h.a()) {
|
|
eVar.h.b(z2, currentTimeMillis);
|
|
eVar.i.a.clear();
|
|
}
|
|
if (!eVar.h.a() && (outboundRtpVideo = stats2.getOutboundRtpVideo()) != null) {
|
|
eVar.a(eVar.i, new e.C0040e((long) outboundRtpVideo.getResolution().getHeight(), currentTimeMillis, new e.a((long) outboundRtpVideo.getFramesEncoded(), (long) outboundRtpVideo.getFramesSent(), (long) outboundRtpVideo.getPacketsSent(), (long) outboundRtpVideo.getPacketsLost(), 0, outboundRtpVideo.getBytesSent(), (long) outboundRtpVideo.getNackCount(), (long) outboundRtpVideo.getPliCount())));
|
|
if (eVar.i.b == null && outboundRtpVideo.getFramesEncoded() > 0) {
|
|
eVar.i.b = Long.valueOf(currentTimeMillis - eVar.e);
|
|
}
|
|
eVar.k = outboundRtpVideo.getBitrateTarget();
|
|
}
|
|
if (!eVar.f.a()) {
|
|
for (Map.Entry<String, InboundRtpVideo> entry : stats2.getInboundRtpVideo().entrySet()) {
|
|
String key = entry.getKey();
|
|
InboundRtpVideo value = entry.getValue();
|
|
Map<String, e.d> map = eVar.j;
|
|
e.d dVar2 = map.get(key);
|
|
if (dVar2 == null) {
|
|
dVar2 = new e.d();
|
|
map.put(key, dVar2);
|
|
}
|
|
e.d dVar3 = dVar2;
|
|
eVar.a(dVar3, new e.C0040e((long) value.getResolution().getHeight(), currentTimeMillis, new e.a((long) value.getFramesDecoded(), (long) value.getFramesReceived(), (long) value.getPacketsReceived(), (long) value.getPacketsLost(), (long) value.getFramesDropped(), value.getBytesReceived(), (long) value.getNackCount(), (long) value.getPliCount())));
|
|
if (dVar3.b == null && value.getFramesDecoded() > 0) {
|
|
dVar3.b = Long.valueOf(currentTimeMillis - eVar.e);
|
|
}
|
|
}
|
|
}
|
|
KrispOveruseDetector krispOveruseDetector = dVar.h;
|
|
Objects.requireNonNull(krispOveruseDetector);
|
|
m.checkNotNullParameter(stats2, "stats");
|
|
if (krispOveruseDetector.d.getType() == MediaEngineConnection.Type.DEFAULT && krispOveruseDetector.d.b()) {
|
|
OutboundRtpAudio outboundRtpAudio = stats2.getOutboundRtpAudio();
|
|
if (outboundRtpAudio != null && outboundRtpAudio.getNoiseCancellerIsEnabled()) {
|
|
OutboundRtpAudio outboundRtpAudio2 = krispOveruseDetector.b;
|
|
if (outboundRtpAudio2 != null) {
|
|
Pair<Boolean, Long> a = krispOveruseDetector.a(outboundRtpAudio2, stats2.getOutboundRtpAudio(), 8.0d);
|
|
boolean booleanValue = a.component1().booleanValue();
|
|
long longValue = a.component2().longValue();
|
|
if (booleanValue) {
|
|
krispOveruseDetector.d.f(KrispOveruseDetector.Status.CPU_OVERUSE);
|
|
} else if (longValue == 0) {
|
|
int i = krispOveruseDetector.f2077c + 1;
|
|
krispOveruseDetector.f2077c = i;
|
|
if (i > 2) {
|
|
krispOveruseDetector.d.f(KrispOveruseDetector.Status.FAILED);
|
|
}
|
|
} else {
|
|
krispOveruseDetector.f2077c = 0;
|
|
}
|
|
}
|
|
krispOveruseDetector.b = stats2.getOutboundRtpAudio();
|
|
}
|
|
OutboundRtpAudio outboundRtpAudio3 = stats2.getOutboundRtpAudio();
|
|
if (outboundRtpAudio3 != null && outboundRtpAudio3.getVoiceActivityDetectorIsEnabled()) {
|
|
OutboundRtpAudio outboundRtpAudio4 = krispOveruseDetector.a;
|
|
if (outboundRtpAudio4 != null && krispOveruseDetector.a(outboundRtpAudio4, stats2.getOutboundRtpAudio(), 4.0d).component1().booleanValue()) {
|
|
krispOveruseDetector.d.f(KrispOveruseDetector.Status.VAD_CPU_OVERUSE);
|
|
}
|
|
krispOveruseDetector.a = stats2.getOutboundRtpAudio();
|
|
}
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|