fix: handle livestream sentinel length in lyrics and media player for twitch as media source#1648
Open
linusgenz wants to merge 1 commit into
Open
Conversation
…r twitch) Signed-off-by: Linus Genz <linuslinuxgenz@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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