diff options
author | François Laignel <fengalin@free.fr> | 2018-01-19 18:40:53 +0100 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2018-02-10 13:37:27 +0100 |
commit | ec7d81f67c844f692113d756db2bd328f92bd554 (patch) | |
tree | 7581256d1e04466e9ec3cd6107e80196d86d3a84 | |
parent | 1f792ab89de96f5073b2152c120bf3eeeb029567 (diff) |
decodebin3: high cpu usage after eos
After eos, decodebin3 enters a loop sending eos events which causes high cpu usage.
https://bugzilla.gnome.org/show_bug.cgi?id=792693
-rw-r--r-- | gst/playback/gstdecodebin3.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/gst/playback/gstdecodebin3.c b/gst/playback/gstdecodebin3.c index adbc52728..3a6164539 100644 --- a/gst/playback/gstdecodebin3.c +++ b/gst/playback/gstdecodebin3.c @@ -1585,7 +1585,10 @@ check_all_slot_for_eos (GstDecodebin3 * dbin) /* Send EOS to all slots */ if (peer) { - GstEvent *stream_start = + GstStructure *s; + GstEvent *stream_start, *eos; + + stream_start = gst_pad_get_sticky_event (input->srcpad, GST_EVENT_STREAM_START, 0); /* First forward a custom STREAM_START event to reset the EOS status (if any) */ @@ -1598,7 +1601,12 @@ check_all_slot_for_eos (GstDecodebin3 * dbin) G_TYPE_BOOLEAN, TRUE, NULL); gst_pad_send_event (peer, custom_stream_start); } - gst_pad_send_event (peer, gst_event_new_eos ()); + + eos = gst_event_new_eos (); + s = gst_event_writable_structure (eos); + gst_structure_set (s, "decodebin3-custom-final-eos", G_TYPE_BOOLEAN, + TRUE, NULL); + gst_pad_send_event (peer, eos); gst_object_unref (peer); } else GST_DEBUG_OBJECT (dbin, "no output"); @@ -1754,8 +1762,14 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info, free_multiqueue_slot_async (dbin, slot); ret = GST_PAD_PROBE_REMOVE; - } else if (!was_drained) { - GST_DEBUG_OBJECT (pad, "What happens with event ?"); + } else if (s + && gst_structure_has_field (s, "decodebin3-custom-final-eos")) { + GST_DEBUG_OBJECT (pad, "Got final eos, propagating downstream"); + } else { + GST_DEBUG_OBJECT (pad, "Got regular eos (all_inputs_are_eos)"); + /* drop current event as eos will be sent in check_all_slot_for_eos + * when all output streams are also eos */ + ret = GST_PAD_PROBE_DROP; SELECTION_LOCK (dbin); check_all_slot_for_eos (dbin); SELECTION_UNLOCK (dbin); |