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 15:09:21 +0200
commit3cb028d1aed8986ceab7a468dbb578df0af466c8 (patch)
treef4fa92ca28cf9bd742696ca123b003a4596d14ff
parent122fce883ab0fc09207aa084c134bf45dcc7400f (diff)
downloadgst-libav-3cb028d1aed8986ceab7a468dbb578df0af466c8.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 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);