summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2015-02-23 01:32:14 +1100
committerJan Schmidt <jan@centricular.com>2015-02-24 01:36:44 +1100
commitb3053925ac8b82fa4a29ab9782f43398b00ef372 (patch)
treee7c42da90140fce6b076e55e32cb249c331e830e
parentaf26201429644487c5383cd7b73e38dffde7cd4f (diff)
audiodecoder: Don't send pending events before decode
Make sure to update the output segment to track the segment we're decoding in, but don't actually push it downstream until after buffers are decoded. https://bugzilla.gnome.org/show_bug.cgi?id=744806
-rw-r--r--gst-libs/gst/audio/gstaudiodecoder.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c
index cb9c2abcd..8895c9f9f 100644
--- a/gst-libs/gst/audio/gstaudiodecoder.c
+++ b/gst-libs/gst/audio/gstaudiodecoder.c
@@ -1080,6 +1080,37 @@ send_pending_events (GstAudioDecoder * dec)
g_list_free (pending_events);
}
+/* Iterate the list of pending events, and ensure
+ * the current output segment is up to date for
+ * decoding */
+static void
+apply_pending_events (GstAudioDecoder * dec)
+{
+ GstAudioDecoderPrivate *priv = dec->priv;
+ GList *l;
+
+ GST_DEBUG_OBJECT (dec, "Applying pending segments");
+ for (l = priv->pending_events; l; l = l->next) {
+ GstEvent *event = GST_EVENT (l->data);
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_SEGMENT:{
+ GstSegment seg;
+
+ GST_AUDIO_DECODER_STREAM_LOCK (dec);
+ gst_event_copy_segment (event, &seg);
+
+ GST_DEBUG_OBJECT (dec, "starting segment %" GST_SEGMENT_FORMAT, &seg);
+
+ dec->output_segment = seg;
+ GST_AUDIO_DECODER_STREAM_UNLOCK (dec);
+ break;
+ }
+ default:
+ break;
+ }
+ }
+}
+
static GstFlowReturn
check_pending_reconfigure (GstAudioDecoder * dec)
{
@@ -1467,9 +1498,10 @@ gst_audio_decoder_drain (GstAudioDecoder * dec)
if (dec->priv->drained && !dec->priv->gather)
return GST_FLOW_OK;
- /* Send any pending events before draining, as that
+ /* Apply any pending events before draining, as that
* may update the pending segment info */
- send_pending_events (dec);
+ apply_pending_events (dec);
+
/* dispatch reverse pending buffers */
/* chain eventually calls upon drain as well, but by that time
* gather list should be clear, so ok ... */