The values must be in milliseconds, not bytes.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -130,12 +130,12 @@ static int init_pic_rc(AVCodecContext *avctx, FFHWBaseEncodePicture *pic, · 129 unmodified lines | ||
| 130 | 130 | .consecutiveBFrameCount = FFMAX(ctx->base.b_per_p - 1, 0), |
| 131 | 131 | .temporalLayerCount = 0, |
| 132 | 132 | }; |
| 133 | − | |
| 134 | 133 | rc_info->pNext = &hp->vkrc_info; |
| 135 | − rc_info->virtualBufferSizeInMs = enc->unit_opts.hrd_buffer_size; | |
| 136 | − rc_info->initialVirtualBufferSizeInMs = enc->unit_opts.initial_buffer_fullness; | |
| 137 | 134 | |
| 138 | 135 | if (rc_info->rateControlMode > VK_VIDEO_ENCODE_RATE_CONTROL_MODE_DISABLED_BIT_KHR) { |
| 136 | + rc_info->virtualBufferSizeInMs = (enc->unit_opts.hrd_buffer_size * 1000LL) / avctx->bit_rate; | |
| 137 | + rc_info->initialVirtualBufferSizeInMs = (enc->unit_opts.initial_buffer_fullness * 1000LL) / avctx->bit_rate; | |
| 138 | + | |
| 139 | 139 | hp->vkrc_layer_info = (VkVideoEncodeH264RateControlLayerInfoKHR) { |
| 140 | 140 | .sType = VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_RATE_CONTROL_LAYER_INFO_KHR, |
| 141 | 141 | |