mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-28 11:55:39 +00:00
encoder: hevc: Fix the size over-flow for encoded buffer.
The approximation of 6 times compression ratio migh not work in all cases. Especially when enabling I frames. Provide large enough size for coded-buffer creation.
This commit is contained in:
parent
4d8eaf1918
commit
619058b5b7
1 changed files with 3 additions and 3 deletions
|
@ -2274,9 +2274,9 @@ set_context_info (GstVaapiEncoder * base_encoder)
|
|||
base_encoder->num_ref_frames =
|
||||
((encoder->num_bframes ? 2 : 1) + DEFAULT_SURFACES_COUNT);
|
||||
|
||||
/* Take an approximation of 6 times compression ratio */
|
||||
base_encoder->codedbuf_size = ((GST_ROUND_UP_32 (vip->width) *
|
||||
GST_ROUND_UP_32 (vip->height) * 12 / 6)) / 8;
|
||||
/* Only YUV 4:2:0 formats are supported for now. */
|
||||
base_encoder->codedbuf_size += GST_ROUND_UP_32 (vip->width) *
|
||||
GST_ROUND_UP_32 (vip->height) * 3 / 2;
|
||||
|
||||
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue