diff options
author | Seungha Yang <sh.yang@lge.com> | 2016-12-03 21:42:30 +0900 |
---|---|---|
committer | Edward Hervey <bilboed@bilboed.com> | 2016-12-08 16:59:07 +0100 |
commit | 4fcbcf4e4880717fc3cb4099fdfa634c26c5b977 (patch) | |
tree | ea5de8f3c09a729448daad9b33cf6de44d243820 | |
parent | f4d6aa71672f8f29fe2800ffb1473a7f16f823d9 (diff) |
decodebin3: Send custom-eos event to notify drained state
Likewise how urisourcebin is doing, use custom event if other streams
are still alive.
https://bugzilla.gnome.org/show_bug.cgi?id=773341
-rw-r--r-- | gst/playback/gstdecodebin3-parse.c | 32 | ||||
-rw-r--r-- | gst/playback/gstdecodebin3.c | 23 |
2 files changed, 37 insertions, 18 deletions
diff --git a/gst/playback/gstdecodebin3-parse.c b/gst/playback/gstdecodebin3-parse.c index 9797be6d7..df558f94d 100644 --- a/gst/playback/gstdecodebin3-parse.c +++ b/gst/playback/gstdecodebin3-parse.c @@ -247,32 +247,28 @@ parse_chain_output_probe (GstPad * pad, GstPadProbeInfo * info, } break; case GST_EVENT_EOS: - /* FIXME : Make sure this makes sense ... */ - if (TRUE) { + input->saw_eos = TRUE; + if (all_inputs_are_eos (input->dbin)) { GST_DEBUG_OBJECT (pad, "real input pad, marking as EOS"); - input->saw_eos = TRUE; check_all_streams_for_eos (input->dbin); - ret = GST_PAD_PROBE_DROP; } else { - MultiQueueSlot *slot; + GstPad *peer = gst_pad_get_peer (input->srcpad); + if (peer) { + /* Send custom-eos event to multiqueue slot */ + GstStructure *s; + GstEvent *event; - g_mutex_lock (&input->dbin->selection_lock); - slot = get_slot_for_input (input->dbin, input); - g_mutex_unlock (&input->dbin->selection_lock); - - slot->drain_eos = input->drain_eos; - - if (input->drain_eos) { GST_DEBUG_OBJECT (pad, - "Got EOS at end of input stream (drain_eos:%d) Dropping.", - input->drain_eos); - ret = GST_PAD_PROBE_DROP; + "Got EOS end of input stream, post custom-eos"); + s = gst_structure_new_empty ("decodebin3-custom-eos"); + event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM, s); + gst_pad_send_event (peer, event); + gst_object_unref (peer); } else { - GST_DEBUG_OBJECT (pad, - "Got EOS at end of input stream (drain_eos:%d) Passing.", - input->drain_eos); + GST_FIXME_OBJECT (pad, "No peer, what should we do ?"); } } + ret = GST_PAD_PROBE_DROP; break; case GST_EVENT_FLUSH_STOP: GST_DEBUG_OBJECT (pad, "Clear saw_eos flag"); diff --git a/gst/playback/gstdecodebin3.c b/gst/playback/gstdecodebin3.c index ea46ed187..4ada16034 100644 --- a/gst/playback/gstdecodebin3.c +++ b/gst/playback/gstdecodebin3.c @@ -319,6 +319,8 @@ typedef struct _MultiQueueSlot gboolean drain_eos; + gboolean is_drained; + DecodebinOutputStream *output; } MultiQueueSlot; @@ -1431,6 +1433,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info, "Got a STREAM_START event without a GstStream"); break; } + slot->is_drained = FALSE; stream_id = gst_stream_get_stream_id (stream); GST_DEBUG_OBJECT (pad, "Stream Start '%s'", stream_id); if (slot->active_stream == NULL) { @@ -1490,6 +1493,7 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info, /* FIXME : Figure out */ GST_FIXME_OBJECT (pad, "EOS on multiqueue source pad. input:%p", slot->input); + slot->is_drained = TRUE; if (slot->input == NULL) { GstPad *peer; GST_DEBUG_OBJECT (pad, @@ -1514,6 +1518,25 @@ multiqueue_src_probe (GstPad * pad, GstPadProbeInfo * info, ret = GST_PAD_PROBE_HANDLED; } break; + case GST_EVENT_CUSTOM_DOWNSTREAM: + if (gst_event_has_name (ev, "decodebin3-custom-eos")) { + slot->is_drained = TRUE; + SELECTION_LOCK (dbin); + if (slot->input == NULL) { + GST_DEBUG_OBJECT (pad, + "Got custom-eos from null input stream, remove output stream"); + /* Remove the output */ + if (slot->output) { + DecodebinOutputStream *output = slot->output; + dbin->output_streams = + g_list_remove (dbin->output_streams, output); + free_output_stream (dbin, output); + } + } + SELECTION_UNLOCK (dbin); + ret = GST_PAD_PROBE_DROP; + } + break; default: break; } |