USDX
USDX copied to clipboard
USongs: Cache VisibleIndex
It took a significant amount of time to calculate this value for huge collections.
Fixes #320
Thanks. I'll test tuesday nicht when I'm home!
Well, it seems like the patch somehow works but is buggy:
- normal song selection using the arrow keys is MUCH improved, the performance is pretty good, even on a RaspberryPi 4 (default clock speed, fmks active)
- when pressing J to search for a song the song will play in the background but the GUI will crash and USDX freezes (segfault?)
- pressing R for random works as expected
tail -f Error.log
....
INFO: Using decoder FFmpeg_Decoder for "/mnt/Images/7000_Ultrastar_Songs/10cc - Dreadlock Holiday [VIDEO]/10cc - Dreadlock Holiday.mp3" [TAudioPlaybackBase.OpenDecodeStream]
INFO: VideoStreamIndex : -1 [TVideoPlayback_ffmpeg.Open]
INFO: Using h264_mmal codec [TVideoPlayback_ffmpeg.Open]
INFO: Framerate: 6fps [TVideoPlayback_ffmpeg.Open]
INFO: Using decoder FFmpeg_Decoder for "/mnt/Images/7000_Ultrastar_Songs/Astrid Lindgren - Du käre lille snickerbo/Astrid Lindgren - Du käre lille snickerbo.mp3" [TAudioPlaybackBase.OpenDecodeStream]
INFO: Using decoder FFmpeg_Decoder for "/mnt/Images/7000_Ultrastar_Songs/Astrid Lindgren - Du käre lille snickerbo/Astrid Lindgren - Du käre lille snickerbo.mp3" [TAudioPlaybackBase.OpenDecodeStream]
INFO: Using decoder FFmpeg_Decoder for "/mnt/Images/7000_Ultrastar_Songs/Lilly Wood & The Prick and Robin Schulz - Prayer in C (Robin Schulz Remix) [VIDEO]/Lilly Wood & The Prick and Robin Schulz - Prayer in C (Robin Schulz Remix).mp3" [TAudioPlaybackBase.OpenDecodeStream]
INFO: VideoStreamIndex : -1 [TVideoPlayback_ffmpeg.Open]
INFO: Using h264_mmal codec [TVideoPlayback_ffmpeg.Open]
INFO: Framerate: 25fps [TVideoPlayback_ffmpeg.Open]
INFO: Using decoder FFmpeg_Decoder for "/mnt/Images/7000_Ultrastar_Songs/Lilly Wood & The Prick and Robin Schulz - Prayer in C (Robin Schulz Remix) [VIDEO]/Lilly Wood & The Prick and Robin Schulz - Prayer in C (Robin Schulz Remix).mp3" [TAudioPlaybackBase.OpenDecodeStream]
INFO: VideoStreamIndex : -1 [TVideoPlayback_ffmpeg.Open]
INFO: Using h264_mmal codec [TVideoPlayback_ffmpeg.Open]
INFO: Framerate: 25fps [TVideoPlayback_ffmpeg.Open]
terminal output for USDX
...
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x3565300 (EINVAL)
mmal: mmal_port_disable: port vc.ril.video_decode:in:0(MP4V)(0x3565300) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:out:0(0x3565610) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:ctr:0(0x3577c90) is not enabled
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x35a2470 (EINVAL)
mmal: mmal_port_disable: port vc.ril.video_decode:in:0(MP4V)(0x35a2470) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:out:0(0x3562f80) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:ctr:0(0x210fed0) is not enabled
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x358aa50 (EINVAL)
mmal: mmal_port_disable: port vc.ril.video_decode:in:0(MP4V)(0x358aa50) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:out:0(0x358ad60) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:ctr:0(0x2115340) is not enabled
mmal: mmal_vc_port_info_set: failed to set port info (2:0): EINVAL
mmal: mmal_vc_port_set_format: mmal_vc_port_info_set failed 0x368aeb0 (EINVAL)
mmal: mmal_port_disable: port vc.ril.video_decode:in:0(MP4V)(0x368aeb0) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:out:0(0x368b1d0) is not enabled
mmal: mmal_port_disable: port vc.ril.video_decode:ctr:0(0x3679860) is not enabled
Update
- random freezes also happen when just browsing using arrow keys to navigate (searching by pressing J causes reproducible freezes though)
PS: The music always keeps playing in the background
Are we maybe opening a video before the previous one has been closed? Or are we leaking "something" used by MMAL? It is rock solid with software decoding on my PC.
I did not have this problem without this branch in hardware decoding. I could try with SW decoding tonight.
Is it possible to activate some Debug-Logging/Symbols or getting a stack trace with gdm or something?
RPI @s09bQ5 I guess you're on the right track:
- use software decoder: no crash. performance at RPI4 while decoding 1080p h.264 is abysmal again
- the error is still reproducible, also while searching for other songs and even if video preview is disabled
~While the video preview is disabled, why does the application still render the video in the background? I can still see the decoder is in use. If we could not get this issue here fixed, disabling the video preview could at least be a mitigation if the video file would not be touched while skimming through the library or searching for a song.~ I was just too tired.
It really seems the playback of a video is not terminated correctly and the hardware decoder might still be in use.
In addition, since I'm not able to get into the code base: Could this be related to our issue? https://www.raspberrypi.org/forums/viewtopic.php?p=801310
Intel Skylake
- performance in the large library is MUCH improved while skimming / searching
- using
PreferredCodecs=h264_v4l2m2m
works as well, no crashes (I did not get Intel QSV working)
So this seems to be pi specific. Not sure why that only happens after the new commit, since hw decoding worked before.
If someone else could test with a Pi3 or Pi4 that would be great. Maybe something might be wrong with my setup. I could try another clean flash of Raspian and re-compiling the game within this week. I will re-test with a clean flash:
- Pi@Master branch: SW decoding
- Pi@Master branch: HW decoding
- Pi@speedup-song-selection branch: SW decoding
- Pi@speedup-song-selection branch: HW decoding
Update Today I tried this PR again. I updated my Raspian to the latest version which brought a new ffmpeg version as well. Now I could use hardware encoding as well as the speeded up song selection.
I observed the performance got a little hit, the framerates at 1080p went down a little. I guess this is caused by the fact that RPI4 render pipeline/DRM is still a moving target. The drivers as well as the hardware codecs seem not to be optimized yet.
From my side I'd say the pr is totally fine to be merged. @s09bQ5 @basisbit
could someone test this PR on usual windows and linux targets please?
Works as well in Arch (with AMD RX480 Mesa Graphics) and Manjaro (with Intel UHD 620 Mesa).
I dont't have a bare metal Windows to test though.
PS: I'll retest with +10.000 songs later tonight.
also please test with categories enabled, with saved playlists and also with the different song browser modes to make sure that nothing broke that wasn't already broken before.
I'm very sorry I got lost in the process. I'd be willing to test the PR once again with arm64, Windows & Linux amd64. Unfortunately the PR does not compile anymore. Would it be possible for you to update it @s09bQ5 ? If so, we might progress and merged the fixed version into master after testing. Thanks!
I have rebased the commit.
Tested this on Arch with ~1900 songs, works fine as far as I'm able to tell. I played around with playlists, searches, searches within playlists, random, different sorting, different ways of song browsing (Roulette, Chessboard, etc) and did not notice any issues. I never use video previews (they slow down browsing).
Categories (assuming this is Options -> Game -> Tabs) have never worked for me. As in: I can select a category, and then I'm stuck in that category until I put the setting back to Off again; is this specific to certain theme/sorting/songbrowser/etc combination(s)?
The current version runs quite goog on Windows and Linux. Do we have a chance to merge it?
(just for the lulz)