avidemux: push mode; handle 0-size data chunks

Fixes #618535.
This commit is contained in:
Mark Nauwelaerts 2010-07-22 11:46:35 +02:00
parent 38124ef5e5
commit f62c6ce5c8

View file

@ -4873,9 +4873,13 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
* through the whole file */ * through the whole file */
if (avi->abort_buffering) { if (avi->abort_buffering) {
avi->abort_buffering = FALSE; avi->abort_buffering = FALSE;
gst_adapter_flush (avi->adapter, 8); if (size) {
gst_adapter_flush (avi->adapter, 8);
return GST_FLOW_OK;
}
} else {
return GST_FLOW_OK;
} }
return GST_FLOW_OK;
} }
GST_DEBUG ("chunk ID %" GST_FOURCC_FORMAT ", size %u", GST_DEBUG ("chunk ID %" GST_FOURCC_FORMAT ", size %u",
GST_FOURCC_ARGS (tag), size); GST_FOURCC_ARGS (tag), size);
@ -4904,9 +4908,13 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
if (saw_desired_kf) { if (saw_desired_kf) {
gst_adapter_flush (avi->adapter, 8); gst_adapter_flush (avi->adapter, 8);
/* get buffer */ /* get buffer */
buf = gst_adapter_take_buffer (avi->adapter, GST_ROUND_UP_2 (size)); if (size) {
/* patch the size */ buf = gst_adapter_take_buffer (avi->adapter, GST_ROUND_UP_2 (size));
GST_BUFFER_SIZE (buf) = size; /* patch the size */
GST_BUFFER_SIZE (buf) = size;
} else {
buf = NULL;
}
} else { } else {
GST_DEBUG_OBJECT (avi, GST_DEBUG_OBJECT (avi,
"Desired keyframe not yet reached, flushing chunk"); "Desired keyframe not yet reached, flushing chunk");
@ -4980,6 +4988,7 @@ gst_avi_demux_stream_data (GstAviDemux * avi)
stream->discont = FALSE; stream->discont = FALSE;
} }
res = gst_pad_push (stream->pad, buf); res = gst_pad_push (stream->pad, buf);
buf = NULL;
/* combine flows */ /* combine flows */
res = gst_avi_demux_combine_flows (avi, stream, res); res = gst_avi_demux_combine_flows (avi, stream, res);