Change VideoRtpReceiver to create remote VideoTrack and VideoTrackSource.
This enabled us to be able to remove VideoTrack::GetSink and RemoteVideoCapturer.
Since video frames from the decoder is delivered on a media engine internal thread, VideoBroadCaster must be made thread safe.
BUG=webrtc:5426
R=deadbeef@webrtc.org, pthatcher@webrtc.org
Review URL: https://codereview.webrtc.org/1765423005 .
Cr-Commit-Position: refs/heads/master@{#11944}
diff --git a/webrtc/api/rtpreceiver.h b/webrtc/api/rtpreceiver.h
index 43adc72..a62ed19 100644
--- a/webrtc/api/rtpreceiver.h
+++ b/webrtc/api/rtpreceiver.h
@@ -19,7 +19,9 @@
#include "webrtc/api/mediastreamprovider.h"
#include "webrtc/api/rtpreceiverinterface.h"
+#include "webrtc/api/videotracksource.h"
#include "webrtc/base/basictypes.h"
+#include "webrtc/media/base/videobroadcaster.h"
namespace webrtc {
@@ -60,12 +62,18 @@
class VideoRtpReceiver : public rtc::RefCountedObject<RtpReceiverInterface> {
public:
- VideoRtpReceiver(VideoTrackInterface* track,
+ VideoRtpReceiver(MediaStreamInterface* stream,
+ const std::string& track_id,
+ rtc::Thread* worker_thread,
uint32_t ssrc,
VideoProviderInterface* provider);
virtual ~VideoRtpReceiver();
+ rtc::scoped_refptr<VideoTrackInterface> video_track() const {
+ return track_.get();
+ }
+
// RtpReceiverInterface implementation
rtc::scoped_refptr<MediaStreamTrackInterface> track() const override {
return track_.get();
@@ -77,9 +85,16 @@
private:
std::string id_;
- rtc::scoped_refptr<VideoTrackInterface> track_;
uint32_t ssrc_;
VideoProviderInterface* provider_;
+ // |broadcaster_| is needed since the decoder can only handle one sink.
+ // It might be better if the decoder can handle multiple sinks and consider
+ // the VideoSinkWants.
+ rtc::VideoBroadcaster broadcaster_;
+ // |source_| is held here to be able to change the state of the source when
+ // the VideoRtpReceiver is stopped.
+ rtc::scoped_refptr<VideoTrackSource> source_;
+ rtc::scoped_refptr<VideoTrackInterface> track_;
};
} // namespace webrtc