-
Notifications
You must be signed in to change notification settings - Fork 115
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
removeTrack: throw exception if sender is not in connection's set of senders #727
Comments
In all versions of removeTrack/Stream, this situation has been a no-op. The same goes for, e.g., RTCPeerConnection.close (it just returns if the pc is closed already). That way they can be safely called without checking some state or property beforehand. This approach has drawbacks, as you point out above, but I don't think we can start throwing at this time as it could make existing apps throw unexpectedly. |
Hello @adam-be,
So, I would consider throwing an exception in the case I mentioned. |
@mparis var sender = pc.addTrack(track, stream);
pc.removeTrack(sender); // fine
pc.removeTrack(sender); // fine This is consistent with other methods as well: var track = stream.getTracks()[0];
stream.removeTrack(track); // fine
stream.removeTrack(track); // fine Idempotency simplifies, especially in the latter case, as a track may be in multiple streams at once. I don't think we want to lose that property, but maybe we could distinguish the above from your case: var sender = pc1.addTrack(track, stream);
pc2.removeTrack(sender); Doing so would require implementations to know that this sender was not born of this peer connection, which is always a pilot error. This seems doable and worthwhile to me. |
The key distinction being that a sender can never be in another peer connection. |
I like the idea of differentiating whether or not the sender was created by the peer connection. In one case, the argument to But in the other case, the argument to |
…der. Fixes issue w3c#727. "invalid sender" refers to one that was created by another RTCPeerConnection. The working group agreed to this at TPAC 2016.
I agree that this makes sense. |
Fixed by #844 |
Hello,
I think that if removeTrack's sender param is not in connection's set of senders and exception should be thrown.
This is quite useful for developers to find problems in their apps.
Imagine that an app has 2 PeerConnections and call pc1.removeTrack (senderOfPc2).
If an exception is thrown, it would help the developer to see the problem and fix it.
Refs
[1] http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-removetrack
The text was updated successfully, but these errors were encountered: