summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2015-06-18 12:30:24 +0200
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2015-08-14 19:27:06 +0200
commitc411819452524c281b58b531829aa3914de53ef2 (patch)
tree35a48631658902d6e7e376ba887ec04df036fc75 /gst-libs
parentea9b6a7e3c4eea512650adf530b7f1acb0eccd84 (diff)
downloadgstreamer-plugins-base-c411819452524c281b58b531829aa3914de53ef2.tar.gz
appsink: put the correct segment in the preroll sample
last_segment is only being updated in dequeue_buffer(), which is only called from _pull_sample(). _pull_preroll() simply re-uses an old or dummy segment while the actual one sits and waits in the queue. https://bugzilla.gnome.org/show_bug.cgi?id=751147
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/app/gstappsink.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gst-libs/gst/app/gstappsink.c b/gst-libs/gst/app/gstappsink.c
index dc8754fc1..c318e1b2f 100644
--- a/gst-libs/gst/app/gstappsink.c
+++ b/gst-libs/gst/app/gstappsink.c
@@ -86,6 +86,7 @@ struct _GstAppSinkPrivate
GstBuffer *preroll;
GstCaps *preroll_caps;
GstCaps *last_caps;
+ GstSegment preroll_segment;
GstSegment last_segment;
gboolean flushing;
gboolean unlock;
@@ -519,6 +520,7 @@ gst_app_sink_start (GstBaseSink * psink)
GST_DEBUG_OBJECT (appsink, "starting");
priv->flushing = FALSE;
priv->started = TRUE;
+ gst_segment_init (&priv->preroll_segment, GST_FORMAT_TIME);
gst_segment_init (&priv->last_segment, GST_FORMAT_TIME);
g_mutex_unlock (&priv->mutex);
@@ -569,6 +571,8 @@ gst_app_sink_event (GstBaseSink * sink, GstEvent * event)
g_mutex_lock (&priv->mutex);
GST_DEBUG_OBJECT (appsink, "receiving SEGMENT");
g_queue_push_tail (priv->queue, gst_event_ref (event));
+ if (!priv->preroll)
+ gst_event_copy_segment (event, &priv->preroll_segment);
g_mutex_unlock (&priv->mutex);
break;
case GST_EVENT_EOS:{
@@ -1140,7 +1144,7 @@ gst_app_sink_pull_preroll (GstAppSink * appsink)
g_cond_wait (&priv->cond, &priv->mutex);
}
sample =
- gst_sample_new (priv->preroll, priv->preroll_caps, &priv->last_segment,
+ gst_sample_new (priv->preroll, priv->preroll_caps, &priv->preroll_segment,
NULL);
GST_DEBUG_OBJECT (appsink, "we have the preroll sample %p", sample);
g_mutex_unlock (&priv->mutex);