vtdec: Fix divide by zero in the picture buffer length calculation

This commit is contained in:
Sebastian Dröge 2014-11-20 09:41:43 +01:00
parent 47f3a1954e
commit 6e2e8ec0ac

View file

@ -726,8 +726,8 @@ compute_h264_decode_picture_buffer_length (GstVtdec * vtdec,
int dpb_mb_size = 16;
int max_dpb_size_frames = 16;
int max_dpb_mb_s = -1;
int width_in_mb_s = vtdec->video_info.width / dpb_mb_size;
int height_in_mb_s = vtdec->video_info.height / dpb_mb_size;
int width_in_mb_s = GST_ROUND_UP_16 (vtdec->video_info.width) / dpb_mb_size;
int height_in_mb_s = GST_ROUND_UP_16 (vtdec->video_info.height) / dpb_mb_size;
*length = 0;
@ -735,6 +735,9 @@ compute_h264_decode_picture_buffer_length (GstVtdec * vtdec,
&profile, &level))
return FALSE;
if (vtdec->video_info.width == 0 || vtdec->video_info.height == 0)
return FALSE;
max_dpb_mb_s = get_dpb_max_mb_s_from_level (vtdec, level);
if (max_dpb_mb_s == -1) {
GST_ELEMENT_ERROR (vtdec, STREAM, DECODE, (NULL),