[webrtc-pc] Transceiver kind definition is circular.

jan-ivar has just created a new issue for https://github.com/w3c/webrtc-pc:

== Transceiver kind definition is circular. ==
@fippo asked: "so i can determine the kind of an RTCRtpSender by looking at `sender.track.kind`, right? - now... what if I called `sender.replaceTrack(null)`?"

Interestingly, the [replaceTrack algorithm](http://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-replacetrack) says: *"If `withTrack` is non-null and `withTrack.kind` differs from the [transceiver kind](http://w3c.github.io/webrtc-pc/#dfn-transceiver-kind) of transceiver, return a promise rejected with a newly created `TypeError`."*

Encouraging, except [transceiver kind](http://w3c.github.io/webrtc-pc/#dfn-transceiver-kind) is defined as: *"The* ***transceiver kind*** *of an RTCRtpTransceiver is defined by the kind of the associated RTCRtpReceiver 's MediaStreamTrack object."*

A circular definition.

We should fix transceiver kind to be an internal slot, so the kind information is not lost, to outlaw:
```js
let sender = addTrack(stream.getVideoTracks()[0], stream);
await sender.replaceTrack(null);
await sender. replaceTrack(stream.getAudioTracks()[0], stream); // circumvents TypeError

Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1472 using your GitHub account

Received on Monday, 10 July 2017 15:38:43 UTC