Fix for tsan failue in real time scenario tests.

The sink is only added once, but before this fix, the value was
updated to the same value, causing a tsan failure. This CL adds
a check so we don't update the value if it's set.

Bug: webrtc:10909
Change-Id: I46c8f7044f1441c0155b18881d1b8e0aeb7568c6
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/150783
Reviewed-by: Åsa Persson <asapersson@webrtc.org>
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28999}
This commit is contained in:
Sebastian Jansson
2019-08-28 20:49:55 +02:00
committed by Commit Bot
parent 6dcd4dc56a
commit 7fa42778b4
2 changed files with 4 additions and 2 deletions

View File

@ -158,7 +158,9 @@ void ForwardingCapturedFrameTap::OnDiscardedFrame() {
void ForwardingCapturedFrameTap::AddOrUpdateSink(
VideoSinkInterface<VideoFrame>* sink,
const rtc::VideoSinkWants& wants) {
sink_ = sink;
if (!sink_)
sink_ = sink;
RTC_DCHECK_EQ(sink_, sink);
source_->AddOrUpdateSink(this, wants);
}
void ForwardingCapturedFrameTap::RemoveSink(

View File

@ -114,7 +114,7 @@ class ForwardingCapturedFrameTap
Clock* const clock_;
VideoFrameMatcher* const matcher_;
rtc::VideoSourceInterface<VideoFrame>* const source_;
VideoSinkInterface<VideoFrame>* sink_;
VideoSinkInterface<VideoFrame>* sink_ = nullptr;
int discarded_count_ = 0;
};