W3C home > Mailing lists > Public > public-webrtc@w3.org > April 2022

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

From: Harald Alvestrand <hta@google.com>
Date: Thu, 21 Apr 2022 13:52:15 +0200
Message-ID: <CAOqqYVFedKnP_D1YF9tF420UEVw-yEsfZ0dpj6hMs_KxWsO_Mg@mail.gmail.com>
To: "public-webrtc@W3.org" <public-webrtc@w3.org>
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):

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


  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

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

This archive was generated by hypermail 2.4.0 : Thursday, 21 April 2022 11:52:44 UTC