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
This commit is contained in:
Jan Schmidt 2015-02-23 01:32:14 +11:00
parent af26201429
commit b3053925ac

View file

@ -1080,6 +1080,37 @@ send_pending_events (GstAudioDecoder * dec)
g_list_free (pending_events); 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 static GstFlowReturn
check_pending_reconfigure (GstAudioDecoder * dec) check_pending_reconfigure (GstAudioDecoder * dec)
{ {
@ -1467,9 +1498,10 @@ gst_audio_decoder_drain (GstAudioDecoder * dec)
if (dec->priv->drained && !dec->priv->gather) if (dec->priv->drained && !dec->priv->gather)
return GST_FLOW_OK; 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 */ * may update the pending segment info */
send_pending_events (dec); apply_pending_events (dec);
/* dispatch reverse pending buffers */ /* dispatch reverse pending buffers */
/* chain eventually calls upon drain as well, but by that time /* chain eventually calls upon drain as well, but by that time
* gather list should be clear, so ok ... */ * gather list should be clear, so ok ... */