373 lines
16 KiB
Java
373 lines
16 KiB
Java
package c.a.r.m0;
|
|
|
|
import com.discord.utilities.time.Clock;
|
|
import com.discord.utilities.time.ClockFactory;
|
|
import d0.o;
|
|
import d0.t.h0;
|
|
import d0.t.n;
|
|
import d0.t.r;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import kotlin.Pair;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: VideoQuality.kt */
|
|
public final class e {
|
|
public static final List<Integer> a = n.listOf((Object[]) new Integer[]{0, 500000, 1000000, 1500000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000});
|
|
public static final List<Integer> b = n.listOf((Object[]) new Integer[]{0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60});
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public static final List<Integer> f218c = n.listOf((Object[]) new Integer[]{720, 480, 360});
|
|
public static final b d = new b(null);
|
|
public final long e;
|
|
public final c f;
|
|
public final c g;
|
|
public final c h;
|
|
public final d i;
|
|
public final Map<String, d> j;
|
|
public int k;
|
|
public final Clock l;
|
|
|
|
/* compiled from: VideoQuality.kt */
|
|
public static final class a {
|
|
public long a;
|
|
public long b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public long f219c;
|
|
public long d;
|
|
public long e;
|
|
public long f;
|
|
public long g;
|
|
public long h;
|
|
|
|
public a() {
|
|
this(0, 0, 0, 0, 0, 0, 0, 0, 255);
|
|
}
|
|
|
|
public a(long j, long j2, long j3, long j4, long j5, long j6, long j7, long j8) {
|
|
this.a = j;
|
|
this.b = j2;
|
|
this.f219c = j3;
|
|
this.d = j4;
|
|
this.e = j5;
|
|
this.f = j6;
|
|
this.g = j7;
|
|
this.h = j8;
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ a(long j, long j2, long j3, long j4, long j5, long j6, long j7, long j8, int i) {
|
|
this((i & 1) != 0 ? 0 : j, (i & 2) != 0 ? 0 : j2, (i & 4) != 0 ? 0 : j3, (i & 8) != 0 ? 0 : j4, (i & 16) != 0 ? 0 : j5, (i & 32) != 0 ? 0 : j6, (i & 64) != 0 ? 0 : j7, (i & 128) == 0 ? j8 : 0);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof a)) {
|
|
return false;
|
|
}
|
|
a aVar = (a) obj;
|
|
return this.a == aVar.a && this.b == aVar.b && this.f219c == aVar.f219c && this.d == aVar.d && this.e == aVar.e && this.f == aVar.f && this.g == aVar.g && this.h == aVar.h;
|
|
}
|
|
|
|
public int hashCode() {
|
|
int a = a0.a.a.b.a(this.b);
|
|
int a2 = a0.a.a.b.a(this.f219c);
|
|
int a3 = a0.a.a.b.a(this.d);
|
|
int a4 = a0.a.a.b.a(this.e);
|
|
int a5 = a0.a.a.b.a(this.f);
|
|
int a6 = a0.a.a.b.a(this.g);
|
|
return a0.a.a.b.a(this.h) + ((a6 + ((a5 + ((a4 + ((a3 + ((a2 + ((a + (a0.a.a.b.a(this.a) * 31)) * 31)) * 31)) * 31)) * 31)) * 31)) * 31);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = c.d.b.a.a.L("AggregatedProperties(framesCodec=");
|
|
L.append(this.a);
|
|
L.append(", framesNetwork=");
|
|
L.append(this.b);
|
|
L.append(", packets=");
|
|
L.append(this.f219c);
|
|
L.append(", packetsLost=");
|
|
L.append(this.d);
|
|
L.append(", framesDropped=");
|
|
L.append(this.e);
|
|
L.append(", bytes=");
|
|
L.append(this.f);
|
|
L.append(", nackCount=");
|
|
L.append(this.g);
|
|
L.append(", pliCount=");
|
|
return c.d.b.a.a.A(L, this.h, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: VideoQuality.kt */
|
|
public static final class b {
|
|
public b(DefaultConstructorMarker defaultConstructorMarker) {
|
|
}
|
|
|
|
public static final long a(b bVar, Float f) {
|
|
if (f != null) {
|
|
return d0.a0.a.roundToLong(f.floatValue());
|
|
}
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
/* compiled from: VideoQuality.kt */
|
|
public static final class c {
|
|
public Long a;
|
|
public long b;
|
|
|
|
public c(boolean z2, long j) {
|
|
this.a = z2 ? Long.valueOf(j) : null;
|
|
}
|
|
|
|
public final boolean a() {
|
|
return this.a != null;
|
|
}
|
|
|
|
public final void b(boolean z2, long j) {
|
|
Long l = this.a;
|
|
if (l == null) {
|
|
if (z2) {
|
|
this.a = Long.valueOf(j);
|
|
}
|
|
} else if (l != null) {
|
|
long longValue = l.longValue();
|
|
if (!z2) {
|
|
this.b = (j - longValue) + this.b;
|
|
this.a = null;
|
|
}
|
|
}
|
|
}
|
|
|
|
public final long c(long j) {
|
|
Long l = this.a;
|
|
if (l == null) {
|
|
return this.b;
|
|
}
|
|
return (this.b + j) - l.longValue();
|
|
}
|
|
}
|
|
|
|
/* compiled from: VideoQuality.kt */
|
|
public static final class d {
|
|
public List<C0040e> a = new ArrayList();
|
|
public Long b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public a f220c = new a(0, 0, 0, 0, 0, 0, 0, 0, 255);
|
|
public long d;
|
|
public Map<Integer, Float> e = new LinkedHashMap();
|
|
public Map<Integer, Float> f = new LinkedHashMap();
|
|
public float g;
|
|
public Map<Integer, Float> h = new LinkedHashMap();
|
|
|
|
public d() {
|
|
for (Number number : e.a) {
|
|
this.e.put(Integer.valueOf(number.intValue()), Float.valueOf(0.0f));
|
|
}
|
|
for (Number number2 : e.b) {
|
|
this.f.put(Integer.valueOf(number2.intValue()), Float.valueOf(0.0f));
|
|
}
|
|
for (Number number3 : e.f218c) {
|
|
this.h.put(Integer.valueOf(number3.intValue()), Float.valueOf(0.0f));
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: VideoQuality.kt */
|
|
/* renamed from: c.a.r.m0.e$e reason: collision with other inner class name */
|
|
public static final class C0040e {
|
|
public final long a;
|
|
public final long b;
|
|
|
|
/* renamed from: c reason: collision with root package name */
|
|
public final a f221c;
|
|
|
|
public C0040e() {
|
|
this(0, 0, new a(0, 0, 0, 0, 0, 0, 0, 0, 255));
|
|
}
|
|
|
|
public C0040e(long j, long j2, a aVar) {
|
|
m.checkNotNullParameter(aVar, "aggregatedProperties");
|
|
this.a = j;
|
|
this.b = j2;
|
|
this.f221c = aVar;
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof C0040e)) {
|
|
return false;
|
|
}
|
|
C0040e eVar = (C0040e) obj;
|
|
return this.a == eVar.a && this.b == eVar.b && m.areEqual(this.f221c, eVar.f221c);
|
|
}
|
|
|
|
public int hashCode() {
|
|
int a = (a0.a.a.b.a(this.b) + (a0.a.a.b.a(this.a) * 31)) * 31;
|
|
a aVar = this.f221c;
|
|
return a + (aVar != null ? aVar.hashCode() : 0);
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder L = c.d.b.a.a.L("RawVideoStats(resolution=");
|
|
L.append(this.a);
|
|
L.append(", timestamp=");
|
|
L.append(this.b);
|
|
L.append(", aggregatedProperties=");
|
|
L.append(this.f221c);
|
|
L.append(")");
|
|
return L.toString();
|
|
}
|
|
}
|
|
|
|
public e(Clock clock, int i) {
|
|
Clock clock2 = (i & 1) != 0 ? ClockFactory.get() : null;
|
|
m.checkNotNullParameter(clock2, "clock");
|
|
this.l = clock2;
|
|
long currentTimeMillis = clock2.currentTimeMillis();
|
|
this.e = currentTimeMillis;
|
|
this.f = new c(false, currentTimeMillis);
|
|
this.g = new c(false, currentTimeMillis);
|
|
this.h = new c(false, currentTimeMillis);
|
|
this.i = new d();
|
|
this.j = new LinkedHashMap();
|
|
}
|
|
|
|
public final void a(d dVar, C0040e eVar) {
|
|
dVar.a.add(eVar);
|
|
if (dVar.a.size() >= 2) {
|
|
List<C0040e> list = dVar.a;
|
|
C0040e eVar2 = list.get(list.size() - 1);
|
|
List<C0040e> list2 = dVar.a;
|
|
C0040e eVar3 = list2.get(list2.size() - 2);
|
|
f fVar = f.i;
|
|
dVar.d = (eVar2.b - eVar3.b) + dVar.d;
|
|
a aVar = dVar.f220c;
|
|
a aVar2 = eVar2.f221c;
|
|
a aVar3 = eVar3.f221c;
|
|
aVar.a = fVar.a(aVar2.a, aVar3.a) + aVar.a;
|
|
aVar.b = fVar.a(aVar2.b, aVar3.b) + aVar.b;
|
|
aVar.f219c = fVar.a(aVar2.f219c, aVar3.f219c) + aVar.f219c;
|
|
aVar.d = fVar.a(aVar2.d, aVar3.d) + aVar.d;
|
|
aVar.e = fVar.a(aVar2.e, aVar3.e) + aVar.e;
|
|
aVar.f = fVar.a(aVar2.f, aVar3.f) + aVar.f;
|
|
aVar.g = fVar.a(aVar2.g, aVar3.g) + aVar.g;
|
|
aVar.h = fVar.a(aVar2.h, aVar3.h) + aVar.h;
|
|
a aVar4 = eVar2.f221c;
|
|
long j = aVar4.f;
|
|
long j2 = aVar4.a;
|
|
long j3 = eVar2.b;
|
|
long j4 = eVar2.a;
|
|
float f = ((float) (j3 - eVar3.b)) / 1000.0f;
|
|
dVar.g = (((float) j4) * f) + dVar.g;
|
|
if (dVar.a.size() >= 6) {
|
|
List<C0040e> list3 = dVar.a;
|
|
C0040e eVar4 = list3.get(list3.size() - 3);
|
|
a aVar5 = eVar4.f221c;
|
|
long j5 = aVar5.f;
|
|
long j6 = aVar5.a;
|
|
long j7 = eVar4.b;
|
|
Iterator<T> it = f218c.iterator();
|
|
while (true) {
|
|
float f2 = 0.0f;
|
|
if (!it.hasNext()) {
|
|
break;
|
|
}
|
|
int intValue = ((Number) it.next()).intValue();
|
|
if (j4 <= ((long) intValue)) {
|
|
Map<Integer, Float> map = dVar.h;
|
|
Integer valueOf = Integer.valueOf(intValue);
|
|
Float f3 = dVar.h.get(Integer.valueOf(intValue));
|
|
if (f3 != null) {
|
|
f2 = f3.floatValue();
|
|
}
|
|
map.put(valueOf, Float.valueOf(f2 + f));
|
|
}
|
|
j2 = j2;
|
|
j6 = j6;
|
|
}
|
|
float f4 = ((float) (j3 - j7)) / 1000.0f;
|
|
float f5 = ((float) ((j - j5) * ((long) 8))) / f4;
|
|
float f6 = ((float) (j2 - j6)) / f4;
|
|
for (Number number : a) {
|
|
int intValue2 = number.intValue();
|
|
if (f5 <= ((float) intValue2)) {
|
|
Map<Integer, Float> map2 = dVar.e;
|
|
Integer valueOf2 = Integer.valueOf(intValue2);
|
|
Float f7 = dVar.e.get(Integer.valueOf(intValue2));
|
|
map2.put(valueOf2, Float.valueOf((f7 != null ? f7.floatValue() : 0.0f) + f));
|
|
}
|
|
}
|
|
for (Number number2 : b) {
|
|
int intValue3 = number2.intValue();
|
|
if (f6 <= ((float) intValue3)) {
|
|
Map<Integer, Float> map3 = dVar.f;
|
|
Integer valueOf3 = Integer.valueOf(intValue3);
|
|
Float f8 = dVar.f.get(Integer.valueOf(intValue3));
|
|
map3.put(valueOf3, Float.valueOf((f8 != null ? f8.floatValue() : 0.0f) + f));
|
|
}
|
|
}
|
|
r.removeFirst(dVar.a);
|
|
}
|
|
}
|
|
}
|
|
|
|
public final Map<String, Object> b(String str) {
|
|
m.checkNotNullParameter(str, "userId");
|
|
d dVar = this.j.get(str);
|
|
if (dVar != null) {
|
|
return d(dVar);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public final Map<String, Object> c() {
|
|
return h0.plus(d(this.i), h0.mapOf(o.to("target_bitrate", Integer.valueOf(this.k)), o.to("duration_encoder_nvidia_cuda", 0), o.to("duration_encoder_nvidia_direct3d", 0), o.to("duration_encoder_openh264", 0), o.to("duration_encoder_videotoolbox", 0), o.to("duration_encoder_amd_direct3d", 0), o.to("duration_encoder_intel", 0), o.to("duration_encoder_intel_direct3d", 0), o.to("duration_encoder_unknown", 0)));
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x03d6: APUT
|
|
(r4v4 kotlin.Pair[])
|
|
(6 ??[int, float, short, byte, char])
|
|
(wrap: kotlin.Pair : 0x03d1: INVOKE (r15v3 kotlin.Pair) =
|
|
("time_to_first_frame_ms")
|
|
(wrap: java.lang.Long : 0x03ca: INVOKE (r15v2 java.lang.Long) = (r2v22 long) type: STATIC call: java.lang.Long.valueOf(long):java.lang.Long)
|
|
type: STATIC call: d0.o.to(java.lang.Object, java.lang.Object):kotlin.Pair)
|
|
*/
|
|
public final Map<String, Object> d(d dVar) {
|
|
Float valueOf;
|
|
long currentTimeMillis = this.l.currentTimeMillis();
|
|
float f = ((float) (currentTimeMillis - this.e)) / 1000.0f;
|
|
float f2 = ((float) dVar.d) / 1000.0f;
|
|
int i = (f2 > ((float) 0) ? 1 : (f2 == ((float) 0) ? 0 : -1));
|
|
long roundToLong = (i <= 0 || (valueOf = Float.valueOf(dVar.g / f2)) == null) ? 0 : d0.a0.a.roundToLong(valueOf.floatValue());
|
|
b bVar = d;
|
|
Map mapOf = h0.mapOf(o.to("duration", Double.valueOf(Math.floor((double) f))), c.d.b.a.a.U(bVar, dVar.e.get(8000000), "duration_stream_under_8mbps"), c.d.b.a.a.U(bVar, dVar.e.get(7000000), "duration_stream_under_7mbps"), c.d.b.a.a.U(bVar, dVar.e.get(6000000), "duration_stream_under_6mbps"), c.d.b.a.a.U(bVar, dVar.e.get(5000000), "duration_stream_under_5mbps"), c.d.b.a.a.U(bVar, dVar.e.get(4000000), "duration_stream_under_4mbps"), c.d.b.a.a.U(bVar, dVar.e.get(3000000), "duration_stream_under_3mbps"), c.d.b.a.a.U(bVar, dVar.e.get(2000000), "duration_stream_under_2mbps"), c.d.b.a.a.U(bVar, dVar.e.get(1500000), "duration_stream_under_1_5mbps"), c.d.b.a.a.U(bVar, dVar.e.get(1000000), "duration_stream_under_1mbps"), c.d.b.a.a.U(bVar, dVar.e.get(500000), "duration_stream_under_0_5mbps"), c.d.b.a.a.U(bVar, dVar.e.get(0), "duration_stream_at_0mbps"), c.d.b.a.a.U(bVar, dVar.f.get(60), "duration_fps_under_60"), c.d.b.a.a.U(bVar, dVar.f.get(55), "duration_fps_under_55"), c.d.b.a.a.U(bVar, dVar.f.get(50), "duration_fps_under_50"), c.d.b.a.a.U(bVar, dVar.f.get(45), "duration_fps_under_45"), c.d.b.a.a.U(bVar, dVar.f.get(40), "duration_fps_under_40"), c.d.b.a.a.U(bVar, dVar.f.get(35), "duration_fps_under_35"), c.d.b.a.a.U(bVar, dVar.f.get(30), "duration_fps_under_30"), c.d.b.a.a.U(bVar, dVar.f.get(25), "duration_fps_under_25"), c.d.b.a.a.U(bVar, dVar.f.get(20), "duration_fps_under_20"), c.d.b.a.a.U(bVar, dVar.f.get(15), "duration_fps_under_15"), c.d.b.a.a.U(bVar, dVar.f.get(10), "duration_fps_under_10"), c.d.b.a.a.U(bVar, dVar.f.get(5), "duration_fps_under_5"), c.d.b.a.a.U(bVar, dVar.f.get(0), "duration_fps_at_0"), o.to("avg_resolution", Long.valueOf(roundToLong)), c.d.b.a.a.U(bVar, dVar.h.get(720), "duration_resolution_under_720"), c.d.b.a.a.U(bVar, dVar.h.get(480), "duration_resolution_under_480"), c.d.b.a.a.U(bVar, dVar.h.get(360), "duration_resolution_under_360"), o.to("num_pauses", 0), o.to("duration_paused", Long.valueOf(b.a(bVar, Float.valueOf(((float) this.f.c(currentTimeMillis)) / 1000.0f)))), o.to("duration_zero_receivers", Long.valueOf(b.a(bVar, Float.valueOf(((float) this.g.c(currentTimeMillis)) / 1000.0f)))), o.to("duration_video_stopped", Long.valueOf(b.a(bVar, Float.valueOf(((float) this.h.c(currentTimeMillis)) / 1000.0f)))));
|
|
a aVar = dVar.f220c;
|
|
long a2 = i > 0 ? b.a(bVar, Float.valueOf(((float) (aVar.f * ((long) 8))) / f2)) : 0;
|
|
long a3 = i > 0 ? b.a(bVar, Float.valueOf(((float) aVar.a) / f2)) : 0;
|
|
Pair[] pairArr = new Pair[10];
|
|
pairArr[0] = o.to("avg_bitrate", Long.valueOf(a2));
|
|
pairArr[1] = o.to("avg_fps", Long.valueOf(a3));
|
|
pairArr[2] = o.to("num_bytes", Long.valueOf(aVar.f));
|
|
pairArr[3] = o.to("num_packets_lost", Long.valueOf(aVar.d));
|
|
pairArr[4] = o.to("num_packets", Long.valueOf(aVar.f219c));
|
|
pairArr[5] = o.to("num_frames", Long.valueOf(aVar.b));
|
|
Long l = dVar.b;
|
|
pairArr[6] = o.to("time_to_first_frame_ms", Long.valueOf(l != null ? l.longValue() : 0));
|
|
pairArr[7] = o.to("num_frames_dropped", Long.valueOf(aVar.e));
|
|
pairArr[8] = o.to("num_nacks", Long.valueOf(aVar.g));
|
|
pairArr[9] = o.to("num_plis", Long.valueOf(aVar.h));
|
|
return h0.plus(mapOf, h0.mapOf(pairArr));
|
|
}
|
|
}
|