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
This commit is contained in:
Wim Taymans 2014-02-18 11:49:37 +01:00
parent a2742a575b
commit 04a6c661c8

View file

@ -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);