Rabbit-R1/android (non root)/java/sources/org/webrtc/MediaSource.java
2024-05-21 17:08:36 -04:00

65 lines
1.7 KiB
Java

package org.webrtc;
/* loaded from: classes3.dex */
public class MediaSource {
private long nativeSource;
private final RefCountDelegate refCountDelegate;
private static native State nativeGetState(long j);
/* loaded from: classes3.dex */
public enum State {
INITIALIZING,
LIVE,
ENDED,
MUTED;
static State fromNativeIndex(int i) {
return values()[i];
}
}
public MediaSource(final long j) {
this.refCountDelegate = new RefCountDelegate(new Runnable() { // from class: org.webrtc.MediaSource$$ExternalSyntheticLambda0
@Override // java.lang.Runnable
public final void run() {
JniCommon.nativeReleaseRef(j);
}
});
this.nativeSource = j;
}
public State state() {
checkMediaSourceExists();
return nativeGetState(this.nativeSource);
}
public void dispose() {
checkMediaSourceExists();
this.refCountDelegate.release();
this.nativeSource = 0L;
}
/* JADX INFO: Access modifiers changed from: protected */
public long getNativeMediaSource() {
checkMediaSourceExists();
return this.nativeSource;
}
/* JADX INFO: Access modifiers changed from: package-private */
public void runWithReference(Runnable runnable) {
if (this.refCountDelegate.safeRetain()) {
try {
runnable.run();
} finally {
this.refCountDelegate.release();
}
}
}
private void checkMediaSourceExists() {
if (this.nativeSource == 0) {
throw new IllegalStateException("MediaSource has been disposed.");
}
}
}