[webrtc-pc] Inconsistent setting of receiver.track.readyState violates Mediacapture

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

== Inconsistent setting of receiver.track.readyState violates Mediacapture ==
Three things wrong: First, the sole mention of track `readyState` in WebRTC is in [pc.close()](https://rawgit.com/w3c/webrtc-pc/master/webrtc.html#dom-rtcpeerconnection-close):

*"For every RTCRtpTransceiver transceiver in transceivers, run the following steps:*
 *1. If transceiver's [[Stopped]] slot is true, abort these steps.*
 *2. ...*
 *3. ...*
 *4. ...*
 *5. ...*
 *6. ...*
 *7. Set receiver.track.readyState to "ended"."*

This means that while the following makes sense:
```js
pc.close();
console.log(pc.getTransceivers()[0].receiver.track.readyState); // ended
```
...the following makes no sense:
```js
pc.stop();
console.log(pc.getTransceivers()[0].receiver.track.readyState); // live
pc.close();
console.log(pc.getTransceivers()[0].receiver.track.readyState); // live
```

The second wrong thing is `readyState` is a read-only property, thus can't be set, but that's nit.

The third wrong thing is not firing the `ended` event here seems to violate the [mediacapture spec](https://w3c.github.io/mediacapture-main/getusermedia.html#track-ended):

*"When a MediaStreamTrack track ends for any reason other than the [stop()](https://w3c.github.io/mediacapture-main/getusermedia.html#dom-mediastreamtrack-stop) method being invoked, the User Agent MUST queue a task that runs the following steps:*
 *1. ...*
 *2. ...*
 *3. ...*
 *4. Fire a simple event named ended at the object."*

The stop() method referred to there is track.stop(), not any other stop().

Should we fire `ended` events on tracks from peer connection on `transceiver.stop()` and/or `pc.close()`, or fix mediacapture?

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

Received on Thursday, 7 September 2017 03:07:27 UTC