diff --git a/test/scenario/video_frame_matcher.cc b/test/scenario/video_frame_matcher.cc index 912459183f..d2b0ee231f 100644 --- a/test/scenario/video_frame_matcher.cc +++ b/test/scenario/video_frame_matcher.cc @@ -158,7 +158,9 @@ void ForwardingCapturedFrameTap::OnDiscardedFrame() { void ForwardingCapturedFrameTap::AddOrUpdateSink( VideoSinkInterface* sink, const rtc::VideoSinkWants& wants) { - sink_ = sink; + if (!sink_) + sink_ = sink; + RTC_DCHECK_EQ(sink_, sink); source_->AddOrUpdateSink(this, wants); } void ForwardingCapturedFrameTap::RemoveSink( diff --git a/test/scenario/video_frame_matcher.h b/test/scenario/video_frame_matcher.h index 20a0ccca8b..f7f62436ac 100644 --- a/test/scenario/video_frame_matcher.h +++ b/test/scenario/video_frame_matcher.h @@ -114,7 +114,7 @@ class ForwardingCapturedFrameTap Clock* const clock_; VideoFrameMatcher* const matcher_; rtc::VideoSourceInterface* const source_; - VideoSinkInterface* sink_; + VideoSinkInterface* sink_ = nullptr; int discarded_count_ = 0; };