Change VideoTrack implementation to invoke VideoTrackSourceInterface::AddOrUpdateSink on the worker thread.
Added documentation of thread expectations for video tracks and sources to the API.
BUG=None
Review-Url: https://codereview.webrtc.org/2964863002
Cr-Commit-Position: refs/heads/master@{#18938}
diff --git a/webrtc/api/mediastreaminterface.h b/webrtc/api/mediastreaminterface.h
index cc660e1..71cbbb7 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> {
@@ -154,12 +165,6 @@
// See https://crbug.com/653531 and https://github.com/WICG/mst-content-hint.
enum class ContentHint { kNone, kFluid, kDetailed };
- // Register a video sink for this track. Used to connect the track to the
- // underlying video engine.
- void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,
- const rtc::VideoSinkWants& wants) override {}
- void RemoveSink(rtc::VideoSinkInterface<VideoFrame>* sink) override {}
-
virtual VideoTrackSourceInterface* GetSource() const = 0;
virtual ContentHint content_hint() const { return ContentHint::kNone; }