Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: webrtc/api/videotracksource.cc

Issue 1765423005: Change VideoRtpReceiver to create remote VideoTrack and VideoTrackSource. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixed up the comments. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/api/videotracksource.h ('k') | webrtc/media/base/videobroadcaster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/api/videotracksource.cc
diff --git a/webrtc/api/videotracksource.cc b/webrtc/api/videotracksource.cc
index 3b5e19a5b733aef9d1cefe9ba40dc49cde9b1fcb..f8212d7a70cab20cfce2d4dc5349bb172b06cc4f 100644
--- a/webrtc/api/videotracksource.cc
+++ b/webrtc/api/videotracksource.cc
@@ -32,9 +32,16 @@ void VideoTrackSource::SetState(SourceState new_state) {
}
}
+void VideoTrackSource::OnSourceDestroyed() {
+ source_ = nullptr;
+}
+
void VideoTrackSource::AddOrUpdateSink(
rtc::VideoSinkInterface<cricket::VideoFrame>* sink,
const rtc::VideoSinkWants& wants) {
+ if (!source_) {
+ return;
+ }
worker_thread_->Invoke<void>(rtc::Bind(
&rtc::VideoSourceInterface<cricket::VideoFrame>::AddOrUpdateSink, source_,
sink, wants));
@@ -42,6 +49,9 @@ void VideoTrackSource::AddOrUpdateSink(
void VideoTrackSource::RemoveSink(
rtc::VideoSinkInterface<cricket::VideoFrame>* sink) {
+ if (!source_) {
+ return;
+ }
worker_thread_->Invoke<void>(
rtc::Bind(&rtc::VideoSourceInterface<cricket::VideoFrame>::RemoveSink,
source_, sink));
« no previous file with comments | « webrtc/api/videotracksource.h ('k') | webrtc/media/base/videobroadcaster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698