hlsdemux: Do not push last buffer after error

In decryption scenario, a buffer is always stored to be sent later
to wait for more data or EOS to be able to strip the final bytes
if requested. In case an error hapenned this buffer can be ignored
and not pushed downstream.
This commit is contained in:
Thiago Santos 2014-04-29 18:15:05 -03:00
parent bb8887baa7
commit 940576244c

View file

@ -951,6 +951,7 @@ _src_event (GstPad * pad, GstObject * parent, GstEvent * event)
gst_adapter_clear (demux->adapter);
/* pending buffer is only used for encrypted streams */
if (demux->last_ret == GST_FLOW_OK) {
if (demux->pending_buffer) {
GstMapInfo info;
gsize unpadded_size;
@ -962,12 +963,16 @@ _src_event (GstPad * pad, GstObject * parent, GstEvent * event)
gst_buffer_resize (demux->pending_buffer, 0, unpadded_size);
/* TODO check return */
demux->download_total_time +=
g_get_monotonic_time () - demux->download_start_time;
demux->download_total_bytes +=
gst_buffer_get_size (demux->pending_buffer);
gst_pad_push (demux->srcpad, demux->pending_buffer);
demux->last_ret = gst_pad_push (demux->srcpad, demux->pending_buffer);
demux->pending_buffer = NULL;
}
} else {
gst_buffer_unref (demux->pending_buffer);
demux->pending_buffer = NULL;
}