asfdemux: set DISCONT on streams

When we receive a DISCONT as input, don't clear our complete state but simply
mark a discont that will be put on the next buffer. The code will be able to
handle and throw away incomplete data.
Add some more debug info.
Remove an unused variable.
This commit is contained in:
Wim Taymans 2009-06-22 17:16:58 +02:00
parent c53fd9ded1
commit 36d0450d6e
2 changed files with 18 additions and 4 deletions

View file

@ -412,9 +412,10 @@ gst_asf_demux_reset_stream_state_after_discont (GstASFDemux * demux)
{
guint n;
demux->pts = 0; //why?
gst_adapter_clear (demux->adapter);
GST_DEBUG_OBJECT (demux, "reset stream state");
for (n = 0; n < demux->num_streams; n++) {
gst_buffer_replace (&demux->stream[n].payload, NULL);
gst_buffer_replace (&demux->stream[n].cache, NULL);
@ -437,6 +438,17 @@ gst_asf_demux_reset_stream_state_after_discont (GstASFDemux * demux)
}
}
static void
gst_asf_demux_mark_discont (GstASFDemux * demux)
{
guint n;
GST_DEBUG_OBJECT (demux, "Mark stream discont");
for (n = 0; n < demux->num_streams; n++)
demux->stream[n].discont = TRUE;
}
/* do a seek in push based mode */
static gboolean
gst_asf_demux_handle_seek_push (GstASFDemux * demux, GstEvent * event)
@ -1252,6 +1264,7 @@ gst_asf_demux_push_complete_payloads (GstASFDemux * demux, gboolean force)
}
if (stream->discont) {
GST_DEBUG_OBJECT (stream->pad, "marking DISCONT on stream");
GST_BUFFER_FLAG_SET (payload->buf, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
}
@ -1420,8 +1433,10 @@ gst_asf_demux_chain (GstPad * pad, GstBuffer * buf)
GST_TIME_FORMAT, GST_BUFFER_SIZE (buf), GST_BUFFER_OFFSET (buf),
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
if (GST_BUFFER_IS_DISCONT (buf))
gst_asf_demux_reset_stream_state_after_discont (demux);
if (GST_BUFFER_IS_DISCONT (buf)) {
GST_DEBUG_OBJECT (demux, "received DISCONT");
gst_asf_demux_mark_discont (demux);
}
if (!GST_CLOCK_TIME_IS_VALID (demux->in_gap) &&
GST_BUFFER_TIMESTAMP_IS_VALID (buf)) {

View file

@ -161,7 +161,6 @@ struct _GstASFDemux {
guint64 play_time;
guint64 preroll;
guint64 pts;
gboolean seekable;
gboolean broadcast;