discord-jadx/app/src/main/java/org/webrtc/MediaSource.java

59 lines
1.3 KiB
Java

package org.webrtc;
import h0.c.p;
public class MediaSource {
private long nativeSource;
private final RefCountDelegate refCountDelegate;
public enum State {
INITIALIZING,
LIVE,
ENDED,
MUTED;
@CalledByNative("State")
public static State fromNativeIndex(int i) {
return values()[i];
}
}
public MediaSource(long j) {
this.refCountDelegate = new RefCountDelegate(new p(j));
this.nativeSource = j;
}
private void checkMediaSourceExists() {
if (this.nativeSource == 0) {
throw new IllegalStateException("MediaSource has been disposed.");
}
}
private static native State nativeGetState(long j);
public void dispose() {
checkMediaSourceExists();
this.refCountDelegate.release();
this.nativeSource = 0;
}
public long getNativeMediaSource() {
checkMediaSourceExists();
return this.nativeSource;
}
public void runWithReference(Runnable runnable) {
if (this.refCountDelegate.safeRetain()) {
try {
runnable.run();
} finally {
this.refCountDelegate.release();
}
}
}
public State state() {
checkMediaSourceExists();
return nativeGetState(this.nativeSource);
}
}