geigi / cozy

🎧 Listen to audio books 📚 on Linux
https://cozy.sh
GNU General Public License v3.0
1.09k stars 84 forks source link

MPRIS volume property getter hangs after it was set to 0 #780

Closed azymohliad closed 1 month ago

azymohliad commented 1 year ago

Bug/Feature description

An attempt to read MPRIS Volume property after it was set to 0 hangs the client. It might be a GStreamer issue, as it seems to block on gst_player.py:L114. But I'm not very familiar with it to be sure, so reporting here for now just to not forget about it.

It also prints this warning:

(com.github.geigi.cozy:2): GLib-GIO-WARNING **: 20:04:47.256: Type of return value is incorrect: expected '(v)', got '()'

So I guess there's a D-Bus call to GStreamer under the hood, which hangs for a similar reason as #777 (returning unexpected empty value).

I guess as a workaround volume setter in GskPlayer could only propagate the value to GStreamer if it's not 0, and otherwise just set mute to True. And in the getter, read mute first, return 0 if it's True, and otherwise read volume property. But not sure if such workaround is reasonable.

Steps to reproduce

  1. Set the volume to 0:
busctl set-property --user org.mpris.MediaPlayer2.Cozy /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Volume d 0
  1. Read the volume:
busctl get-property --user org.mpris.MediaPlayer2.Cozy /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player Volume

The last command hangs.

System Information