Skip to content

ao_pipewire: feature notify pulseaudio of mpv's pid#17966

Draft
LurkAndLoiter wants to merge 1 commit into
mpv-player:masterfrom
LurkAndLoiter:mpv_application_process_id
Draft

ao_pipewire: feature notify pulseaudio of mpv's pid#17966
LurkAndLoiter wants to merge 1 commit into
mpv-player:masterfrom
LurkAndLoiter:mpv_application_process_id

Conversation

@LurkAndLoiter
Copy link
Copy Markdown

@LurkAndLoiter LurkAndLoiter commented May 22, 2026

Goal is to link mpv's pulseaudio sink data against playerctl instance data.

Playerctl defines instances by $PROCESS.instance$PID by passing the pid to pulseaudio we are able to reliably generate the playerctl instance identity purely from pulseaudio information.

The ao_pipewire solution uses pipewire library functions alongside mp_getpid() to set the pulseaudio property application.process.id.

Comment thread audio/out/ao_pipewire.c Outdated
NULL
);

pw_properties_setf(props, PW_KEY_APP_PROCESS_ID, "%ld", (long)getpid());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mp_getpid()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, so this is only needed for Pulse if Pulse doesn't populate it by default as well

Copy link
Copy Markdown
Author

@LurkAndLoiter LurkAndLoiter May 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you prefer it be removed from ao_pulse?

  • Presumed to remove ao_pulse
  • Replaced with mp_getpid()
  • Removed long cast based off other mp_getpid() implementations.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you remove it from ao_pulse then this PR does nothing. We can see that Pipewire populates this by default, now you need to verify is Pulse does the same or not and adjust the commit accordingly

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm seeing different results than what is being expected based off the pipewire code provided.

  • Pulse system
    • mpv master pactl list sink-inputs shows application.process.id already populated. ao_pulse modification is not required.
  • Pipewire system
    • mpv master pactl list sink-inputs No application.process.id.
    • mpv mpv_application_process_id ao_pulse change only No application.process.id
    • mpv mpv_application_process_id ao_pipewire change only application.process.id is populated
    • mpv mpv_application_process_id ao_pipewire and ao_pulse application.process.id is populated

The above results lead me to believe the ao_pulse changes are not needed and do not alter either pipewire or pulseaudio environments pulseaudio's application.process.id while ao_pipewire is required for pipewire to populate pulseaudio application.process.id

I don't mind including ao_pulse but from what I'm seeing the ao_pulse doesn't have any effect in either PulseAudio or Pipewire environments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pipewire the property is already set by default for the context, which ends up in the "PipeWire:Interface:Client" object. You are now also setting it on the "PipeWire:Interface:Node".

IMO if this is useful, pipewire core should also set it automatically on the node.
Can you open a ticket with your usecase there?

@LurkAndLoiter LurkAndLoiter force-pushed the mpv_application_process_id branch 3 times, most recently from fd11f51 to 959a09a Compare May 23, 2026 00:26
@LurkAndLoiter LurkAndLoiter force-pushed the mpv_application_process_id branch from 959a09a to a1c5514 Compare May 23, 2026 00:30
@LurkAndLoiter LurkAndLoiter changed the title ao_pipewire, ao_pulse feature notify pulseaudio of mpv's pid ao_pipewire feature notify pulseaudio of mpv's pid May 23, 2026
@LurkAndLoiter LurkAndLoiter changed the title ao_pipewire feature notify pulseaudio of mpv's pid ao_pipewire: feature notify pulseaudio of mpv's pid May 23, 2026
@LurkAndLoiter LurkAndLoiter marked this pull request as draft May 23, 2026 11:49
@LurkAndLoiter
Copy link
Copy Markdown
Author

moving to draft while requesting inclusion into pipewire core for an upstream resolution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants