Commit 5df8cc5e authored by Sebastian Dröge's avatar Sebastian Dröge 🍵

avviddec: Make sure to use a buffer pool with the correct width/height...

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 <>
parent 839a72f9
......@@ -1416,6 +1416,16 @@ gst_ffmpegviddec_video_frame (GstFFMpegVidDec * ffmpegdec,
*ret = get_output_buffer (ffmpegdec, out_frame);
gst_buffer_unref (tmp);
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));
gst_object_unref (pool);
if (G_UNLIKELY (*ret != GST_FLOW_OK))
......@@ -1886,7 +1896,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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment