Skip to content

fix: handle livestream sentinel length in lyrics and media player for twitch as media source#1648

Open
linusgenz wants to merge 1 commit into
caelestia-dots:mainfrom
linusgenz:fix-media-player-with-twitch
Open

fix: handle livestream sentinel length in lyrics and media player for twitch as media source#1648
linusgenz wants to merge 1 commit into
caelestia-dots:mainfrom
linusgenz:fix-media-player-with-twitch

Conversation

@linusgenz

Copy link
Copy Markdown

fixes #1645

Fixes the crash when opening the dashboard media section while a Twitch livestream is playing.

Cause

Twitch reports INT64_MAX as the MPRIS Length for livestreams. After Quickshell's µs→s conversion this becomes ~9.22e12 exceeding INT_MAX. When the lyrics service passed this value to qRound(double), Qt's checked FP-to-integer conversion asserted and aborted.
YouTube Live is unaffected because it reports the DVR buffer length as the track length, which is a normal-sized value.

Changes

lyrics.cpp
guard qRound(m_duration) against values that don't fit in int. The duration parameter is omitted from the lrclib query for livestreams; lrclib handles this gracefully by falling back to title/artist matching.
Details.qml
added isLive (threshold: length > INT_MAX) to show LIVE instead of 577014:32:22 on the right label, and disable the seek slider to prevent the stream from freezing on interaction since seeking is not supported on twitch.

lmk if this is fine the way it is, or if we should handle this different. We can't really copy the behavior from youtube streams, since twitch reports different data

…r twitch)

Signed-off-by: Linus Genz <linuslinuxgenz@gmail.com>
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.

[CRASH] Quickshell crashes, when twitch is the media source in the dashboard

1 participant