mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
82 lines
3.2 KiB
Java
82 lines
3.2 KiB
Java
package com.google.android.exoplayer2.upstream;
|
|
|
|
import android.os.Handler;
|
|
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
|
import com.google.android.exoplayer2.util.Assertions;
|
|
import java.util.Iterator;
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface BandwidthMeter {
|
|
void addEventListener(Handler handler, EventListener eventListener);
|
|
|
|
long getBitrateEstimate();
|
|
|
|
default long getTimeToFirstByteEstimateUs() {
|
|
return -9223372036854775807L;
|
|
}
|
|
|
|
TransferListener getTransferListener();
|
|
|
|
void removeEventListener(EventListener eventListener);
|
|
|
|
/* loaded from: classes2.dex */
|
|
public interface EventListener {
|
|
void onBandwidthSample(int i, long j, long j2);
|
|
|
|
/* loaded from: classes2.dex */
|
|
public static final class EventDispatcher {
|
|
private final CopyOnWriteArrayList<HandlerAndListener> listeners = new CopyOnWriteArrayList<>();
|
|
|
|
public void addListener(Handler handler, EventListener eventListener) {
|
|
Assertions.checkNotNull(handler);
|
|
Assertions.checkNotNull(eventListener);
|
|
removeListener(eventListener);
|
|
this.listeners.add(new HandlerAndListener(handler, eventListener));
|
|
}
|
|
|
|
public void removeListener(EventListener eventListener) {
|
|
Iterator<HandlerAndListener> it = this.listeners.iterator();
|
|
while (it.hasNext()) {
|
|
HandlerAndListener next = it.next();
|
|
if (next.listener == eventListener) {
|
|
next.release();
|
|
this.listeners.remove(next);
|
|
}
|
|
}
|
|
}
|
|
|
|
public void bandwidthSample(final int i, final long j, final long j2) {
|
|
Iterator<HandlerAndListener> it = this.listeners.iterator();
|
|
while (it.hasNext()) {
|
|
final HandlerAndListener next = it.next();
|
|
if (!next.released) {
|
|
next.handler.post(new Runnable() { // from class: com.google.android.exoplayer2.upstream.BandwidthMeter$EventListener$EventDispatcher$$ExternalSyntheticLambda0
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
BandwidthMeter.EventListener.EventDispatcher.HandlerAndListener.this.listener.onBandwidthSample(i, j, j2);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: Access modifiers changed from: private */
|
|
/* loaded from: classes2.dex */
|
|
public static final class HandlerAndListener {
|
|
private final Handler handler;
|
|
private final EventListener listener;
|
|
private boolean released;
|
|
|
|
public void release() {
|
|
this.released = true;
|
|
}
|
|
|
|
public HandlerAndListener(Handler handler, EventListener eventListener) {
|
|
this.handler = handler;
|
|
this.listener = eventListener;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|