versatica / libmediasoupclient

mediasoup client side C++ library
https://mediasoup.org
ISC License
286 stars 177 forks source link

Move SetRemoteDescription to Recommended API #139

Closed GEverding closed 1 year ago

GEverding commented 2 years ago

HI,

In production we've observer that calls to SetRemoteDescription can block indefinitely. Based on comments from the WebRTC m94 branch this can happen.

  file: api/peer_connection_interface.h
  // Sets the remote session description.
  //
  // (Unlike "SDP munging" before SetLocalDescription(), modifying a remote
  // offer or answer is allowed by the spec.)
  //
  // The observer is invoked as soon as the operation completes, which could be
  // before or after the SetRemoteDescription() method has exited.
  virtual void SetRemoteDescription(
      std::unique_ptr<SessionDescriptionInterface> desc,
      rtc::scoped_refptr<SetRemoteDescriptionObserverInterface> observer) = 0;
  // Like SetRemoteDescription() above, but the observer is invoked with a delay
  // after the operation completes. This helps avoid recursive calls by the
  // observer but also makes it possible for states to change in-between the
  // operation completing and the observer getting called. This makes them racy
  // for synchronizing peer connection states to the application.
  // TODO(https://crbug.com/webrtc/11798): Delete this method in favor of the
  // ones taking SetRemoteDescriptionObserverInterface as argument.
  virtual void SetRemoteDescription(SetSessionDescriptionObserver* observer,
                                    SessionDescriptionInterface* desc) {}

I've implemented the api using the SetRemoteDescriptionObserverInterface. Looking for feedback to this change.

jmillan commented 2 years ago

please @GEverding, run gulp format

jmillan commented 1 year ago

This is already implemented in https://github.com/versatica/libmediasoupclient/pull/154