diff --git a/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp b/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp index 808a66cf0d5..1387c6a07c1 100644 --- a/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp +++ b/src/gallium/drivers/d3d12/d3d12_video_enc_h264.cpp @@ -718,6 +718,8 @@ d3d12_video_encoder_update_h264_gop_configuration(struct d3d12_video_encoder *pD // So in that case, derive an artificial log2_max_pic_order_cnt_lsb_minus4 // to avoid unexpected wrapping if (picture->seq.pic_order_cnt_type == 2u) { + if (GOPLength == 0) // Use max frame num to wrap on infinite GOPs + GOPLength = 1 << (picture->seq.log2_max_frame_num_minus4 + 4); const uint32_t max_pic_order_cnt_lsb = 2 * GOPLength; picture->seq.log2_max_pic_order_cnt_lsb_minus4 = std::max(0.0, std::ceil(std::log2(max_pic_order_cnt_lsb)) - 4); assert(picture->seq.log2_max_pic_order_cnt_lsb_minus4 < UCHAR_MAX);