From 3f1150d94d67102f7cb4d038c31037f8cb77647a Mon Sep 17 00:00:00 2001 From: philipel Date: Fri, 30 Sep 2022 10:11:20 +0200 Subject: [PATCH] In `video_replay`, destroy `call` on worker thread even if input validation fail. Early return will cause `call` to be destroyed outside the worker thread, which gives confusing error messages when all you did was type the wrong path to the input file :) Bug: webrtc:14508 Change-Id: I029910d8da4bc7b08dafd02cb5ebf88d9c7afa59 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/277443 Reviewed-by: Mirko Bonadei Commit-Queue: Philip Eliasson Cr-Commit-Position: refs/heads/main@{#38254} --- rtc_tools/video_replay.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/rtc_tools/video_replay.cc b/rtc_tools/video_replay.cc index 1a7bfadbca..6eb793d7f5 100644 --- a/rtc_tools/video_replay.cc +++ b/rtc_tools/video_replay.cc @@ -385,12 +385,10 @@ class RtpReplayer final { // Wait for streams creation. sync_event.Wait(/*give_up_after=*/TimeDelta::Seconds(10)); - if (stream_state == nullptr || rtp_reader == nullptr) { - return; + if (stream_state != nullptr && rtp_reader != nullptr) { + ReplayPackets(call.get(), rtp_reader.get(), worker_thread.get()); } - ReplayPackets(call.get(), rtp_reader.get(), worker_thread.get()); - // Destruction of streams and the call must happen on the same thread as // their creation. worker_thread->PostTask([&]() {