From 04a6c661c82a29df0627519da678595f48aa8abd Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 18 Feb 2014 11:49:37 +0100 Subject: [PATCH] basesrc: in automatic_eos mode, don't modify the size Don't set the size to -1 in automatic_eos mode (which also updates the duration to -1). We only want automatic_eos mode influence the maxsize calculations without any side effects. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=724564 --- libs/gst/base/gstbasesrc.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index 878eced..0f63e5f 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -2321,16 +2321,18 @@ gst_base_src_update_length (GstBaseSrc * src, guint64 offset, guint * length, stop = src->segment.stop; /* get total file size */ size = src->segment.duration; - if (!g_atomic_int_get (&src->priv->automatic_eos)) - size = -1; /* only operate if we are working with bytes */ if (format != GST_FORMAT_BYTES) return TRUE; - /* the max amount of bytes to read is the total size or - * up to the segment.stop if present. */ - if (stop != -1) + /* when not doing automatic EOS, just use the stop position. We don't use + * the size to check for EOS */ + if (!g_atomic_int_get (&src->priv->automatic_eos)) + maxsize = stop; + /* Otherwise, the max amount of bytes to read is the total + * size or up to the segment.stop if present. */ + else if (stop != -1) maxsize = size != -1 ? MIN (size, stop) : stop; else maxsize = size; @@ -2368,8 +2370,8 @@ gst_base_src_update_length (GstBaseSrc * src, guint64 offset, guint * length, } } - /* keep track of current duration. - * segment is in bytes, we checked that above. */ + /* keep track of current duration. segment is in bytes, we checked + * that above. */ GST_OBJECT_LOCK (src); src->segment.duration = size; GST_OBJECT_UNLOCK (src); -- 2.7.4