From 9a26c252114737779849ef868327711c70f27742 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 10 Jun 2024 13:11:19 +0300 Subject: [PATCH] av1enc: Handle force-keyunit events properly by requesting keyframes Part-of: --- subprojects/gst-plugins-bad/ext/aom/gstav1enc.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/subprojects/gst-plugins-bad/ext/aom/gstav1enc.c b/subprojects/gst-plugins-bad/ext/aom/gstav1enc.c index dd68d8bcd3..1c58c719f0 100644 --- a/subprojects/gst-plugins-bad/ext/aom/gstav1enc.c +++ b/subprojects/gst-plugins-bad/ext/aom/gstav1enc.c @@ -1009,6 +1009,12 @@ gst_av1_enc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame) duration = 1; } + if (GST_VIDEO_CODEC_FRAME_IS_FORCE_KEYFRAME (frame)) { + GST_DEBUG_OBJECT (av1enc, "Forcing keyframe for frame %u", + frame->system_frame_number); + flags |= AOM_EFLAG_FORCE_KF; + } + if (aom_codec_encode (&av1enc->encoder, &raw, scaled_pts, duration, flags) != AOM_CODEC_OK) { gst_av1_codec_error (&av1enc->encoder, "Failed to encode frame");