mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
loop: improve update_timer
Handle NULL time as now when specifying an interval.
This commit is contained in:
parent
61885b00b6
commit
73ec9e2d24
2 changed files with 8 additions and 5 deletions
|
|
@ -505,8 +505,13 @@ loop_update_timer (SpaSource *source,
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
|
|
||||||
spa_zero (its);
|
spa_zero (its);
|
||||||
if (value)
|
if (value) {
|
||||||
its.it_value = *value;
|
its.it_value = *value;
|
||||||
|
}
|
||||||
|
else if (interval) {
|
||||||
|
its.it_value = *interval;
|
||||||
|
absolute = true;
|
||||||
|
}
|
||||||
if (interval)
|
if (interval)
|
||||||
its.it_interval = *interval;
|
its.it_interval = *interval;
|
||||||
if (absolute)
|
if (absolute)
|
||||||
|
|
|
||||||
|
|
@ -542,7 +542,7 @@ static void
|
||||||
handle_socket (PinosStream *stream, int rtfd)
|
handle_socket (PinosStream *stream, int rtfd)
|
||||||
{
|
{
|
||||||
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
PinosStreamImpl *impl = SPA_CONTAINER_OF (stream, PinosStreamImpl, this);
|
||||||
struct timespec interval, start;
|
struct timespec interval;
|
||||||
|
|
||||||
impl->rtfd = rtfd;
|
impl->rtfd = rtfd;
|
||||||
impl->rtsocket_source = pinos_loop_add_io (stream->context->loop,
|
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,
|
impl->timeout_source = pinos_loop_add_timer (stream->context->loop,
|
||||||
on_timeout,
|
on_timeout,
|
||||||
stream);
|
stream);
|
||||||
start.tv_sec = 0;
|
|
||||||
start.tv_nsec = 100000000;
|
|
||||||
interval.tv_sec = 0;
|
interval.tv_sec = 0;
|
||||||
interval.tv_nsec = 100000000;
|
interval.tv_nsec = 100000000;
|
||||||
pinos_loop_update_timer (stream->context->loop,
|
pinos_loop_update_timer (stream->context->loop,
|
||||||
impl->timeout_source,
|
impl->timeout_source,
|
||||||
&start,
|
NULL,
|
||||||
&interval,
|
&interval,
|
||||||
false);
|
false);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue