From b2d9da0b4b19a22dd5a54df78f2dc77af41ce083 Mon Sep 17 00:00:00 2001 From: Megamouse Date: Wed, 15 Nov 2023 22:58:06 +0100 Subject: [PATCH] recording: Fix flush. We want to clear the whole queue... --- rpcs3/util/media_utils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpcs3/util/media_utils.cpp b/rpcs3/util/media_utils.cpp index 5fea74cbea..52f7ec8b1e 100644 --- a/rpcs3/util/media_utils.cpp +++ b/rpcs3/util/media_utils.cpp @@ -1190,6 +1190,8 @@ namespace utils m_frames_to_encode.pop_front(); m_mtx.unlock(); + got_frame = true; + // Calculate presentation timestamp. const s64 pts = get_pts(frame_data.timestamp_ms); @@ -1202,8 +1204,6 @@ namespace utils { media_log.trace("video_encoder: adding new frame. timestamp=%d", frame_data.timestamp_ms); - got_frame = true; - if (int err = av_frame_make_writable(av.video.frame); err < 0) { media_log.error("video_encoder: av_frame_make_writable failed. Error: %d='%s'", err, av_error_to_string(err)); @@ -1276,6 +1276,8 @@ namespace utils m_samples_to_encode.pop_front(); m_audio_mtx.unlock(); + got_sample = true; + if (sample_data.channels != av.audio.frame->ch_layout.nb_channels) { fmt::throw_exception("video_encoder: Audio sample channel count %d does not match frame channel count %d", sample_data.channels, av.audio.frame->ch_layout.nb_channels); @@ -1303,7 +1305,6 @@ namespace utils } audio_samples_sample_count = 0; - got_sample = true; if (int err = av_frame_make_writable(av.audio.frame); err < 0) {