Reland of Change VideoTrack implementation to invoke VideoTrackSourceInterface::AddOrUpdateSink on wt
Added documentation of thread expectations for video tracks and sources to the API.
Originally landed as patchset #2 id:20001 of https://codereview.webrtc.org/2964863002/.
Patchset 1 is the originall cl.
Patschet 2 is modified so that VideoTrackInterface::AddSink and RemoveSink have a default implementation.
BUG=none
Review-Url: https://codereview.webrtc.org/2989113002
Cr-Commit-Position: refs/heads/master@{#19195}
diff --git a/webrtc/api/mediastreaminterface.h b/webrtc/api/mediastreaminterface.h
index cc660e1..aaf5b62 100644
--- a/webrtc/api/mediastreaminterface.h
+++ b/webrtc/api/mediastreaminterface.h
@@ -111,6 +111,11 @@
// VideoTrackSourceInterface is a reference counted source used for
// VideoTracks. The same source can be used by multiple VideoTracks.
+// VideoTrackSourceInterface is designed to be invoked on the signaling thread
+// except for rtc::VideoSourceInterface<VideoFrame> methods that will be invoked
+// on the worker thread via a VideoTrack. A custom implementation of a source
+// can inherit AdaptedVideoTrackSource instead of directly implementing this
+// interface.
class VideoTrackSourceInterface
: public MediaSourceInterface,
public rtc::VideoSourceInterface<VideoFrame> {
@@ -145,6 +150,12 @@
virtual ~VideoTrackSourceInterface() {}
};
+// VideoTrackInterface is designed to be invoked on the signaling thread except
+// for rtc::VideoSourceInterface<VideoFrame> methods that must be invoked
+// on the worker thread.
+// PeerConnectionFactory::CreateVideoTrack can be used for creating a VideoTrack
+// that ensures thread safety and that all methods are called on the right
+// thread.
class VideoTrackInterface
: public MediaStreamTrackInterface,
public rtc::VideoSourceInterface<VideoFrame> {