stasel / WebRTC

Unofficial distribution of up to date WebRTC framework binaries for iOS and macOS
Other
359 stars 76 forks source link

Not able to rollback local offer, stuck in have-local-offer state #31

Closed almasios closed 2 years ago

almasios commented 2 years ago

Hey there, I know this is just an unofficial distribution repository, but hopefully somebody might be able to help me.

I'm trying to setup a perfect negotiation technique for establishing a connection. To achieve that I need one of the users to rollback a local offer and accept a remote offer. I use this api:

peerConnection.setLocalDescription(RTCSessionDescription(type: .rollback, sdp: RTCSessionDescription.string(for: .rollback))) {
    self.peerConnection.setRemoteDescription(remoteSdp)...
}

After setting remote sdp in the completion handler above I get this error: Failed to set remote offer sdp: Called in wrong state: have-local-offer. In the rollback completion handler the state of the peerConnection still remains as have-local-offer. For some reason rollback function doesn't work, and users end up in have-local-offer state. Does anyone know how to rollback local offer properly?