Re: [webrtc-pc] addTransceiver woes

@stefhak:
> if you create a transceiver using kind = 'video' with direction sendrecv, surely it should start sending once you attach a live video track to its sender?

Ideally yes but this seems to lead to inconsistencies.
[replaceTrack](http://w3c.github.io/webrtc-pc/#dom-rtcrtpsender-replacetrack) says:
> Determine if negotiation is needed to transmit withTrack in place of the sender's existing track. Negotiation is not needed if withTrack is null or if the sender's existing track is ended

Do we need negotiation to go from "there was never a track" to "there is a track"? 
Note that this is different from "we called replaceTrack with null, then want to replace again without negotiation" (which doesn't seem to be covered by the text quoted above but I think we agree this *should not* require negotiation).

Essentially this is:
```
const pc = new RTCPeerConnection();
const transceiver = pc.addTransceiver('audio');
// ... negotiate (so the transceiver becomes associated)
transceiver.sender.replaceTrack(someAudioTrack);
```
replaceTrack would behave more like addTrack without requiring another O/A cycle([addTrack, step 6](http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtrack)). This is different from the use-cases I have seen it used before which are:
* changing the front/back camera
* change between camera and screen content
* stop a video track so the camera light goes off when the user presses the mute button, call GUM again to get a new video track, call replaceTrack. Note that this just stops the track and doesn't call replaceTrack(null) in the first part.

>From a different angle, why do we require negotiation for this:
```
const pc = new RTCPeerConnection();
const transceiver = pc.addTransceiver('audio');
// ... negotiate (so the transceiver becomes associated)
pc.addTrack(someAudioTrack, someStream);
```
which, presumably, would reuse the transceivers sender.

-- 
GitHub Notification of comment by fippo
Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/1662#issuecomment-354419080 using your GitHub account

Received on Friday, 29 December 2017 09:07:11 UTC