summaryrefslogtreecommitdiffstats
path: root/sys/vdpau
diff options
context:
space:
mode:
authorCarl-Anton Ingmarsson <ca.ingmarsson@gmail.com>2009-04-04 22:45:09 +0200
committerJan Schmidt <thaytan@noraisin.net>2009-06-20 15:21:25 +0100
commit74485f6fa28ac3413ca5533f7bee695ab7670b47 (patch)
tree354e9374273ee2f2dab0fac2f110c68af2006b9c /sys/vdpau
parent17a758ec7129976fa910b6ca0d8fd3d19c815158 (diff)
downloadgst-plugins-bad-74485f6fa28ac3413ca5533f7bee695ab7670b47.tar.gz
gst-plugins-bad-74485f6fa28ac3413ca5533f7bee695ab7670b47.tar.bz2
gst-plugins-bad-74485f6fa28ac3413ca5533f7bee695ab7670b47.zip
vdpau: VideoYUV unref buffer in chain so that we don't leak them MpegDecoder parse sequence headers
Diffstat (limited to 'sys/vdpau')
-rw-r--r--sys/vdpau/gstvdpaumpegdecoder.c28
-rw-r--r--sys/vdpau/gstvdpauvideoyuv.c6
2 files changed, 30 insertions, 4 deletions
diff --git a/sys/vdpau/gstvdpaumpegdecoder.c b/sys/vdpau/gstvdpaumpegdecoder.c
index 36b546ac..1910652c 100644
--- a/sys/vdpau/gstvdpaumpegdecoder.c
+++ b/sys/vdpau/gstvdpaumpegdecoder.c
@@ -141,6 +141,7 @@ gst_vdpau_mpeg_decoder_decode (GstVdpauMpegDecoder * mpeg_dec)
GstVdpauDevice *device;
VdpBitstreamBuffer vbit[1];
VdpStatus status;
+ GstFlowReturn ret;
dec = GST_VDPAU_DECODER (mpeg_dec);
@@ -178,14 +179,16 @@ gst_vdpau_mpeg_decoder_decode (GstVdpauMpegDecoder * mpeg_dec)
gst_buffer_ref (GST_BUFFER (outbuf));
+ ret = gst_vdpau_decoder_push_video_buffer (GST_VDPAU_DECODER (mpeg_dec),
+ outbuf);
+
if (mpeg_dec->vdp_info.forward_reference != VDP_INVALID_HANDLE)
gst_buffer_unref (mpeg_dec->f_buffer);
mpeg_dec->vdp_info.forward_reference = surface;
mpeg_dec->f_buffer = GST_BUFFER (outbuf);
- return gst_vdpau_decoder_push_video_buffer (GST_VDPAU_DECODER (mpeg_dec),
- outbuf);
+ return ret;
}
static gboolean
@@ -216,6 +219,26 @@ gst_vdpau_mpeg_decoder_parse_picture_coding (GstVdpauMpegDecoder * mpeg_dec,
}
static gboolean
+gst_vdpau_mpeg_decoder_parse_sequence (GstVdpauMpegDecoder * mpeg_dec,
+ guint8 * data, guint8 * end)
+{
+ GstVdpauDecoder *dec;
+ MPEGSeqHdr hdr;
+
+ dec = GST_VDPAU_DECODER (mpeg_dec);
+
+ if (!mpeg_util_parse_sequence_hdr (&hdr, data, end))
+ return FALSE;
+
+ memcpy (&mpeg_dec->vdp_info.intra_quantizer_matrix,
+ &hdr.intra_quantizer_matrix, 64);
+ memcpy (&mpeg_dec->vdp_info.non_intra_quantizer_matrix,
+ &hdr.non_intra_quantizer_matrix, 64);
+
+ return TRUE;
+}
+
+static gboolean
gst_vdpau_mpeg_decoder_parse_picture (GstVdpauMpegDecoder * mpeg_dec,
guint8 * data, guint8 * end)
{
@@ -320,6 +343,7 @@ gst_vdpau_mpeg_decoder_chain (GstPad * pad, GstBuffer * buffer)
break;
case MPEG_PACKET_SEQUENCE:
GST_DEBUG_OBJECT (mpeg_dec, "MPEG_PACKET_SEQUENCE");
+ gst_vdpau_mpeg_decoder_parse_sequence (mpeg_dec, data, end);
break;
case MPEG_PACKET_EXTENSION:
GST_DEBUG_OBJECT (mpeg_dec, "MPEG_PACKET_EXTENSION");
diff --git a/sys/vdpau/gstvdpauvideoyuv.c b/sys/vdpau/gstvdpauvideoyuv.c
index b9be10c1..ca1ec803 100644
--- a/sys/vdpau/gstvdpauvideoyuv.c
+++ b/sys/vdpau/gstvdpauvideoyuv.c
@@ -123,7 +123,7 @@ gst_vdpau_video_yuv_chain (GstPad * pad, GstBuffer * buffer)
("Couldn't get data from vdpau"),
("Error returned from vdpau was: %s",
device->vdp_get_error_string (status)));
- return GST_FLOW_ERROR;
+ break;
}
break;
}
@@ -159,7 +159,7 @@ gst_vdpau_video_yuv_chain (GstPad * pad, GstBuffer * buffer)
("Couldn't get data from vdpau"),
("Error returned from vdpau was: %s",
device->vdp_get_error_string (status)));
- return GST_FLOW_ERROR;
+ break;
}
break;
}
@@ -167,6 +167,8 @@ gst_vdpau_video_yuv_chain (GstPad * pad, GstBuffer * buffer)
break;
}
+ gst_buffer_unref (buffer);
+
if (outbuf) {
gst_buffer_copy_metadata (outbuf, buffer, GST_BUFFER_COPY_TIMESTAMPS);