Reland "Implement transceiver.stop()"
This is a reland of 11dc6571cb4ff3e71dee1557dfff8d9076e108d3
One fix that makes Web Platform Tests pass in debug mode is applied.
Original change's description:
> Implement transceiver.stop()
>
> This adds RtpTransceiver.StopStandard(), which behaves according to
> the specification at
> https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
>
> It modifies RTCPeerConnection.getTransceivers() to return only
> transceivers that have not been stopped.
>
> Rebase of armax' https://webrtc-review.googlesource.com/c/src/+/172762
>
> Bug: chromium:980879
> Change-Id: I7d383ee874ccc0a006fdcf280496b5d4235425ce
> Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/180580
> Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
> Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
> Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
> Commit-Queue: Harald Alvestrand <hta@webrtc.org>
> Cr-Commit-Position: refs/heads/master@{#31893}
Bug: chromium:980879
Change-Id: Ide31d929ac5ea118d83fdf6a35a592af23f7dfa7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/181263
Reviewed-by: Sami Kalliomäki <sakal@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Guido Urdaneta <guidou@webrtc.org>
Reviewed-by: Kári Helgason <kthelgason@webrtc.org>
Commit-Queue: Harald Alvestrand <hta@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#31907}
diff --git a/sdk/android/api/org/webrtc/RtpTransceiver.java b/sdk/android/api/org/webrtc/RtpTransceiver.java
index 64d8eb4..021cc90 100644
--- a/sdk/android/api/org/webrtc/RtpTransceiver.java
+++ b/sdk/android/api/org/webrtc/RtpTransceiver.java
@@ -206,13 +206,34 @@
}
/**
- * The Stop method irreversibly stops the RtpTransceiver. The sender of this
- * transceiver will no longer send, the receiver will no longer receive.
- * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
+ * The Stop method will for the time being call the StopInternal method.
+ * After a migration procedure, stop() will be equivalent to StopStandard.
*/
public void stop() {
checkRtpTransceiverExists();
- nativeStop(nativeRtpTransceiver);
+ nativeStopInternal(nativeRtpTransceiver);
+ }
+
+ /**
+ * The StopInternal method stops the RtpTransceiver, like Stop, but goes
+ * immediately to Stopped state.
+ */
+ public void stopInternal() {
+ checkRtpTransceiverExists();
+ nativeStopInternal(nativeRtpTransceiver);
+ }
+
+ /**
+ * The StopStandard method irreversibly stops the RtpTransceiver. The sender
+ * of this transceiver will no longer send, the receiver will no longer
+ * receive.
+ *
+ * <p>The transceiver will enter Stopping state and signal NegotiationNeeded.
+ * https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
+ */
+ public void stopStandard() {
+ checkRtpTransceiverExists();
+ nativeStopStandard(nativeRtpTransceiver);
}
@CalledByNative
@@ -237,7 +258,8 @@
private static native boolean nativeStopped(long rtpTransceiver);
private static native RtpTransceiverDirection nativeDirection(long rtpTransceiver);
private static native RtpTransceiverDirection nativeCurrentDirection(long rtpTransceiver);
- private static native void nativeStop(long rtpTransceiver);
+ private static native void nativeStopInternal(long rtpTransceiver);
+ private static native void nativeStopStandard(long rtpTransceiver);
private static native void nativeSetDirection(
long rtpTransceiver, RtpTransceiverDirection rtpTransceiverDirection);
}
diff --git a/sdk/android/src/jni/pc/rtp_transceiver.cc b/sdk/android/src/jni/pc/rtp_transceiver.cc
index 7d8cfde..a0b3c20 100644
--- a/sdk/android/src/jni/pc/rtp_transceiver.cc
+++ b/sdk/android/src/jni/pc/rtp_transceiver.cc
@@ -139,9 +139,16 @@
: nullptr;
}
-void JNI_RtpTransceiver_Stop(JNIEnv* jni,
- jlong j_rtp_transceiver_pointer) {
- reinterpret_cast<RtpTransceiverInterface*>(j_rtp_transceiver_pointer)->Stop();
+void JNI_RtpTransceiver_StopInternal(JNIEnv* jni,
+ jlong j_rtp_transceiver_pointer) {
+ reinterpret_cast<RtpTransceiverInterface*>(j_rtp_transceiver_pointer)
+ ->StopInternal();
+}
+
+void JNI_RtpTransceiver_StopStandard(JNIEnv* jni,
+ jlong j_rtp_transceiver_pointer) {
+ reinterpret_cast<RtpTransceiverInterface*>(j_rtp_transceiver_pointer)
+ ->StopStandard();
}
void JNI_RtpTransceiver_SetDirection(
diff --git a/sdk/objc/api/peerconnection/RTCRtpTransceiver.h b/sdk/objc/api/peerconnection/RTCRtpTransceiver.h
index f8996cc..17054f5 100644
--- a/sdk/objc/api/peerconnection/RTCRtpTransceiver.h
+++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver.h
@@ -117,7 +117,7 @@
* this transceiver will no longer send, the receiver will no longer receive.
* https://w3c.github.io/webrtc-pc/#dom-rtcrtptransceiver-stop
*/
-- (void)stop;
+- (void)stopInternal;
@end
diff --git a/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
index 2995e5f..5d0d8ed 100644
--- a/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
+++ b/sdk/objc/api/peerconnection/RTCRtpTransceiver.mm
@@ -90,8 +90,8 @@
}
}
-- (void)stop {
- _nativeRtpTransceiver->Stop();
+- (void)stopInternal {
+ _nativeRtpTransceiver->StopInternal();
}
- (NSString *)description {