diff options
author | Tim-Philipp Müller <tim@centricular.com> | 2015-09-11 23:36:47 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-09-15 10:20:37 +0100 |
commit | 8b96b52a62567d70ce827db00fd0f50f79133ee5 (patch) | |
tree | f2f9a5afd9c7e1288a737b2c4f3590727a2858e4 /gst-libs | |
parent | dab39bf42bdabdf239747e3227a99caf3274be23 (diff) |
videopool: ensure allocation alignment is consistent with video alignment requirements
Make sure GstAllocationParams alignment is not less than
any alignment requirement specified via GstVideoAlignment.
https://bugzilla.gnome.org/show_bug.cgi?id=754120
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/video/gstvideopool.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/gst-libs/gst/video/gstvideopool.c b/gst-libs/gst/video/gstvideopool.c index 4c98ddf85..62026e919 100644 --- a/gst-libs/gst/video/gstvideopool.c +++ b/gst-libs/gst/video/gstvideopool.c @@ -173,10 +173,29 @@ video_buffer_pool_set_config (GstBufferPool * pool, GstStructure * config) GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); if (priv->need_alignment && priv->add_videometa) { - /* get an apply the alignment to the info */ + guint max_align, n; + gst_buffer_pool_config_get_video_alignment (config, &priv->video_align); + + /* ensure GstAllocationParams alignment is compatible with video alignment */ + max_align = priv->params.align; + for (n = 0; n < GST_VIDEO_MAX_PLANES; ++n) + max_align |= priv->video_align.stride_align[n]; + + for (n = 0; n < GST_VIDEO_MAX_PLANES; ++n) + priv->video_align.stride_align[n] = max_align; + + /* apply the alignment to the info */ gst_video_info_align (&info, &priv->video_align); gst_buffer_pool_config_set_video_alignment (config, &priv->video_align); + + if (priv->params.align < max_align) { + GST_WARNING_OBJECT (pool, "allocation params alignment %u is smaller " + "than the max specified video stride alignment %u, fixing", + (guint) priv->params.align, max_align); + priv->params.align = max_align; + gst_buffer_pool_config_set_allocator (config, allocator, &priv->params); + } } priv->info = info; info.size = MAX (size, info.size); |