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 <mbonadei@webrtc.org>
Commit-Queue: Philip Eliasson <philipel@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#38254}
This commit is contained in:
philipel
2022-09-30 10:11:20 +02:00
committed by WebRTC LUCI CQ
parent 0c4563c0c4
commit 3f1150d94d

View File

@ -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([&]() {