aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAraz Iusubov <primeadvice@gmail.com>2024-10-28 18:21:05 +0100
committerDmitrii Ovchinnikov <ovchinnikov.dmitrii@gmail.com>2024-11-07 15:11:10 +0100
commitf63f1641255a8fb25bf40c775905fbf29e15eebb (patch)
tree7bff679920c49a96791dd308e7399138af0cb6da
parent4047b887fc44b110bccb1da09bcb79d6e454b88b (diff)
downloadffmpeg-f63f1641255a8fb25bf40c775905fbf29e15eebb.tar.gz
avcodec/amfenc: GOP size check
Fix for the error with an invalid GOP size parameter.
-rw-r--r--libavcodec/amfenc_av1.c4
-rw-r--r--libavcodec/amfenc_h264.c4
-rw-r--r--libavcodec/amfenc_hevc.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/libavcodec/amfenc_av1.c b/libavcodec/amfenc_av1.c
index 79b982e0d2..01b1f85747 100644
--- a/libavcodec/amfenc_av1.c
+++ b/libavcodec/amfenc_av1.c
@@ -276,7 +276,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
// Picture control properties
- AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size);
+ if (avctx->gop_size != -1) {
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size);
+ }
// Setup header insertion mode only if this option was defined explicitly
if (ctx->header_insertion_mode != -1) {
diff --git a/libavcodec/amfenc_h264.c b/libavcodec/amfenc_h264.c
index 07aa9deb40..e01da06aa6 100644
--- a/libavcodec/amfenc_h264.c
+++ b/libavcodec/amfenc_h264.c
@@ -517,7 +517,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_DE_BLOCKING_FILTER, !!deblocking_filter);
// Keyframe Interval
- AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, avctx->gop_size);
+ if (avctx->gop_size != -1) {
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, avctx->gop_size);
+ }
// Header Insertion Spacing
if (ctx->header_spacing >= 0)
diff --git a/libavcodec/amfenc_hevc.c b/libavcodec/amfenc_hevc.c
index f633677574..248581bd33 100644
--- a/libavcodec/amfenc_hevc.c
+++ b/libavcodec/amfenc_hevc.c
@@ -261,7 +261,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
// Picture control properties
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
- AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
+ if (avctx->gop_size != -1) {
+ AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
+ }
if (avctx->slices > 1) {
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME, avctx->slices);
}