https://bugs.kde.org/show_bug.cgi?id=521448
Bug ID: 521448
Summary: mprisservice: a held media-play key (KEY_PLAY)
autorepeats the play/pause toggle, causing a rapid
Play/Pause storm
Classification: Plasma
Product: plasmashell
Version First 6.6.5
Reported In:
Platform: Arch Linux
OS: Linux
Status: REPORTED
Severity: normal
Priority: NOR
Component: Media Player widget
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Target Milestone: 1.0
SUMMARY
A media device that sends KEY_PLAY (HID consumer usage 0xB0) as a *held* key --
rather than a momentary tap -- causes mprisservice to enter a rapid Play/Pause
toggle storm (~25 Hz) on the active MPRIS player, for as long as the key is
held. The player UI visibly flickers many times per second.
Root cause is a combination in libkmpris/kded/mprisservice.cpp:
1. Qt::Key_MediaPlay is bound to onPlayPause() -- the play/pause TOGGLE -- not
to the idempotent onPlay(). (enableGlobalShortcuts():
addGlobalShortcut("playpausemedia", ..., Qt::Key_MediaPlay,
&MprisService::onPlayPause). onPlay()/onPause() exist and are idempotent, but
onPlay() has no key bound.)
2. The held media key is autorepeated at the desktop key-repeat rate *above*
the evdev layer and re-triggers the global shortcut ~25 times/second.
3. Each activation calls onPlayPause(), which reads the player's current
PlaybackStatus and flips it -- so successive repeats produce
Play/Pause/Play/Pause...
Triggering device: Bose QC Ultra Headphones over USB. Their wear-sensor
"resume" command is emitted as KEY_PLAY and held down continuously while the
headphones are worn (released only on the next ear transition). Over Bluetooth
(AVRCP) the same device sends momentary passthrough commands, so the issue does
NOT occur -- it is specific to a held media key over USB HID.
STEPS TO REPRODUCE
1. Have an MPRIS-aware player playing (tested: Spotify; also reproduced with
Chromium).
2. Deliver a *held* media-play key: KEY_PLAY pressed and held with no immediate
release. With the Bose QC Ultra over USB this happens automatically while the
headphones are worn; it can also be reproduced by emitting a held XF86AudioPlay
/ KEY_PLAY.
OBSERVED RESULT
- While KEY_PLAY is held, the active player receives a rapid,
strictly-alternating stream of Pause/Play MPRIS method calls at ~40 ms
intervals (about 25 Hz). The player UI flickers many times per second.
- Captured: 247 MPRIS Play/Pause calls (roughly 101 Play / 101 Pause), all sent
by kded6 (mprisservice) to org.mpris.MediaPlayer2.spotify, with 247/247 falling
inside the windows during which KEY_PLAY was held (press->release windows of
6.8 s and 16.2 s in the capture).
- The input device shows only the single held key: evtest on the USB HID node
shows KEY_PLAY value=1 (press) and the matching value=0 (release) seconds
later, with ZERO kernel autorepeat (value=2) events. So the ~25 Hz repeat is
synthesized above evdev (compositor / global-shortcut layer) and amplified into
alternating commands by the toggle handler.
EXPECTED RESULT
A held media-play key should not produce a rapid play/pause oscillation. Either
(or both):
(a) media-transport global shortcuts should ignore key autorepeat (a held play
key should act once), and/or
(b) Qt::Key_MediaPlay should be bound to the idempotent onPlay() rather than
the toggle onPlayPause(), so repeats are harmless no-ops.
ADDITIONAL INFORMATION
- Diagnosis: dbus-monitor (session bus, org.mpris.MediaPlayer2.Player) showed
all calls originating from kded6; evtest on the device input nodes localized a
single held key (USB HID Consumer Control), with the Bluetooth AVRCP node
showing zero events; unloading the kded module (qdbus6 org.kde.kded6 /kded
unloadModule mprisservice) eliminates the storm entirely, and reloading
restores it.
- Workaround for affected users: disable the device's auto-pause feature, or
avoid the USB connection (Bluetooth is unaffected).
SOFTWARE/OS VERSIONS
- Plasma: 6.6.5 (plasma-workspace 6.6.5-2)
- Qt: 6.11.1
- OS: Arch Linux, kernel 7.0.12-arch1-1
- Audio: PipeWire 1.6.6 + WirePlumber + pipewire-pulse
- Trigger device: Bose QC Ultra Headphones over USB (HID Consumer Control)
--
You are receiving this mail because:
You are watching all bug changes.