diff --git a/gst-libs/gst/audio/gstaudiodecoder.c b/gst-libs/gst/audio/gstaudiodecoder.c index 36ba2a82c5..ba2ee47118 100644 --- a/gst-libs/gst/audio/gstaudiodecoder.c +++ b/gst-libs/gst/audio/gstaudiodecoder.c @@ -2156,6 +2156,18 @@ gst_audio_decoder_sink_eventfunc (GstAudioDecoder * dec, GstEvent * event) ret = gst_audio_decoder_push_event (dec, event); break; + case GST_EVENT_SEGMENT_DONE: + GST_AUDIO_DECODER_STREAM_LOCK (dec); + gst_audio_decoder_drain (dec); + GST_AUDIO_DECODER_STREAM_UNLOCK (dec); + + /* Forward SEGMENT_DONE because no buffer or serialized event might come after + * SEGMENT_DONE and nothing could trigger another _finish_frame() call. */ + if (dec->priv->pending_events) + send_pending_events (dec); + ret = gst_audio_decoder_push_event (dec, event); + break; + case GST_EVENT_EOS: GST_AUDIO_DECODER_STREAM_LOCK (dec); gst_audio_decoder_drain (dec); diff --git a/gst-libs/gst/video/gstvideodecoder.c b/gst-libs/gst/video/gstvideodecoder.c index 3f30656079..05a57cb837 100644 --- a/gst-libs/gst/video/gstvideodecoder.c +++ b/gst-libs/gst/video/gstvideodecoder.c @@ -1071,6 +1071,25 @@ gst_video_decoder_sink_event_default (GstVideoDecoder * decoder, event = NULL; break; } + case GST_EVENT_SEGMENT_DONE: + { + GstFlowReturn flow_ret = GST_FLOW_OK; + + flow_ret = gst_video_decoder_drain_out (decoder, TRUE); + ret = (flow_ret == GST_FLOW_OK); + + /* Forward SEGMENT_DONE immediately. This is required + * because no buffer or serialized event might come + * after SEGMENT_DONE and nothing could trigger another + * _finish_frame() call. + * + * The subclass can override this behaviour by overriding + * the ::sink_event() vfunc and not chaining up to the + * parent class' ::sink_event() until a later time. + */ + forward_immediate = TRUE; + break; + } case GST_EVENT_EOS: { GstFlowReturn flow_ret = GST_FLOW_OK;