From 3cb028d1aed8986ceab7a468dbb578df0af466c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 30 Nov 2015 19:01:41 +0200 Subject: avviddec: Make sure to use a buffer pool with the correct width/height configured on it for pushing buffers downstream If downstream does not provide a (usable) pool, we would use our internal pool. But the internal pool might be configured with a different width/height because of padding, which then will cause problems if we push buffers from it directly downstream. Instead create a new pool if the width/height is different. This prevents crashes with vaapisink and d3dvideosink for example. Based on the debugging results and discussions with Nicolas Dufresne https://bugzilla.gnome.org/show_bug.cgi?id=758344 --- ext/libav/gstavviddec.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c index 5497409..8c606ff 100644 --- a/ext/libav/gstavviddec.c +++ b/ext/libav/gstavviddec.c @@ -1416,6 +1416,16 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec, *ret = get_output_buffer (ffmpegdec, out_frame); gst_buffer_unref (tmp); } +#ifndef G_DISABLE_ASSERT + else { + GstVideoMeta *vmeta = gst_buffer_get_video_meta (out_frame->output_buffer); + if (vmeta) { + GstVideoInfo *info = &ffmpegdec->output_state->info; + g_assert (vmeta->width == GST_VIDEO_INFO_WIDTH (info)); + g_assert (vmeta->height == GST_VIDEO_INFO_HEIGHT (info)); + } + } +#endif gst_object_unref (pool); if (G_UNLIKELY (*ret != GST_FLOW_OK)) @@ -1881,7 +1891,9 @@ gst_ffmpegviddec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query) } } - if (have_videometa && ffmpegdec->internal_pool) { + if (have_videometa && ffmpegdec->internal_pool + && ffmpegdec->pool_width == state->info.width + && ffmpegdec->pool_height == state->info.height) { update_pool = TRUE; gst_object_unref (pool); pool = gst_object_ref (ffmpegdec->internal_pool); -- cgit v1.2.1