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:
Sreerenj Balachandran 2015-05-28 10:52:48 +03:00
parent 4d8eaf1918
commit 619058b5b7

View file

@ -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;
}