mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
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
This commit is contained in:
parent
f4d6aa7167
commit
4fcbcf4e48
2 changed files with 37 additions and 18 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue