Commit 4fcbcf4e authored by Seungha Yang's avatar Seungha Yang Committed by Edward Hervey

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
parent f4d6aa71
......@@ -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");
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment