loop: improve update_timer

Handle NULL time as now when specifying an interval.
This commit is contained in:
Wim Taymans 2017-03-30 09:18:26 +02:00
parent 61885b00b6
commit 73ec9e2d24
2 changed files with 8 additions and 5 deletions

View file

@ -505,8 +505,13 @@ loop_update_timer (SpaSource *source,
int flags = 0;
spa_zero (its);
if (value)
if (value) {
its.it_value = *value;
}
else if (interval) {
its.it_value = *interval;
absolute = true;
}
if (interval)
its.it_interval = *interval;
if (absolute)

View file

@ -542,7 +542,7 @@ static void
handle_socket (PinosStream *stream, int rtfd)
{
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
struct timespec interval, start;
struct timespec interval;
impl->rtfd = rtfd;
impl->rtsocket_source = pinos_loop_add_io (stream->context->loop,
@ -555,13 +555,11 @@ handle_socket (PinosStream *stream, int rtfd)
impl->timeout_source = pinos_loop_add_timer (stream->context->loop,
on_timeout,
stream);
start.tv_sec = 0;
start.tv_nsec = 100000000;
interval.tv_sec = 0;
interval.tv_nsec = 100000000;
pinos_loop_update_timer (stream->context->loop,
impl->timeout_source,
&start,
NULL,
&interval,
false);
return;