Skip to content

Commit f63f164

Browse files
HotactioncopOvchinnikovDmitrii
authored andcommitted
avcodec/amfenc: GOP size check
Fix for the error with an invalid GOP size parameter.
1 parent 4047b88 commit f63f164

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

libavcodec/amfenc_av1.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
276276
}
277277

278278
// Picture control properties
279-
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size);
279+
if (avctx->gop_size != -1) {
280+
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_AV1_GOP_SIZE, avctx->gop_size);
281+
}
280282

281283
// Setup header insertion mode only if this option was defined explicitly
282284
if (ctx->header_insertion_mode != -1) {

libavcodec/amfenc_h264.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
517517
AMF_ASSIGN_PROPERTY_BOOL(res, ctx->encoder, AMF_VIDEO_ENCODER_DE_BLOCKING_FILTER, !!deblocking_filter);
518518

519519
// Keyframe Interval
520-
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, avctx->gop_size);
520+
if (avctx->gop_size != -1) {
521+
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_IDR_PERIOD, avctx->gop_size);
522+
}
521523

522524
// Header Insertion Spacing
523525
if (ctx->header_spacing >= 0)

libavcodec/amfenc_hevc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
261261

262262
// Picture control properties
263263
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_NUM_GOPS_PER_IDR, ctx->gops_per_idr);
264-
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
264+
if (avctx->gop_size != -1) {
265+
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_GOP_SIZE, avctx->gop_size);
266+
}
265267
if (avctx->slices > 1) {
266268
AMF_ASSIGN_PROPERTY_INT64(res, ctx->encoder, AMF_VIDEO_ENCODER_HEVC_SLICES_PER_FRAME, avctx->slices);
267269
}

0 commit comments

Comments
 (0)