summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian@centricular.com>2015-11-30 19:01:41 +0200
committerSebastian Dröge <sebastian@centricular.com>2015-12-01 12:34:27 +0200
commit5df8cc5e381ac55e2171a281e79d0d55dec5abc0 (patch)
tree0a322a4c8df5ddb56f7dc71d5d75395bf1a5df03
parent839a72f92ca23de39d31aa36839f85a9fb7d6356 (diff)
downloadgst-libav-5df8cc5e381ac55e2171a281e79d0d55dec5abc0.tar.gz
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 <nicolas.dufresne@collabora.com> https://bugzilla.gnome.org/show_bug.cgi?id=758344
-rw-r--r--ext/libav/gstavviddec.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/ext/libav/gstavviddec.c b/ext/libav/gstavviddec.c
index 6bcb363..c6ed9a5 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))
@@ -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);