Skip to main content

5.7. Processing a Rollback

5.7. Processing a Rollback

A rollback may be performed if the PeerConnection is in any state except for "stable". This means that both offers and provisional answers can be rolled back. Rollback can only be used to cancel proposed changes; there is no support for rolling back from a "stable" state to a previous "stable" state. If a rollback is attempted in the "stable" state, processing MUST stop and an error MUST be returned. Note that this implies that once the answerer has performed setLocalDescription with its answer, this cannot be rolled back.

The effect of rollback MUST be the same regardless of whether setLocalDescription or setRemoteDescription is called.

In order to process rollback, a JSEP implementation abandons the current offer/answer transaction, sets the signaling state to "stable", and sets the pending local and/or remote description (see Sections 4.1.14 and 4.1.16) to "null". Any resources or candidates that were allocated by the abandoned local description are discarded; any media that is received is processed according to the previous local and remote descriptions.

A rollback disassociates any RtpTransceivers that were associated with "m=" sections by the application of the rolled-back session description (see Sections 5.10 and 5.9). This means that some RtpTransceivers that were previously associated will no longer be associated with any "m=" section; in such cases, the value of the RtpTransceiver's mid property MUST be set to "null", and the mapping between the transceiver and its "m=" section index MUST be discarded. RtpTransceivers that were created by applying a remote offer that was subsequently rolled back MUST be stopped and removed from the PeerConnection. However, an RtpTransceiver MUST NOT be removed if a track was attached to the RtpTransceiver via the addTrack method. This is so that an application may call addTrack, then call setRemoteDescription with an offer, then roll back that offer, then call createOffer and have an "m=" section for the added track appear in the generated offer.