pulse-server: keep track of dont_inhibit_auto_suspend

Keep the flag dont_inhibit_auto_suspend around and use it do decide when
to send suspend messages to the client.

We don't always want to send suspend messages when the stream state changes
because that could happen because the stream was, for example, relinked.

The intention of the suspend message is mostly for monitor streams that
use the dont-inhibit flag and want to follow the suspend state of the
sink.

See #5273
This commit is contained in:
Wim Taymans 2026-05-25 18:13:12 +02:00
parent 3b3b896b4f
commit e0d7b37826
2 changed files with 7 additions and 4 deletions

View file

@ -1179,16 +1179,16 @@ static void stream_state_changed(void *data, enum pw_stream_state old,
break;
}
/* Don't emit suspended if we are creating a corked stream, as that will have a quick
* RUNNING/SUSPENDED transition for initial negotiation */
/* Only emit suspended if we are created and not a corked stream, this means the
* paused on our stream needs to be caused by the sink suspend or an unlink. */
if (stream->create_tag == SPA_ID_INVALID && !stream->corked) {
if (old == PW_STREAM_STATE_PAUSED && state == PW_STREAM_STATE_STREAMING &&
stream->is_suspended) {
stream->dont_inhibit_auto_suspend && stream->is_suspended) {
stream_send_suspended(stream, false);
stream->is_suspended = false;
}
if (old == PW_STREAM_STATE_STREAMING && state == PW_STREAM_STATE_PAUSED &&
!stream->is_suspended) {
stream->dont_inhibit_auto_suspend && !stream->is_suspended) {
if (stream->fail_on_suspend) {
stream->killed = true;
destroy_stream = true;
@ -1804,6 +1804,7 @@ static int do_create_playback_stream(struct client *client, uint32_t command, ui
stream->is_underrun = true;
stream->underrun_for = -1;
stream->fail_on_suspend = fail_on_suspend;
stream->dont_inhibit_auto_suspend = dont_inhibit_auto_suspend;
pw_properties_set(props, "pulse.corked", corked ? "true" : "false");
@ -2082,6 +2083,7 @@ static int do_create_record_stream(struct client *client, uint32_t command, uint
stream->muted = muted;
stream->muted_set = muted_set;
stream->fail_on_suspend = fail_on_suspend;
stream->dont_inhibit_auto_suspend = dont_inhibit_auto_suspend;
if (client->quirks & QUIRK_REMOVE_CAPTURE_DONT_MOVE)
no_move = false;

View file

@ -102,6 +102,7 @@ struct stream {
unsigned int is_paused:1;
unsigned int fail_on_suspend:1;
unsigned int is_suspended:1;
unsigned int dont_inhibit_auto_suspend:1;
};
struct stream *stream_new(struct client *client, enum stream_type type, uint32_t create_tag,