mirror of
https://github.com/Pinball3D/Rabbit-R1.git
synced 2024-12-27 01:22:33 -06:00
115 lines
3.5 KiB
Java
115 lines
3.5 KiB
Java
|
package org.webrtc;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
/* loaded from: classes3.dex */
|
||
|
public class RtpSender {
|
||
|
private MediaStreamTrack cachedTrack;
|
||
|
private final DtmfSender dtmfSender;
|
||
|
private long nativeRtpSender;
|
||
|
private boolean ownsTrack = true;
|
||
|
|
||
|
private static native long nativeGetDtmfSender(long j);
|
||
|
|
||
|
private static native String nativeGetId(long j);
|
||
|
|
||
|
private static native RtpParameters nativeGetParameters(long j);
|
||
|
|
||
|
private static native List<String> nativeGetStreams(long j);
|
||
|
|
||
|
private static native long nativeGetTrack(long j);
|
||
|
|
||
|
private static native void nativeSetFrameEncryptor(long j, long j2);
|
||
|
|
||
|
private static native boolean nativeSetParameters(long j, RtpParameters rtpParameters);
|
||
|
|
||
|
private static native void nativeSetStreams(long j, List<String> list);
|
||
|
|
||
|
private static native boolean nativeSetTrack(long j, long j2);
|
||
|
|
||
|
public DtmfSender dtmf() {
|
||
|
return this.dtmfSender;
|
||
|
}
|
||
|
|
||
|
public MediaStreamTrack track() {
|
||
|
return this.cachedTrack;
|
||
|
}
|
||
|
|
||
|
public RtpSender(long j) {
|
||
|
this.nativeRtpSender = j;
|
||
|
this.cachedTrack = MediaStreamTrack.createMediaStreamTrack(nativeGetTrack(j));
|
||
|
long nativeGetDtmfSender = nativeGetDtmfSender(j);
|
||
|
this.dtmfSender = nativeGetDtmfSender != 0 ? new DtmfSender(nativeGetDtmfSender) : null;
|
||
|
}
|
||
|
|
||
|
public boolean setTrack(MediaStreamTrack mediaStreamTrack, boolean z) {
|
||
|
checkRtpSenderExists();
|
||
|
if (!nativeSetTrack(this.nativeRtpSender, mediaStreamTrack == null ? 0L : mediaStreamTrack.getNativeMediaStreamTrack())) {
|
||
|
return false;
|
||
|
}
|
||
|
MediaStreamTrack mediaStreamTrack2 = this.cachedTrack;
|
||
|
if (mediaStreamTrack2 != null && this.ownsTrack) {
|
||
|
mediaStreamTrack2.dispose();
|
||
|
}
|
||
|
this.cachedTrack = mediaStreamTrack;
|
||
|
this.ownsTrack = z;
|
||
|
return true;
|
||
|
}
|
||
|
|
||
|
public void setStreams(List<String> list) {
|
||
|
checkRtpSenderExists();
|
||
|
nativeSetStreams(this.nativeRtpSender, list);
|
||
|
}
|
||
|
|
||
|
public List<String> getStreams() {
|
||
|
checkRtpSenderExists();
|
||
|
return nativeGetStreams(this.nativeRtpSender);
|
||
|
}
|
||
|
|
||
|
public boolean setParameters(RtpParameters rtpParameters) {
|
||
|
checkRtpSenderExists();
|
||
|
return nativeSetParameters(this.nativeRtpSender, rtpParameters);
|
||
|
}
|
||
|
|
||
|
public RtpParameters getParameters() {
|
||
|
checkRtpSenderExists();
|
||
|
return nativeGetParameters(this.nativeRtpSender);
|
||
|
}
|
||
|
|
||
|
public String id() {
|
||
|
checkRtpSenderExists();
|
||
|
return nativeGetId(this.nativeRtpSender);
|
||
|
}
|
||
|
|
||
|
public void setFrameEncryptor(FrameEncryptor frameEncryptor) {
|
||
|
checkRtpSenderExists();
|
||
|
nativeSetFrameEncryptor(this.nativeRtpSender, frameEncryptor.getNativeFrameEncryptor());
|
||
|
}
|
||
|
|
||
|
public void dispose() {
|
||
|
checkRtpSenderExists();
|
||
|
DtmfSender dtmfSender = this.dtmfSender;
|
||
|
if (dtmfSender != null) {
|
||
|
dtmfSender.dispose();
|
||
|
}
|
||
|
MediaStreamTrack mediaStreamTrack = this.cachedTrack;
|
||
|
if (mediaStreamTrack != null && this.ownsTrack) {
|
||
|
mediaStreamTrack.dispose();
|
||
|
}
|
||
|
JniCommon.nativeReleaseRef(this.nativeRtpSender);
|
||
|
this.nativeRtpSender = 0L;
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public long getNativeRtpSender() {
|
||
|
checkRtpSenderExists();
|
||
|
return this.nativeRtpSender;
|
||
|
}
|
||
|
|
||
|
private void checkRtpSenderExists() {
|
||
|
if (this.nativeRtpSender == 0) {
|
||
|
throw new IllegalStateException("RtpSender has been disposed.");
|
||
|
}
|
||
|
}
|
||
|
}
|