pulse-server: add a pulse.idle.timeout option

When a client is not sending any data when it should be and causes an
underrun, mark it as idle and record the timestamp.

When a client is idle for pulse.idle.timeout seconds, set the stream
as inactive. When more data is received, set it back to active.

Add a pulse.idle.timeout option to set a global server default or
a per-stream value. Set the server default to 5 seconds. A value of 0
can be used to disable this feature.

With this change, badly behaving clients that are not sending any data
will be paused so that the sinks can suspend to save battery power.

Fixes #2839
This commit is contained in:
Wim Taymans 2022-11-20 16:13:22 +01:00
parent b1c0662a00
commit a0adb52124
6 changed files with 42 additions and 0 deletions

View file

@ -82,6 +82,7 @@ struct stream {
uint64_t playing_for;
uint64_t ticks_base;
uint64_t timestamp;
uint64_t idle_time;
int64_t delay;
uint32_t last_quantum;
@ -93,6 +94,7 @@ struct stream {
struct spa_fraction default_frag;
struct spa_fraction default_tlength;
struct spa_fraction min_quantum;
uint32_t idle_timeout_sec;
struct sample_spec ss;
struct channel_map map;
@ -115,6 +117,7 @@ struct stream {
unsigned int in_prebuf:1;
unsigned int killed:1;
unsigned int pending:1;
unsigned int is_idle:1;
unsigned int is_paused:1;
};