diff --git i/audio/out/ao_pipewire.c w/audio/out/ao_pipewire.c index 67942da83b..0190120fc0 100644 --- i/audio/out/ao_pipewire.c +++ w/audio/out/ao_pipewire.c @@ -199,8 +199,7 @@ static int init(struct ao *ao) uint8_t buffer[1024]; struct spa_pod_builder b = SPA_POD_BUILDER_INIT(buffer, sizeof(buffer)); const struct spa_pod *params[1]; - char latency_str[64]; - char samplerate_str[8]; + struct pw_properties *props; enum spa_audio_format spa_format = af_fmt_to_pw(ao->format); if (spa_format == SPA_AUDIO_FORMAT_UNKNOWN) { @@ -228,8 +227,6 @@ static int init(struct ao *ao) } ao->device_buffer = p->buffer_samples; - snprintf(latency_str, sizeof(latency_str), "%d/%d", ao->device_buffer, ao->samplerate); - snprintf(samplerate_str, sizeof(samplerate_str), "%d", ao->samplerate); pw_init(NULL, NULL); @@ -239,27 +236,31 @@ static int init(struct ao *ao) p->stream = pw_stream_new_simple( pw_thread_loop_get_loop(p->loop), - "audio-src", - pw_properties_new( + "Playback Stream", + props = pw_properties_new( PW_KEY_MEDIA_TYPE, "Audio", PW_KEY_MEDIA_CATEGORY, "Playback", - PW_KEY_MEDIA_ROLE, "Music", - PW_KEY_NODE_NAME, ao->client_name, + PW_KEY_MEDIA_ROLE, "Movie", PW_KEY_APP_NAME, ao->client_name, PW_KEY_APP_ID, ao->client_name, PW_KEY_APP_ICON_NAME, ao->client_name, - PW_KEY_NODE_LATENCY, latency_str, - PW_KEY_AUDIO_RATE, samplerate_str, + PW_KEY_NODE_ALWAYS_PROCESS, "true", NULL), &stream_events, ao); if (p->stream == NULL) goto error; + pw_properties_set(props, PW_KEY_NODE_NAME, ao->client_name); + pw_properties_set(props, PW_KEY_NODE_DESCRIPTION, ao->client_name); + pw_properties_setf(props, PW_KEY_NODE_LATENCY, "%u/%u", ao->device_buffer, ao->samplerate); + pw_properties_setf(props, PW_KEY_NODE_RATE, "1/%u", ao->samplerate); + if (pw_stream_connect(p->stream, PW_DIRECTION_OUTPUT, PW_ID_ANY, PW_STREAM_FLAG_AUTOCONNECT | + PW_STREAM_FLAG_INACTIVE | PW_STREAM_FLAG_MAP_BUFFERS | PW_STREAM_FLAG_RT_PROCESS, params, 1) < 0)