summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-02-18 11:49:37 +0100
committerWim Taymans <wtaymans@redhat.com>2014-02-18 11:57:49 +0100
commit04a6c661c82a29df0627519da678595f48aa8abd (patch)
treef569a59daf4b90029f33099738284c73942099f3 /libs
parenta2742a575bd2af56fa093fd2dec8ce30b4fe6668 (diff)
downloadgstreamer-04a6c661c82a29df0627519da678595f48aa8abd.tar.gz
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
Diffstat (limited to 'libs')
-rw-r--r--libs/gst/base/gstbasesrc.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c
index 878ecedbc1..0f63e5fbee 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);