PSA: c++ API for MediaStream.AddTrack / RemoveTrack has changed

If you don't use the WebRTC C++ API, you can stop reading now.
If you don't use the MediaStream API, you can stop reading now.

The webrtc::MediaStream API is changing the type of two methods (in two
versions each):
OLD:

  virtual bool AddTrack(AudioTrackInterface* track) = 0;
  virtual bool AddTrack(VideoTrackInterface* track) = 0;
  virtual bool RemoveTrack(AudioTrackInterface* track) = 0;
  virtual bool RemoveTrack(VideoTrackInterface* track) = 0;

NEW:

  virtual bool AddTrack(rtc::scoped_refptr<AudioTrackInterface> track)
  virtual bool AddTrack(rtc::scoped_refptr<VideoTrackInterface> track)
  virtual bool RemoveTrack(rtc::scoped_refptr<AudioTrackInterface> track)
  virtual bool RemoveTrack(rtc::scoped_refptr<VideoTrackInterface> track)

This better reflects the fact that AddTrack() takes shared ownership of the
track; the change
to RemoveTrack() is done mainly for symmetry.

The old API will be in place for at least a couple of weeks, to give
callers time to adapt.

Tracking bug: https://crbug.com/webrtc/13980

Harald

Received on Thursday, 21 April 2022 11:52:42 UTC