mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
tools: Set pipeline to PAUSED before waiting for main loop idle
When it is shutting down a pipeline after ctrl-c, set pipeline to paused before waiting for the main loop to complete all pending transactions. Fixes #584657. If some part of the pipeline is generating signals or idle functions at a fast rate, waiting for a main loop iteration may never return.
This commit is contained in:
parent
47d9904eba
commit
08fb55c2e1
1 changed files with 4 additions and 3 deletions
|
@ -861,13 +861,14 @@ main (int argc, char *argv[])
|
|||
g_print (_("Execution ended after %" G_GUINT64_FORMAT " ns.\n"), diff);
|
||||
}
|
||||
|
||||
/* iterate mainloop to process pending stuff */
|
||||
while (g_main_context_iteration (NULL, FALSE));
|
||||
|
||||
PRINT (_("Setting pipeline to PAUSED ...\n"));
|
||||
gst_element_set_state (pipeline, GST_STATE_PAUSED);
|
||||
if (caught_error == ELR_NO_ERROR)
|
||||
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
|
||||
|
||||
/* iterate mainloop to process pending stuff */
|
||||
while (g_main_context_iteration (NULL, FALSE));
|
||||
|
||||
PRINT (_("Setting pipeline to READY ...\n"));
|
||||
gst_element_set_state (pipeline, GST_STATE_READY);
|
||||
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
|
||||
|
|
Loading…
Reference in a new issue