spa: reuse code to clear the timers

We have set_timeout and enable_flush_timer functions to disable the
timers so use those.
This commit is contained in:
Wim Taymans 2023-03-24 17:55:15 +01:00
parent 78b8e1af57
commit 3698593481
7 changed files with 12 additions and 51 deletions

View file

@ -761,15 +761,10 @@ static int do_remove_source(struct spa_loop *loop,
void *user_data)
{
struct impl *this = user_data;
struct itimerspec ts;
if (this->timer_source.loop)
spa_loop_remove_source(this->data_loop, &this->timer_source);
ts.it_value.tv_sec = 0;
ts.it_value.tv_nsec = 0;
ts.it_interval.tv_sec = 0;
ts.it_interval.tv_nsec = 0;
spa_system_timerfd_settime(this->data_system, this->timerfd, 0, &ts, NULL);
set_timeout(this, 0);
return 0;
}