Re: [webrtc-pc] Investigate stopping SRD and createAnswer

My understanding is that if an "m=" section is rejected, this is described in the SDP by zeroing the port, e.g. [1]. We must decide which "m=" sections to reject, including bundled ones, when generating the SDP or else we generate invalid SDP. This [comment](https://github.com/w3c/webrtc-pc/issues/1858#issuecomment-391187810) suggests "_The other rejected m= sections' transceivers shouldn't be stopped until setLocalDescription(answer)_".

I think the webrtc-pc bug is that we only stop transceivers to reflect the fact that they have been rejected at setRemoteDescription(). We have to do the same at setLocalDescription(), because setLocalDescription(answer) may entail setting SDP containing rejected "m=" sections.

I think we have to do this here, because not until SLD do we know which transceivers are associated with which media sections, and not until SLD would we be able to perform the check "transceiver1.receiver.transport == transceiver2.receiver.transport". But it is the act of associating with the "m=" section that causes the transceiver to have to be stopped. If we only stopped related transceivers at RTCRtpTransceiver.stop() then that would not include stopping transceivers for "m=" sections that don't have a transceiver yet, and we may end up creating a transceiver for a rejected "m=" section at SLD that isn't stopped. So let's always stop if rejected at SLD.

This seems like a good idea regardless, there may be other causes for rejecting an "m=" section, and the lower layer states should be surfaced to RTCRtpTransceiver.

[1] [jsep](https://tools.ietf.org/html/draft-ietf-rtcweb-jsep-24#section-5.3)

> For each offered m= section, if any of the following conditions are true, the corresponding m= section in the answer MUST be marked as rejected by setting the port in the m= line to zero, as indicated in [RFC3264], Section 6, and further processing for this m= section can be skipped:
> 
> - The associated RtpTransceiver has been stopped.
> - ...

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

Received on Wednesday, 25 July 2018 19:03:41 UTC