diff --git a/plugins/obs-ffmpeg/texture-amf.cpp b/plugins/obs-ffmpeg/texture-amf.cpp index b2eaddf94bbd51..58b19be65b5df8 100644 --- a/plugins/obs-ffmpeg/texture-amf.cpp +++ b/plugins/obs-ffmpeg/texture-amf.cpp @@ -1720,8 +1720,8 @@ static void amf_avc_create_internal(amf_base *enc, obs_data_t *settings) amf_int64 b_max = 0; if (get_avc_property(enc, B_PIC_PATTERN, &b_frames) && - get_avc_property(enc, MAX_CONSECUTIVE_BPICTURES, &b_max)) { - enc->dts_offset = b_frames + 1; + get_avc_property(enc, MAX_CONSECUTIVE_BPICTURES, &b_max) && b_frames > 0) { + enc->dts_offset = std::min(b_frames, b_max) + 1; } else { enc->dts_offset = 0; } @@ -2543,18 +2543,6 @@ static void amf_av1_create_internal(amf_base *enc, obs_data_t *settings) if (res == AMF_OK && p.type == AMF_VARIANT_INTERFACE) { enc->header = AMFBufferPtr(p.pInterface); } - - if (enc->bframes_supported) { - amf_int64 b_frames = 0; - amf_int64 b_max = 0; - - if (get_av1_property(enc, B_PIC_PATTERN, &b_frames) && - get_av1_property(enc, MAX_CONSECUTIVE_BPICTURES, &b_max)) { - enc->dts_offset = b_frames + 1; - } else { - enc->dts_offset = 0; - } - } } static void *amf_av1_create_texencode(obs_data_t *settings, obs_encoder_t *encoder)