[webrtc-pc] Differences between pc.removeTrack(sender) and sender.replaceTrack(null)

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

== Differences between pc.removeTrack(sender) and sender.replaceTrack(null) ==
The spec does not make clear whether a `transceiver` can be reused for sending a new track (or the previous one) after having called `pc.removeTrack(transceiver.sender)`.

Assuming a simple scenario with a single `transceiver` for just **sending** audio (don't receive anything).

* Q1: Is `sender.replaceTrack(track)` allowed after `pc.removeTrack(sender)`?
   * Chrome and Firefox allow it. Safari fails, but it seems they are fixing it [1][2].

* Q2: Should `sender.replaceTrack(null)` automatically set `a=inactive`?
   * Browsers don't do this and `direction` remains "sendonly".

* Q3: Is there any constraints regarding when `transceiver.direction` can be changed by the app? According to the spec there is not, and both Chrome and Firefox never complain, but Safari 12.1 produces an exception when setting the `direction` in certain circumstances (hard to explain them since it depends on different factors and probably it's just a bug).

* Q4: Should the browser keep sending RTCP SDES and RTCP SenderReports for the corresponding ssrc(s) after calling `sender.replaceTrack(null)`?
   * Chrome still sends both SDES and SenderReports.
   * If `transceiver.direction` is manually set to "inactive", then Chrome just sends SDES.

* Q5: Should the browser keep sending RTCP SDES for the corresponding ssrc(s) after calling `pc.replaceTrack(sender)`?
   * Chrome does. Firefox does not.

* Q6: If the answer to Q1 is yes, what's the purpose of `pc.removeTrack(sender)` having already `sender.replaceTrack(null)`? Just those items come to my mind:
    * `pc.removeTrack(sender)` cleans `RtpSender` settings (such as configured sending parameters, used SSRCs, stats, etc).
    * `sender.replaceTrack(null)` does not, so attaching a new track to the `sender` will send it with previous sender configuration/encodings.

[1] https://bugs.webkit.org/show_bug.cgi?id=191202
[2] https://bugs.webkit.org/attachment.cgi?id=353842&action=diff

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

Received on Monday, 5 November 2018 11:55:49 UTC