Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple mpv instances lead to multiple signal issuing #169

Closed
Zocker1999NET opened this issue Apr 19, 2020 · 2 comments
Closed

Multiple mpv instances lead to multiple signal issuing #169

Zocker1999NET opened this issue Apr 19, 2020 · 2 comments
Assignees
Labels

Comments

@Zocker1999NET
Copy link

Zocker1999NET commented Apr 19, 2020

The player I am using is mpv (with mpv-mpris). I discovered this issue using my own script, but I can confirm this issue using this example for the Playerctl Python bindings.

The bug is that Playerctl seems to receive / trigger signals for players which have vanished before. To find this bug, do the following:

  1. Optional: In the example script, change the appearances of player.props.player_name to player.props.player_instance for better differing the multiple instances of mpv running. Without the change, the bug will also occur but seems even more weird.
  2. Start the script and let it running in the background
  3. Launch a first instance of mpv (after some seconds playing you can pause it)
  4. Launch a second instance of mpv (same as above)
  5. Kill the first instance, it does not work if you kill the second instance
  6. Resume playing on the second instance (issuing the example script to log this), this can be repeated several times

The expected log (with comments referring to the steps above) of the example script should be (with the modification, pid can differ):

# Launch first instance
player is playing: mpv
# Launch second instance
player is playing: mpv.instance804148
# Exit first instance
player has exited: mpv
# Resume second instance
player is playing: mpv.instance804148

But for me it is actually (with the modification, pid can differ):

# Launch first instance
player is playing: mpv
# Launch second instance
player is playing: mpv.instance804148
# Exit first instance
player has exited: mpv
# Resume second instance
player is playing: mpv
player is playing: mpv.instance804148

(without the modification, mpv.instance804148 would also be mpv, which can be confusing)

Playerctl seems to have problems with mpv first naming its instance mpv and mpv.instancePID the second time. But the issue does not apply if both instances run simultaneously. The developer of mpv-mpris states this behaviour is following the MPRIS specification. Even playerctl instances launched after exiting the first mpv instance (but while the second one is still present) list multiple mpv instances even if only a single process is still opened:

$ playerctl --list-all
mpv.instance804148
mpv

As I do not know much about d-bus interfaces, I hope you can take a look on this issue and maybe fix it, if Playerctl does mess up with something. Thank you for your work on Playerctl.

@Zocker1999NET Zocker1999NET changed the title Multiple mpv instances lead to multiple events Multiple mpv instances lead to multiple signal issuing Apr 19, 2020
@acrisci
Copy link
Member

acrisci commented Apr 19, 2020

I can confirm this and I believe it is a bug in playerctl causing this issue.

@acrisci
Copy link
Member

acrisci commented Apr 19, 2020

I looked into it further and found a bug in mpv-mpris that I believe is causing this behavior.

Confirm this works here:

hoyon/mpv-mpris#35

@acrisci acrisci closed this as completed May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants