diff options
author | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2009-04-27 22:39:15 +0200 |
---|---|---|
committer | Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk> | 2009-05-03 14:46:58 +0200 |
commit | 9bbacae78f5750825bd79ec332c0ff0105552c0f (patch) | |
tree | c748a08bc9ef3d3d4800dfc93a7509f26cdf3375 | |
parent | 94cd09363a400d19c30ecae75af5a06eb73e3362 (diff) | |
download | gstreamer-plugins-bad-9bbacae78f5750825bd79ec332c0ff0105552c0f.tar.gz |
baseparse: fix (regression in) newsegment handling
(aacparse, amrparse, flacparse). Fixes #580133.
-rw-r--r-- | gst/aacparse/gstbaseparse.c | 24 | ||||
-rw-r--r-- | gst/amrparse/gstbaseparse.c | 24 | ||||
-rw-r--r-- | gst/flacparse/gstbaseparse.c | 18 |
3 files changed, 24 insertions, 42 deletions
diff --git a/gst/aacparse/gstbaseparse.c b/gst/aacparse/gstbaseparse.c index 3c322709f..3224f445e 100644 --- a/gst/aacparse/gstbaseparse.c +++ b/gst/aacparse/gstbaseparse.c @@ -206,7 +206,6 @@ struct _GstBaseParsePrivate gboolean flushing; gint64 offset; - gint64 pending_offset; GList *pending_events; @@ -547,7 +546,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) { gdouble rate, applied_rate; GstFormat format; - gint64 start, stop, pos; + gint64 start, stop, pos, offset = 0; gboolean update; gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, @@ -559,7 +558,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) /* stop time is allowed to be open-ended, but not start & pos */ seg_stop = GST_CLOCK_TIME_NONE; - parse->priv->pending_offset = pos; + offset = pos; if (gst_base_parse_bytepos_to_time (parse, start, &seg_start) && gst_base_parse_bytepos_to_time (parse, pos, &seg_pos)) { @@ -600,6 +599,12 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) gst_event_replace (eventp, event); gst_event_unref (event); handled = TRUE; + + /* but finish the current segment */ + GST_DEBUG_OBJECT (parse, "draining current segment"); + gst_base_parse_drain (parse); + gst_adapter_clear (parse->adapter); + parse->priv->offset = offset; break; } @@ -873,19 +878,6 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); bclass = GST_BASE_PARSE_GET_CLASS (parse); - if (G_UNLIKELY (parse->pending_segment)) { - parse->priv->offset = parse->priv->pending_offset; - - /* Make sure that adapter doesn't have any old data after - newsegment has been pushed */ - - /* FIXME: when non-flushing seek occurs, chain is still processing the - data from old segment. If this processing loop is then interrupted - (e.g. paused), chain function exists and next time it gets called - all this old data gets lost and playback continues from new segment */ - gst_adapter_clear (parse->adapter); - } - if (G_LIKELY (buffer)) { GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld", GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); diff --git a/gst/amrparse/gstbaseparse.c b/gst/amrparse/gstbaseparse.c index 00e2d7f82..7483c2b98 100644 --- a/gst/amrparse/gstbaseparse.c +++ b/gst/amrparse/gstbaseparse.c @@ -206,7 +206,6 @@ struct _GstBaseParsePrivate gboolean flushing; gint64 offset; - gint64 pending_offset; GList *pending_events; @@ -547,7 +546,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) { gdouble rate, applied_rate; GstFormat format; - gint64 start, stop, pos; + gint64 start, stop, pos, offset = 0; gboolean update; gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, @@ -559,7 +558,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) /* stop time is allowed to be open-ended, but not start & pos */ seg_stop = GST_CLOCK_TIME_NONE; - parse->priv->pending_offset = pos; + offset = pos; if (gst_base_parse_bytepos_to_time (parse, start, &seg_start) && gst_base_parse_bytepos_to_time (parse, pos, &seg_pos)) { @@ -600,6 +599,12 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) gst_event_replace (eventp, event); gst_event_unref (event); handled = TRUE; + + /* but finish the current segment */ + GST_DEBUG_OBJECT (parse, "draining current segment"); + gst_base_parse_drain (parse); + gst_adapter_clear (parse->adapter); + parse->priv->offset = offset; break; } @@ -873,19 +878,6 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); bclass = GST_BASE_PARSE_GET_CLASS (parse); - if (G_UNLIKELY (parse->pending_segment)) { - parse->priv->offset = parse->priv->pending_offset; - - /* Make sure that adapter doesn't have any old data after - newsegment has been pushed */ - - /* FIXME: when non-flushing seek occurs, chain is still processing the - data from old segment. If this processing loop is then interrupted - (e.g. paused), chain function exists and next time it gets called - all this old data gets lost and playback continues from new segment */ - gst_adapter_clear (parse->adapter); - } - if (G_LIKELY (buffer)) { GST_LOG_OBJECT (parse, "buffer size: %d, offset = %lld", GST_BUFFER_SIZE (buffer), GST_BUFFER_OFFSET (buffer)); diff --git a/gst/flacparse/gstbaseparse.c b/gst/flacparse/gstbaseparse.c index 23cd8a9ab..066fe517f 100644 --- a/gst/flacparse/gstbaseparse.c +++ b/gst/flacparse/gstbaseparse.c @@ -200,7 +200,6 @@ struct _GstBaseParsePrivate gboolean flushing; gint64 offset; - gint64 pending_offset; GList *pending_events; @@ -540,7 +539,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) { gdouble rate, applied_rate; GstFormat format; - gint64 start, stop, pos; + gint64 start, stop, pos, offset = 0; gboolean update; gst_event_parse_new_segment_full (event, &update, &rate, &applied_rate, @@ -552,7 +551,7 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) /* stop time is allowed to be open-ended, but not start & pos */ seg_stop = GST_CLOCK_TIME_NONE; - parse->priv->pending_offset = pos; + offset = pos; if (gst_base_parse_bytepos_to_time (parse, start, &seg_start) && gst_base_parse_bytepos_to_time (parse, pos, &seg_pos)) { @@ -593,6 +592,12 @@ gst_base_parse_sink_eventfunc (GstBaseParse * parse, GstEvent * event) gst_event_replace (eventp, event); gst_event_unref (event); handled = TRUE; + + /* but finish the current segment */ + GST_DEBUG_OBJECT (parse, "draining current segment"); + gst_base_parse_drain (parse); + gst_adapter_clear (parse->priv->adapter); + parse->priv->offset = offset; break; } @@ -980,13 +985,6 @@ gst_base_parse_chain (GstPad * pad, GstBuffer * buffer) parse = GST_BASE_PARSE (GST_OBJECT_PARENT (pad)); bclass = GST_BASE_PARSE_GET_CLASS (parse); - /* Make sure that adapter doesn't have any old data after - newsegment has been received and update our offset */ - if (G_UNLIKELY (parse->pending_segment)) { - parse->priv->offset = parse->priv->pending_offset; - gst_adapter_clear (parse->priv->adapter); - } - gst_base_parse_update_upstream_durations (parse); if (G_LIKELY (buffer)) { |