Step 1: Add RemoveTrackNew which returns an RTCError
Bug: webrtc:9534
Change-Id: I400bdcd0eb2e993b3f2252a2c7606cd105854e6b
Reviewed-on: https://webrtc-review.googlesource.com/89480
Commit-Queue: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#24070}
diff --git a/api/peerconnectioninterface.cc b/api/peerconnectioninterface.cc
index aa23da3..adae14f 100644
--- a/api/peerconnectioninterface.cc
+++ b/api/peerconnectioninterface.cc
@@ -46,6 +46,16 @@
return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented");
}
+bool PeerConnectionInterface::RemoveTrack(RtpSenderInterface* sender) {
+ return RemoveTrackNew(sender).ok();
+}
+
+RTCError PeerConnectionInterface::RemoveTrackNew(
+ rtc::scoped_refptr<RtpSenderInterface> sender) {
+ return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE
+ : RTCErrorType::INTERNAL_ERROR);
+}
+
RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>>
PeerConnectionInterface::AddTransceiver(
rtc::scoped_refptr<MediaStreamTrackInterface> track) {
diff --git a/api/peerconnectioninterface.h b/api/peerconnectioninterface.h
index a320508..4851206 100644
--- a/api/peerconnectioninterface.h
+++ b/api/peerconnectioninterface.h
@@ -664,7 +664,21 @@
// Remove an RtpSender from this PeerConnection.
// Returns true on success.
- virtual bool RemoveTrack(RtpSenderInterface* sender) = 0;
+ // TODO(steveanton): Replace with signature that returns RTCError.
+ virtual bool RemoveTrack(RtpSenderInterface* sender);
+
+ // Plan B semantics: Removes the RtpSender from this PeerConnection.
+ // Unified Plan semantics: Stop sending on the RtpSender and mark the
+ // corresponding RtpTransceiver direction as no longer sending.
+ //
+ // Errors:
+ // - INVALID_PARAMETER: |sender| is null or (Plan B only) the sender is not
+ // associated with this PeerConnection.
+ // - INVALID_STATE: PeerConnection is closed.
+ // TODO(bugs.webrtc.org/9534): Rename to RemoveTrack once the other signature
+ // is removed.
+ virtual RTCError RemoveTrackNew(
+ rtc::scoped_refptr<RtpSenderInterface> sender);
// AddTransceiver creates a new RtpTransceiver and adds it to the set of
// transceivers. Adding a transceiver will cause future calls to CreateOffer