From 8ba3df0939e5eb1b8718b37d8f4ea08b4c85afeb Mon Sep 17 00:00:00 2001 From: Carl-Anton Ingmarsson Date: Sat, 3 Oct 2009 14:30:41 +0200 Subject: [PATCH] vdpaumpegdec: check for sink element returning wrong buffer type --- sys/vdpau/gstvdpmpegdec.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/sys/vdpau/gstvdpmpegdec.c b/sys/vdpau/gstvdpmpegdec.c index c2b5182533..ca05b2f22b 100644 --- a/sys/vdpau/gstvdpmpegdec.c +++ b/sys/vdpau/gstvdpmpegdec.c @@ -299,11 +299,14 @@ gst_vdp_mpeg_dec_alloc_buffer (GstVdpMpegDec * mpeg_dec, GstBuffer ** outbuf) { GstFlowReturn ret; - ret = gst_pad_alloc_buffer_and_set_caps (mpeg_dec->src, 0, 0, - GST_PAD_CAPS (mpeg_dec->src), outbuf); + ret = gst_pad_alloc_buffer (mpeg_dec->src, 0, 0, GST_PAD_CAPS (mpeg_dec->src), + outbuf); if (ret != GST_FLOW_OK) return ret; + if (!GST_IS_VDP_VIDEO_BUFFER (*outbuf)) + goto wrong_buffer; + if (!mpeg_dec->device) { GstVdpDevice *device; VdpStatus status; @@ -323,6 +326,12 @@ gst_vdp_mpeg_dec_alloc_buffer (GstVdpMpegDec * mpeg_dec, GstBuffer ** outbuf) } return ret; + +wrong_buffer: + { + gst_buffer_unref (*outbuf); + return GST_FLOW_NOT_LINKED; + } } static GstFlowReturn