gst: add 30 seconds timeout

Add a timeout to all blocking wait operations so that we don't wait
forever but error out after 30 seconds.
This commit is contained in:
Wim Taymans 2021-09-16 10:05:58 +02:00
parent d04244abb9
commit 803763ed01
4 changed files with 46 additions and 6 deletions

View file

@ -160,11 +160,15 @@ GstPipeWireCore *gst_pipewire_core_get (int fd)
static void do_sync(GstPipeWireCore * core)
{
struct timespec abstime;
core->pending_seq = pw_core_sync(core->core, 0, core->pending_seq);
pw_thread_loop_get_time (core->loop, &abstime,
GST_PIPEWIRE_DEFAULT_TIMEOUT * SPA_NSEC_PER_SEC);
while (true) {
if (core->last_seq == core->pending_seq || core->last_error < 0)
break;
pw_thread_loop_wait (core->loop);
if (pw_thread_loop_timed_wait_full (core->loop, &abstime) < 0)
break;
}
}