mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-29 07:12:36 +00:00
launch: improve EOS on shutdown handling
When the -e option is selected, also wait for EOS when the pipeline produced an error. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=630997
This commit is contained in:
parent
0bdd1224d3
commit
6e87803114
1 changed files with 30 additions and 11 deletions
|
@ -1099,18 +1099,37 @@ main (int argc, char *argv[])
|
||||||
|
|
||||||
tfthen = gst_util_get_timestamp ();
|
tfthen = gst_util_get_timestamp ();
|
||||||
caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
|
caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
|
||||||
if (eos_on_shutdown && caught_error == ELR_INTERRUPT) {
|
if (eos_on_shutdown && caught_error != ELR_NO_ERROR) {
|
||||||
PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n"));
|
gboolean ignore_errors;
|
||||||
waiting_eos = TRUE;
|
|
||||||
gst_element_send_event (pipeline, gst_event_new_eos ());
|
|
||||||
PRINT (_("Waiting for EOS...\n"));
|
|
||||||
caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
|
|
||||||
|
|
||||||
if (caught_error == ELR_NO_ERROR) {
|
waiting_eos = TRUE;
|
||||||
/* we got EOS */
|
if (caught_error == ELR_INTERRUPT) {
|
||||||
PRINT (_("EOS received - stopping pipeline...\n"));
|
PRINT (_("EOS on shutdown enabled -- Forcing EOS on the pipeline\n"));
|
||||||
} else if (caught_error == ELR_ERROR) {
|
gst_element_send_event (pipeline, gst_event_new_eos ());
|
||||||
PRINT (_("An error happened while waiting for EOS\n"));
|
ignore_errors = FALSE;
|
||||||
|
} else {
|
||||||
|
PRINT (_("EOS on shutdown enabled -- waiting for EOS after Error\n"));
|
||||||
|
ignore_errors = TRUE;
|
||||||
|
}
|
||||||
|
PRINT (_("Waiting for EOS...\n"));
|
||||||
|
|
||||||
|
while (TRUE) {
|
||||||
|
caught_error = event_loop (pipeline, TRUE, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
if (caught_error == ELR_NO_ERROR) {
|
||||||
|
/* we got EOS */
|
||||||
|
PRINT (_("EOS received - stopping pipeline...\n"));
|
||||||
|
break;
|
||||||
|
} else if (caught_error == ELR_INTERRUPT) {
|
||||||
|
PRINT (_
|
||||||
|
("Interrupt while waiting for EOS - stopping pipeline...\n"));
|
||||||
|
break;
|
||||||
|
} else if (caught_error == ELR_ERROR) {
|
||||||
|
if (!ignore_errors) {
|
||||||
|
PRINT (_("An error happened while waiting for EOS\n"));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
tfnow = gst_util_get_timestamp ();
|
tfnow = gst_util_get_timestamp ();
|
||||||
|
|
Loading…
Reference in a new issue