Skip to content

Rollback SDP type not working? #2416

Open
@davewasmer

Description

@davewasmer

Your environment.

  • Version: 3.1.17

What did you do?

peerConnection.SetLocalDescription(webrtc.SessionDescription{Type: webrtc.SDPTypeRollback})

What did you expect?

The connection state is rolled back, and the local and remote descriptions are cleared.

What happened?

InvalidModificationError: invalid SDP type supplied to SetLocalDescription(): rollback

Hypothesis

It seems that this section of peerconection.go might be the issue:

if desc.SDP == "" {
	switch desc.Type {
	case SDPTypeAnswer, SDPTypePranswer:
		desc.SDP = pc.lastAnswer
	case SDPTypeOffer:
		desc.SDP = pc.lastOffer
	default:
		return &rtcerr.InvalidModificationError{
			Err: fmt.Errorf("%w: %s", errPeerConnSDPTypeInvalidValueSetLocalDescription, desc.Type),
		}
	}
}

The SDPTypeRollback case isn't handled here, despite being handled in the underlying SetDescription function:

case SDPTypeRollback:
	nextState, err = checkNextSignalingState(cur, SignalingStateStable, setLocal, sd.Type)
	if err == nil {
		pc.pendingLocalDescription = nil
	}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions