summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-01 17:39:04 +0200
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>2017-08-24 13:04:22 +0200
commit1e0db9f9a8e82d2209877352ddad0f0932c17a61 (patch)
treee85445734842a9e6a8d8b28d407fca11c53f30aa
parente691ec2d391f906f7d6a0c7abfb9c0702b18fda6 (diff)
vaapivideobufferpool: don't shift by negative since it's undefined
The function g_bit_nth_lsf() may return -1 if the request bit position is not avaible. Thus, this patch check if the return value is not -1 in order to continue.
-rw-r--r--gst/vaapi/gstvaapivideobufferpool.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/gst/vaapi/gstvaapivideobufferpool.c b/gst/vaapi/gstvaapivideobufferpool.c
index 2782403a..73ebf829 100644
--- a/gst/vaapi/gstvaapivideobufferpool.c
+++ b/gst/vaapi/gstvaapivideobufferpool.c
@@ -107,11 +107,14 @@ fill_video_alignment (GstVaapiVideoBufferPool * pool, GstVideoAlignment * align)
{
GstVideoInfo *const vip = &pool->priv->alloc_info;
guint i;
+ gint nth_bit;
gst_video_alignment_reset (align);
- for (i = 0; i < GST_VIDEO_INFO_N_PLANES (vip); i++)
- align->stride_align[i] =
- (1U << g_bit_nth_lsf (GST_VIDEO_INFO_PLANE_STRIDE (vip, i), 0)) - 1;
+ for (i = 0; i < GST_VIDEO_INFO_N_PLANES (vip); i++) {
+ nth_bit = g_bit_nth_lsf (GST_VIDEO_INFO_PLANE_STRIDE (vip, i), 0);
+ if (nth_bit >= 0)
+ align->stride_align[i] = (1U << nth_bit) - 1;
+ }
}
static const gchar **