Deflake simulcast flow tests: stop fake source for reals.

The FakePeriodicVideoSource was not actually stopping its repeated
handle, which takes a raw pointer to the task queue. There could be a
race here where a repeated task was being posted at the same time as
the task queue was being destroyed due to the scoped safety flag being
tied to the repeated task rather than the task queue.

I'm still unable to repro locally, so this is a speculative fix.

# No need to wait for ios/android bots, all other bots green
NOTRY=True

Bug: webrtc:15018
Change-Id: Id6f9bda5f4fc641abc11068f5cf8aa0f1cf36d27
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/300264
Reviewed-by: Jeremy Leconte <jleconte@google.com>
Commit-Queue: Henrik Boström <hbos@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#39758}
This commit is contained in:
Henrik Boström 2023-04-04 15:35:54 +02:00 committed by WebRTC LUCI CQ
parent 31af34ba8c
commit 0a3ad1a561

View File

@ -49,14 +49,15 @@ class FakePeriodicVideoSource final
frame_source_.SetRotation(config.rotation);
TimeDelta frame_interval = TimeDelta::Millis(config.frame_interval_ms);
RepeatingTaskHandle::Start(task_queue_->Get(), [this, frame_interval] {
if (broadcaster_.wants().rotation_applied) {
broadcaster_.OnFrame(frame_source_.GetFrameRotationApplied());
} else {
broadcaster_.OnFrame(frame_source_.GetFrame());
}
return frame_interval;
});
repeating_task_handle_ =
RepeatingTaskHandle::Start(task_queue_->Get(), [this, frame_interval] {
if (broadcaster_.wants().rotation_applied) {
broadcaster_.OnFrame(frame_source_.GetFrameRotationApplied());
} else {
broadcaster_.OnFrame(frame_source_.GetFrame());
}
return frame_interval;
});
}
rtc::VideoSinkWants wants() const {
@ -81,6 +82,7 @@ class FakePeriodicVideoSource final
void Stop() {
RTC_DCHECK(task_queue_);
task_queue_->SendTask([&]() { repeating_task_handle_.Stop(); });
task_queue_.reset();
}
@ -93,6 +95,7 @@ class FakePeriodicVideoSource final
rtc::VideoSinkWants wants_ RTC_GUARDED_BY(&mutex_);
std::unique_ptr<TaskQueueForTest> task_queue_;
RepeatingTaskHandle repeating_task_handle_;
};
} // namespace webrtc