From fd6536b34af024852b333fa28159cf743b8e245e Mon Sep 17 00:00:00 2001 From: Romain Vimont Date: Sat, 11 Apr 2026 13:42:36 +0200 Subject: [PATCH] Fix incorrect assertion in recording It was assumed that the video packet immediately following a config packet was a non-config packet. This is not necessarily true: for example, if the capture is reset (due to resizing or rotation) before the first frame is produced. --- app/src/recorder.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/recorder.c b/app/src/recorder.c index 54971bca..531c7899 100644 --- a/app/src/recorder.c +++ b/app/src/recorder.c @@ -362,13 +362,12 @@ sc_recorder_process_packets(struct sc_recorder *recorder) { } if (pts_origin == AV_NOPTS_VALUE) { - if (!recorder->audio) { - assert(video_pkt); + if (!recorder->audio && video_pkt) { pts_origin = video_pkt->pts; - } else if (!recorder->video) { - assert(audio_pkt); + } else if (!recorder->video && audio_pkt) { pts_origin = audio_pkt->pts; - } else if (video_pkt && audio_pkt) { + } else if (recorder->video && recorder->audio && video_pkt + && audio_pkt) { pts_origin = MIN(video_pkt->pts, audio_pkt->pts); } else if (recorder->stopped) { if (video_pkt) {