From a7aa984d6752a47dec3add2bc1a36492a599efc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 25 Jun 2012 09:34:53 +0200 Subject: [PATCH] mpeg2dec: Set allocation parameters to guarantee 16-byte aligned output buffers Fixes bug #377713. --- ext/mpeg2dec/gstmpeg2dec.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/ext/mpeg2dec/gstmpeg2dec.c b/ext/mpeg2dec/gstmpeg2dec.c index 9a5b44719b..6417450d0c 100644 --- a/ext/mpeg2dec/gstmpeg2dec.c +++ b/ext/mpeg2dec/gstmpeg2dec.c @@ -246,6 +246,28 @@ gst_mpeg2dec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query) GstBufferPool *pool; guint size, min, max; GstStructure *config; + GstAllocator *allocator; + GstAllocationParams params; + gboolean update_allocator; + + /* Set allocation parameters to guarantee 16-byte aligned output buffers */ + if (gst_query_get_n_allocation_params (query) > 0) { + gst_query_parse_nth_allocation_param (query, 0, &allocator, ¶ms); + update_allocator = TRUE; + } else { + allocator = NULL; + gst_allocation_params_init (¶ms); + update_allocator = FALSE; + } + + params.align = MAX (params.align, 15); + + if (update_allocator) + gst_query_set_nth_allocation_param (query, 0, allocator, ¶ms); + else + gst_query_add_allocation_param (query, allocator, ¶ms); + if (allocator) + gst_allocator_unref (allocator); if (!GST_VIDEO_DECODER_CLASS (parent_class)->decide_allocation (decoder, query))