mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
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:
parent
af26201429
commit
b3053925ac
1 changed files with 34 additions and 2 deletions
|
@ -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 ... */
|
||||||
|
|
Loading…
Reference in a new issue