Update VideoTrack::Create to use rtc::scoped_refptr.

Bug: webrtc:13464
Change-Id: I6508fbede2f447f8c0c9b37556d37e7fc2ccb744
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/252441
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Tomas Gunnarsson <tommi@webrtc.org>
Commit-Queue: Niels Moller <nisse@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#36277}
This commit is contained in:
Niels Möller
2022-03-21 10:40:09 +01:00
committed by WebRTC LUCI CQ
parent b3517fea83
commit 769de49937
3 changed files with 8 additions and 8 deletions

View File

@ -276,8 +276,9 @@ rtc::scoped_refptr<VideoTrackInterface> PeerConnectionFactory::CreateVideoTrack(
const std::string& id,
VideoTrackSourceInterface* source) {
RTC_DCHECK(signaling_thread()->IsCurrent());
rtc::scoped_refptr<VideoTrackInterface> track(
VideoTrack::Create(id, source, worker_thread()));
rtc::scoped_refptr<VideoTrackInterface> track = VideoTrack::Create(
id, rtc::scoped_refptr<VideoTrackSourceInterface>(source),
worker_thread());
return VideoTrackProxy::Create(signaling_thread(), worker_thread(), track);
}
@ -285,8 +286,8 @@ rtc::scoped_refptr<AudioTrackInterface> PeerConnectionFactory::CreateAudioTrack(
const std::string& id,
AudioSourceInterface* source) {
RTC_DCHECK(signaling_thread()->IsCurrent());
rtc::scoped_refptr<AudioTrackInterface> track(
AudioTrack::Create(id, rtc::scoped_refptr<AudioSourceInterface>(source)));
rtc::scoped_refptr<AudioTrackInterface> track =
AudioTrack::Create(id, rtc::scoped_refptr<AudioSourceInterface>(source));
return AudioTrackProxy::Create(signaling_thread(), track);
}

View File

@ -132,13 +132,12 @@ void VideoTrack::OnChanged() {
rtc::scoped_refptr<VideoTrack> VideoTrack::Create(
const std::string& id,
VideoTrackSourceInterface* source,
rtc::scoped_refptr<VideoTrackSourceInterface> source,
rtc::Thread* worker_thread) {
rtc::scoped_refptr<
VideoTrackSourceProxyWithInternal<VideoTrackSourceInterface>>
source_proxy = VideoTrackSourceProxy::Create(
rtc::Thread::Current(), worker_thread,
rtc::scoped_refptr<VideoTrackSourceInterface>(source));
rtc::Thread::Current(), worker_thread, std::move(source));
return rtc::make_ref_counted<VideoTrack>(id, std::move(source_proxy),
worker_thread);

View File

@ -39,7 +39,7 @@ class VideoTrack : public MediaStreamTrack<VideoTrackInterface>,
public:
static rtc::scoped_refptr<VideoTrack> Create(
const std::string& label,
VideoTrackSourceInterface* source,
rtc::scoped_refptr<VideoTrackSourceInterface> source,
rtc::Thread* worker_thread);
void AddOrUpdateSink(rtc::VideoSinkInterface<VideoFrame>* sink,