examples: exit early when no longer running

When we are no longer running after the eventfd was signaled, stop
producing samples.
This commit is contained in:
Wim Taymans 2025-05-30 12:17:41 +02:00
parent fecf1bcba4
commit 50fe63ea76

View file

@ -89,6 +89,8 @@ static void push_samples(void *userdata, float *samples, uint32_t n_samples)
/* no space.. block and wait for free space */ /* no space.. block and wait for free space */
spa_system_eventfd_read(data->loop->system, data->eventfd, &count); spa_system_eventfd_read(data->loop->system, data->eventfd, &count);
if (!data->running)
return;
} }
if (avail > n_samples) if (avail > n_samples)
avail = n_samples; avail = n_samples;