From fba47d17e85862c0e26bdb75faa887e56ccd8af2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 13 Mar 2012 21:31:48 +0100 Subject: [PATCH] mp4vdepay: fix buffer handling Don't always output the payload subbuffer, use a separate variable to make things clearer and without the error. --- gst/rtp/gstrtpmp4vdepay.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gst/rtp/gstrtpmp4vdepay.c b/gst/rtp/gstrtpmp4vdepay.c index ac8eeec..59520f6 100644 --- a/gst/rtp/gstrtpmp4vdepay.c +++ b/gst/rtp/gstrtpmp4vdepay.c @@ -163,8 +163,9 @@ static GstBuffer * gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) { GstRtpMP4VDepay *rtpmp4vdepay; - GstBuffer *outbuf = NULL; + GstBuffer *pbuf, *outbuf = NULL; GstRTPBuffer rtp = { NULL }; + gboolean marker; rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload); @@ -173,23 +174,22 @@ gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_adapter_clear (rtpmp4vdepay->adapter); gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); - outbuf = gst_rtp_buffer_get_payload_buffer (&rtp); - gst_adapter_push (rtpmp4vdepay->adapter, outbuf); + pbuf = gst_rtp_buffer_get_payload_buffer (&rtp); + marker = gst_rtp_buffer_get_marker (&rtp); + gst_rtp_buffer_unmap (&rtp); + + gst_adapter_push (rtpmp4vdepay->adapter, pbuf); /* if this was the last packet of the VOP, create and push a buffer */ - if (gst_rtp_buffer_get_marker (&rtp)) { + if (marker) { guint avail; avail = gst_adapter_available (rtpmp4vdepay->adapter); - outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail); GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %" G_GSIZE_FORMAT, gst_buffer_get_size (outbuf)); } - - gst_rtp_buffer_unmap (&rtp); - return outbuf; } -- 2.7.4