Commit fba47d17 authored by Wim Taymans's avatar Wim Taymans
Browse files

mp4vdepay: fix buffer handling

Don't always output the payload subbuffer, use a separate variable to
make things clearer and without the error.
parent 84c96e23
...@@ -163,8 +163,9 @@ static GstBuffer * ...@@ -163,8 +163,9 @@ static GstBuffer *
gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
{ {
GstRtpMP4VDepay *rtpmp4vdepay; GstRtpMP4VDepay *rtpmp4vdepay;
GstBuffer *outbuf = NULL; GstBuffer *pbuf, *outbuf = NULL;
GstRTPBuffer rtp = { NULL }; GstRTPBuffer rtp = { NULL };
gboolean marker;
rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload); rtpmp4vdepay = GST_RTP_MP4V_DEPAY (depayload);
...@@ -173,23 +174,22 @@ gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf) ...@@ -173,23 +174,22 @@ gst_rtp_mp4v_depay_process (GstRTPBaseDepayload * depayload, GstBuffer * buf)
gst_adapter_clear (rtpmp4vdepay->adapter); gst_adapter_clear (rtpmp4vdepay->adapter);
gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp); gst_rtp_buffer_map (buf, GST_MAP_READ, &rtp);
outbuf = gst_rtp_buffer_get_payload_buffer (&rtp); pbuf = gst_rtp_buffer_get_payload_buffer (&rtp);
gst_adapter_push (rtpmp4vdepay->adapter, outbuf); 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 this was the last packet of the VOP, create and push a buffer */
if (gst_rtp_buffer_get_marker (&rtp)) { if (marker) {
guint avail; guint avail;
avail = gst_adapter_available (rtpmp4vdepay->adapter); avail = gst_adapter_available (rtpmp4vdepay->adapter);
outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail); outbuf = gst_adapter_take_buffer (rtpmp4vdepay->adapter, avail);
GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %" GST_DEBUG ("gst_rtp_mp4v_depay_chain: pushing buffer of size %"
G_GSIZE_FORMAT, gst_buffer_get_size (outbuf)); G_GSIZE_FORMAT, gst_buffer_get_size (outbuf));
} }
gst_rtp_buffer_unmap (&rtp);
return outbuf; return outbuf;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment