mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-02 09:01:50 -05:00
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:
parent
b1c0662a00
commit
a0adb52124
6 changed files with 42 additions and 0 deletions
|
|
@ -64,6 +64,7 @@ struct stream *stream_new(struct client *client, enum stream_type type, uint32_t
|
|||
{
|
||||
int res;
|
||||
struct defs *defs = &client->impl->defs;
|
||||
const char *str;
|
||||
|
||||
struct stream *stream = calloc(1, sizeof(*stream));
|
||||
if (stream == NULL)
|
||||
|
|
@ -90,6 +91,9 @@ struct stream *stream_new(struct client *client, enum stream_type type, uint32_t
|
|||
parse_frac(client->props, "pulse.default.req", &defs->default_req, &stream->default_req);
|
||||
parse_frac(client->props, "pulse.default.frag", &defs->default_frag, &stream->default_frag);
|
||||
parse_frac(client->props, "pulse.default.tlength", &defs->default_tlength, &stream->default_tlength);
|
||||
stream->idle_timeout_sec = defs->idle_timeout;
|
||||
if ((str = pw_properties_get(client->props, "pulse.idle.timeout")) != NULL)
|
||||
spa_atou32(str, &stream->idle_timeout_sec, 0);
|
||||
|
||||
switch (type) {
|
||||
case STREAM_TYPE_RECORD:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue