diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2014-11-20 09:41:43 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian@centricular.com> | 2014-11-20 11:27:34 +0100 |
commit | 1aa128091a64dfac73eb3459c4795f0a1c1e5e0b (patch) | |
tree | 5b97259b3378ae68dd716a6c3ba9ce96d9d22dca | |
parent | 95f34420a5575b2d55e7aab588f37296b9edb47b (diff) | |
download | gstreamer-plugins-bad-1aa128091a64dfac73eb3459c4795f0a1c1e5e0b.tar.gz |
vtdec: Fix divide by zero in the picture buffer length calculation
-rw-r--r-- | sys/applemedia/vtdec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c index 4aa26cf99..bcef530bd 100644 --- a/sys/applemedia/vtdec.c +++ b/sys/applemedia/vtdec.c @@ -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), |