From 36d0450d6e662aff64e1b8cecb570706b49aa7fe Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 22 Jun 2009 17:16:58 +0200 Subject: [PATCH] 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. --- gst/asfdemux/gstasfdemux.c | 21 ++++++++++++++++++--- gst/asfdemux/gstasfdemux.h | 1 - 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index 102a8cae1a..e1babf493c 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -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)) { diff --git a/gst/asfdemux/gstasfdemux.h b/gst/asfdemux/gstasfdemux.h index f6b7fbcd74..18d38ef7a1 100644 --- a/gst/asfdemux/gstasfdemux.h +++ b/gst/asfdemux/gstasfdemux.h @@ -161,7 +161,6 @@ struct _GstASFDemux { guint64 play_time; guint64 preroll; - guint64 pts; gboolean seekable; gboolean broadcast;