HDR streaming and rendering via libplacebo #104
No reviewers
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
stale
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-streetpea/chiaki-ng!104
Loading…
Reference in a new issue
No description provided.
Delete branch "hdr"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #93.
This adds a second renderer besides the previous OpenGL renderer.
It uses libplacebo with its Vulkan output to draw the frames to the stream window. libplacebo has quite a few nice features, among others:
The renderer can be configured in the settings and still defaults to OpenGL, since on my laptop Placebo is still dropping frames at 4k rendering resolution on my laptop (Ryzen 7 6850U with Rembrandt graphics), even on the fast preset. This is in contrast to the OpenGL renderer, which keeps up nicely without dropping any frames.
Placebo offers three presets with increasing amounts of post-processing. The highest preset e.g. implements debanding, which almost gets rid of the annoying color banding in the PS5's main screen interface. When the Placebo renderer is enabled, users can take their pick between the three presets.
Remaining TODOs:
AVCodec internal buffer is full removing frames before pushingerrors and resulting glitches when streaming window is not visibleFor testing I created a flatpak repo you can access by downloading this file io.github.streetpea.Chiaki4deck.txt and rename it to io.github.streetpea.Chiaki4deck-hdr.flatpakref instead of .txt (I changed it to .txt for Github to allow me to upload it here) and then use the following in the directory where its located:
After running this file once to test with:
replace the config file with a copy of your chiaki4deck config file with:
and then open it again and select Placebeo (Vulkan, needed for hdr) from the Renderer settings on the bottom of the settings window and then select the newly added H265 (HDR) option for the codec.
Finally, add it to Steam as a non-steam game. Then launch it in game mode (hdr only works in game mode for now [apparently kde is planning hdr support for 2024])
As updates are made to this build I'll update the repo and testers will be able to use flatpak upgrade io.github.streetpea.Chiaki4deck-hdr
The file to create a similar build on your own is scripts/flatpak/chiaki4deck.yaml you just need to update the sources to point to your updated sources or local sources (for more info on how to do this see https://streetpea.github.io/chiaki4deck/diy/buildit/#create-gpg-key-for-signing-your-builds-and-repositories and don't do the build on your Steam Deck)
Tested, HDR works properly only with ‘none’ set as the hardware decoding method for me, not on any other decoding. Colours look accurate running it on the OLED Steam Deck compared to what I can see on my TV.
The big limitation is going to be with some peoples TVs. Some, like my LG C9, will only signal to the PS5 that HDR is available if it’s on and connected on that input. Some have power saving options that can be turned off so the handshake is there all the time. This is a limitation of the official remote play apps as well.
I'm still testing various HDMI dongles to see if they allow us to work around this, maybe we get lucky 🤞
Okay, I tested it out for almost 2 hours now.
As you already mentioned @streetpea, hardware decoding doesn't work. HDR works though. Colors look the same like on my LG C2.
Really important to note for everyone that wants to use their Steam Deck OLED for HDR:
You have to go to calibrate the HDR for your Deck OLED if your TV doesn't output same max 1000 nits like Deck OLED.
In PS5, open up settings => Screen and video => video output => scroll down to Adjust HDR. (It only works outside Remote Play)
My C2 monitor outputs max 800 nits so my settings are 14-14-0. 14 means 14 steps from beginning.
For Deck OLED you need to use 15-15-0. (Just like a LG G2 that outputs max 1000 nits too. Source: [HDTVTest])
Extra: What each setting outputs:
14 - 14 - 0 | MAX 853 nits
15 - 15 - 0 | MAX 985 nits
16 - 16 - 0 | MAX 1137 nits
To verify if there was a difference, I turned on HDR Waveform graph. (Go to settings on your Deck, display and scroll completly down. There you can change "none" to HDR Waveform.). And yes it makes a difference max nits went up to 1000-1140 with 16-16-0 from 750-850.
Horizon Forbidden West is a great HDR example if you want to try out HDR. (Ratchet and Clank Rift Aprt too)
Something to note that may not matter: red flowers in home menu of Horzion Forbidden West are more "red" on my c2 than on Deck OLED but it is probably because I am using a custom setting on my C2+ they got different panel manufacturers and etcs.
Summary: I played Ratchet and Clank after testing everything out for 10 minutes (1080p+60fps+10000 video bitrate + HDR) and worked really good. It was "stuttering" a bit at beginning but Lowering bitrate from 15000 to 10000 helped a bit. I think my Firtzbox 6690 is just doing a prank on me. Anyway, after restarting my router, I can actually get 15000 bitrate without any issues, as long I change governor to performance in powertools (a plugin for Deck) or limit cpu min ghz to 2
Extra: Capping Chiaki to 60hz flattens the Frametime graph, so I really recommend that. It smooths the stream.
Edit 1: I played Horizon Forbidden West for 30 minutes now and holy sht, the HDR in this game is phenomenal. The stream had some hiccups here and there but that is my router probably because I have the same problem in chiaki4deck (without HDR).
Edit 2: I tested out if HDR works if my monitor is off or not. (I have to note that power saving is off on it)
TV on with PS5 on => Deck HDR on
TV off while PS5 is on=> Deck HDR on
TV off and PS5 off but turning PS5 on after 1 minute with TV still off => Deck HDR on
=> it works on LG C2 OLED without needing in being on all the time. Great!!
Edit 3: Do you think you can implement Hardware Encoding? That would help immensly with stutters that are cause by the slow software encoding. I don't need to limit it to 2ghz anymore. (Side note: my Hardware Encoding in normal Chiaki4Deck (without HDR) with H265 doesn't work either, so it is not really HDR fault. First and Vulkan option give me an error and second option gives me good picture for 1-3 seconds than only purple or something => nothing works)
Edit 4: I just realized, all of our 2 c2 monitors + 1 tv were on 5Ghz canal :|. I changed them to 2.4ghz canal and only our phones and 1 ipad are using about 1.6 -2.4 GBits/s of 4.8GBits/s that my router can output. Before doing this, the tvs were using 2GBits/s too. I put Steam Deck on "prioritize" in my router's settings but I cannot test chiaki right now. I will play 1-2 hours of Ghost Tsushima tonight before sleeping and tell you guys how it works with a good connection :U.
Thank you guys for implementing HDR soooo fast. I never thought I could see HDR in Chiaki before HDR in Moonlight xd.
First patch fixes building against libplacebo lib outside of standard library path. Second patch fixes the QtWayland crash (still crashes if trying to close the window before stream starts, but this time crashes inside chiaki - and this crash also exists in upstream chiaki).
0001-Use-pkg_check_modules-for-lipblacebo.patch
0002-Create-Vulkan-surface-ourselves-instead-of-using-QVu.patch
@nowrep is this a fix for
or something else?
since triggering this in desktop mode I also get it in gamemode now :(
This is triggered here in the Gamescope WSI layer (
github.com/ValveSoftware/gamescope@ce089200e4/layer/VkLayer_FROG_gamescope_wsi.cpp (L747)) not sure why it's seeing a non-gammescope surface in game mode though.Update: nvm I had set a flatpak override to take away the filesystem xdg-run/gamescope-0 but instead of configuring at the app level I had configured it at the user level so when i reset the overrides it still was in effect. It works properly in gamemode again just not in desktop mode.
In desktop mode if you run the flatpak with: flatpak run
--env=VK_INSTANCE_LAYERS='' io.github.streetpea.Chiaki4deck-hdryou won't get the error since it's due to the gamescope vk instance layer activating without gamescope active.No, that wouldn't fix this.
@jbaiter how do I tell if the ps5 is outputting hdr? I can tell if the Steam Deck is outputting hdr via the badge and by turning on the hdr view in display settings but how do I know if the PS5 is outputting hdr or if libplacebo is outputting hdr from sdr content? I ask this because I noticed that even when I unplug my hdmi cable from my tv hdr is still outputted on the Steam deck when h265 (hdr) is selected
github.com/nowrep/chiaki4deck@f8c3c74be5- fixes HDR with hardware decode and actually enables zero-copyWow, thanks a ton @nowrep!! 🙏🏾 🙏🏾 I merged your changes into the PR!
Two ways to check as far as I could find out:
As for my experiments with HDMI dongles, no luck so far. I've now tried a headless dongle (-> 👎🏾) and a dongle with passthrough (-> 👎🏾 as well). I'm hesitant to purchase more of those things, since they all seem to only emulate the EDID, wich doesn't seem to be enough. I have a cheap ($10) 4k HDMI USB capture dongle lying around, maybe I can get that to identify as a virtual HDR-capable display to the PS5 🤞🏾
@jbaiter I was able to use 2) with the HDR brightness setting in Ghost of Tsushima and hdr is enabled for lg oled c7 whenever the tv is on (doesn't need to be on the ps5 tv input). This works for me since I usually remote play while someone else is watching TV or I'm watching TV and playing simultaneously. I also noticed that after activating it still works for quite some time (even through setting the PS to sleep mode and unplugging the hdmi adapter) until I manually switch H265 without hdr and then I had to turn the tv back on to re-enable hdr with the ps5. However, I'm not sure how long it will remain enabled after initially setting it. I could test this by setting the tv on and then unplugging the hdmi cable from the PS5 and testing if it was still enabled after 1 hour, 2 hours, etc. though I'm not sure if that would be TV specific. (I'm thinking perhaps it's possible to enable via a turned on TV and then unplug the HDMI cable and play for a while without needing the TV to be on).
I also ran into a bug where the screen stopped updating but sound and controls still worked (I could hear the sound of navigating the menus despite not being able to see them). The only thing I could see in the logs was:
The connection was otherwise stable as there were no dropped frames being reported. Here is the log from the run:
chiaki_session_2023-11-30_14-40-42-733733.log
I also noticed that when the prompt to ask if you want to quit the session (if you have it set to Ask when you disconnect in the settings) comes up this floods the logs and this also happens at the beginning of the stream session. Not sure if those are related though. People have reported an issue with the stream stopping but those logs look very different with the controller actually not responding and connections getting resent while in this case the stream connection seems fine (though I can enable debug logs and try to replicate this to make for sure) and it seems to be something with displaying the frames via the avplacebowidget. Now that I have verbose logging on I'll post an updated log if I can replicate this.
I noticed that error whenever I was hiding the stream window in my wayland session, e.g. by switching to another virtual screen. It seems that this makes the
RenderFramefunction take too long, which leads to a full buffer on the libavcodec side (which would be emptied by the calls tochiaki_ffmpeg_decoder_full_framein the frame uploader otherwise). It also happened when I was running the high preset at a 4k resolution on my laptop, in which case the rendering really was too slow, so the buffer was frequently full when a new frame was available.I believe HDR works with the TV off in games that use the system level HDR settings (and with "always-on HDR" set to on). I played Spider-Man 2 and Ratchet without the TV on (LG C9) and HDR was definitely working. Neon signs in Spider-Man burned my retinas. The spot in my screenshots is a good place to test. (But maybe only when it's night, and the ToD is tied to story progress).
Then I tried Horizon FW and it was not working until I turned the TV on and restarted the game.


No success in patching the HDMI capture stick's EDID, so this will probably have to be documented as "supported only when an HDR display is attached to the PS5" for now.
Other than that, I've been playing Cyberpunk and Returnal both with HDR enabled for an hour without problems on my OLED deck with VAAPI hardware decoding and the "High" preset, looks great and the GPU was never using more than 3W, CPU even less 👍🏾 HDR debugging with the waveform and gamut graphs showed that it was properly working and reaching 1000 nits for bright spots throughout 🥳 😎 🌞 💡
I've updated the PR with a few TODOs that should probably be done before it leaves the Draft state, can you think of any more @streetpea @nowrep?
@jbaiter I would probably want to add a build flag for the placebo stuff so it can be built without it for the appimage build (right now the appimage build isn't playing nice with libplacebo vulkan build) and windows build.
I "fixed" the dropped frames error by changing the log level to verbose (can be helpful for debugging issues) and added an API for retrieving total/dropped counts from the ffmpeg decoder (could be used for an overlay or a session summary).
The reason for it happening seems to be that
pl_swapchain_swap_buffersblocks in case the window is not rendered by Wayland at the moment. Glitches probably occur when I-Frames were missed during that time?The Placebo renderer can now also be disabled at compile-time by adding
-DCHIAKI_ENABLE_PLACEBO=OFFwhen generating the makefiles.I fixed that by not stalling the decode thread here: https://github.com/jbaiter/chiaki4deck/pull/4
Also fixed the gamescope wsi error when running in desktop mode, and it now shows the chiaki logo when waiting for rendering first frame instead of showing black screen.
With that, I think it's good to go. I would also say that the OpenGL renderer should be completely disabled when building with placebo, because it's all around worse (or at the very least, not make it default).
One additional thing I observed: The tone mapping from HDR to SDR seems to work now as well, when I turn HDR on my non-HDR laptop, the colors no longer look washed out but seem fine!
Brillaint @nowrep 🥳
Lovely, much better UX! Do you think you can resize it to the viewport size? It's currently cropped if the window size doesn't correspond to the expected stream resolution.
Yeah it doesn't really work great on desktop because the resizing doesn't work at all. This also applies for the video stream, ideally we should hold on the frame until receiving new one so we can redraw on window resize. But it's not so noticeable with video stream because it will re-render at correct size when next frame arrives.
Edit: Fixed now.
Do you agree @streetpea? I think I do, given that even the "high quality" preset is absolutely fine regarding energy usage, and the image quality is improved (especially with the debanding).
@nowrep One issue I've encountered after the move of the rendering to the main thread is that the main window becomes unresponsive after closing the streaming session.
I agree that the libplacebo should be the default. I would say there's not really harm to leaving OpenGL as an option now in case people run into errors with the libplacebo renderer when more people are using it though. Also, do you think the high quality preset should be the default instead of normal given the debanding since it still doesn't seem like it's causing that big of a battery hit given the advantage of the debanding.
👍🏾 I do, I think getting rid of the annoying banding is worth the at most a few hundred milliwatts in increased energy usage 🙃
@chipgw mentioned he no longer sees hdr activating in #93 and I also see it. I just deployed this version (where hdr doesn't work anymore) using the latest changes up to now from the jbaiter repo as well as the latest chiaki4deck.yaml. This probably has to do with switching from using a global environment variable to activate the vulkan layer to the qt environment variable.
Update: I checked the logs and the gamescope WSI layer is running and even says HDR formats true in gamemode so they should be exposed but I only see 2 surface formats when libplacebo starts.
I updated my flatpak after reading chipgw's comment and I still have HDR. So if your deployment was very very recent maybe I'm still one behind.
Also, I would recommend a warning or disabling configurations that are likely to enter Chiaki's FEC; my stream will flash about a third of the screen white at full 1000 nits which should be avoided when it is not part of the actual frame data.
HDR+1080p+vaapi works amazing while HDR+720p+none/vulkan is at least stable. Dropping the brightness of any error corrected frames seems fine too though vaapi in HDR hasn't had any issues for me yet.
@panthurrr are you using the flatpak repo I made or building it yourself? If you are building it yourself are you using the chiaki4deck.yaml file in the scripts/flatpak directory or something else?
Here is a log with logging as well as output to the terminal logged and you can see the Gamescope WSI is loading and supposedly enabling HDR so I don't know why the other surfaces aren't appearing. Checking my vulkaninfo flatpak it sill shows the 12 surfaces with the vulkan layers in gamemode so not sure what's going on with the chiaki4deck flatpak. Here is the log
HDRNotActivating.txt
@ -0,0 +41,4 @@else if (preset == PlaceboPreset::Fast){CHIAKI_LOGI(session->GetChiakiLog(), "Using placebo fast preset");render_params = pl_render_fast_params;It's SVG image so that's why QImageReader was used to always render the SVG at requested size. So now it will be blurry due to scaling in RenderPlaceholderIcon.
You don't get HDR because of this:
not sure why it happens (there should be more formats, notably VK_FORMAT_R16G16B16A16_UNORM and VK_FORMAT_A2B10G10R10_UNORM_PACK32).
@ -0,0 +41,4 @@else if (preset == PlaceboPreset::Fast){CHIAKI_LOGI(session->GetChiakiLog(), "Using placebo fast preset");render_params = pl_render_fast_params;I tested it on my display and it didn't seem that blurry to me, but I'll revert it. It's not like we're redrawing that logo every frame anyway.
@jbaiter Is this also on desktop or only on deck in gamescope?
If gamescope then I haven't figured out yet how to cleanly stop stream other than force quit app 🥲Separator here needs to be
:, not,.@streetpea using the build from your .flatpakref and upgrading it, I'll get a local build going too and see if that works but here's the log with vaapi+HDR+1080p works great to me. I tried upgrading it again just now too and still works with HDR.
HDR with vaapi
It was on my laptop, yeah 😅
Can't reproduce on deck or on my desktop (sway). I assume the main thread is blocked, can you check where in gdb?
And does it go away if you switch to VK_PRESENT_MODE_MAILBOX_KHR?
@nowrep you can close the stream cleanly from game mode on deck using ctrl+q. This is mapped to one of the back button in the chiaki4deck+mic layout. If you aren't using the automation the settings menu will pop up after closing. If you are using the automation it will just exit out of the app.
@streetpea Yeah, I've loaded the controller layout and it works fine.
An update on hdr not activating. I noticed hdr did activate 1 time when I was gathering logs so I thought maybe it was something that changed in my environment rather than the code. I switched to the commit made a few days ago (which I had tested numerous times and confirmed hdr working) and it still doesn't work so I don't think it's related to code changes.
Update: The vulkaninfo flatpak constantly shows 12 surface formats in game mode even when chiaki4deck only shows 2 consistently so not sure why this is the case. HDR also always activates on Ori Will of the Wisps even when failing for this flatpak.
Update 2: So it turns out it's activating hdr successfully when I have my Steam Deck docked to an external non-hdr monitor using the Steam Deck Dock but it isn't activating when I have it unplugged for chiaki4deck though it is for other games.
@panthurrr Nothing wrong in the log, as long as you selected H265 HDR codec (probably good idea to add this to log).
This would probably be a good idea to look into.
I was getting bad audio crackling today, both on this branch and the main branch, so I was diagnosing the problem. Went into the Steam Deck settings while the HDR stream was up and when I came back, my screen was basically green. Seems to be reproducible as a minor bug.
Step 1) Press Steam button and go to settings
2) Go to internet
3) Press A on your WiFi connection for more information
4) Press B to go back and then go back to your streaming session
Screenshot:

I updated about 1 hour ago and the differences to last build I updated to (10-11 hours ago):
You guys added Chiaki Logo and eveerything works like last night. I just played Demon Souls for 30 minutes with following settings and I had no problem. (Some "fps drop" every minute or so but dropping bitrate from 20000 to 11000 fixed it => my wifi on Deck got 2 out 4 bars. )
PS5 1080p HDR 60fps --- 11000 video bitrate --- Vulkan
No problem as I have said before. HDR still works and gets detected. It looks just like last night.
Furthermore I don't know how @panthurrr is using vaapi+HDR+1080p but vaapi or any other hardware recording (two of them crash Chiaki) gives me green screen, even when I lower bitrate to 5000 and go near my router. vaapi + non HDR + opengl doesn't work either. On other hand Vulkan works better compared to "none" HardwareEncoding for HDR.
To "white Flashes". I got those last night when I was trying 30000-40000 video bitrate and it was literally blinding me with 1000nits flashes every 5s for couple of minutes (I wanted to save the game in Ghost of Tsushima so I endured it). Reducing the bitrate back to 15000 last night, fixed this "white flashing" issues @panthurrr described. ==> lowering bitrate could help and maybe your connection is bad like me xd. (PS5 1Gbit LAN connection to Router and Router is giving me 0.5-1.4gbit 5ghz connection to my Deck through 40-45cm of a concrete wall)
With my 11000 video bitrate setting, I don't have any "white flashes" or "green" screen issues. However I saw similar green screen thingy like @Hasney69 when I went to Settings --> Display --> scroll down --> none to HDR Waveform (to check what max nits is) ---> and back to the game. However it only happend once after doing it like 15 times or so.
Edit1: I had audio crackling issues at higher video bitrate but lowering the video bitrate fixed it. (I even took 2*19200 =38400 audio bitrate for fun when using high video bitrate but that didn't change sht => too much for my shty connection)
Anything other than
vaapidoesn't work and will fallback to software decoding (akanone).The green video issues with hardware decoding is simply because hardware decoding is pretty bad at decoding corrupted streams - software decoder will use gray color for invalid frames / parts of frame but on hw decode you get green.
Wait so my connection was still bad when I was sitting infront of my router and that is why I still was getting green screen, right? If I somehow fix this connection thingy issue, I could be able to use vaapi, right?
Weirdly enough, I saw my deck use 8-9w (vulkan) instead of 7-8w (none) so I thought that it was working. Alright, I got you.
Edit1: I restarted the router + restarted deck + changed 5hz canal from automatic to 100 (automatic 160mhz connection between deck and router now) and now I can use vaapi+HDR+8000 video bitrate infront of my router. I don't know why but Deck still gives me 2 out of 4 wifi bars infront of my router and this is the best modem you can get for "cable" connection in Germany (Firtzbox 6690). This experience probably invalides my "tests" above.
@ -127,3 +198,4 @@ modules:branch: chiaki4deckpost-install:Only
x86_64layer is used.I was able to figure out what was causing hdr mode not to activate for me. I recently switched to using the Chiaki-launcher.sh script to launch chiaki4deck-hdr. It turns out when launching chiaki via the Chiaki cli (i.e., stream command) like
flatpak run io.github.streetpea.Chiaki4deck-hdr --stretch stream PS5-411 192.168.1.16(non-steam game set to flatpak command set to
run io.github.streetpea.Chiaki4deck-hdr --stretch stream PS5-411 192.168.1.16) it doesn't activate hdr despite saying gamescope is adding hdr over stdout. Weirdly, it still activates hdr if you are connected to an external monitor when launching. This means currently if you use the Chiaki-launcher.sh script or just launch via the cli option you won't get hdr activating for you unless plugged into an external monitor. Not exactly sure what's causing this. Maybe @nowrep or @jbaiter have a better idea.It's because the gamescope layer thinks it can't bypass xwayland in that case. Looking into it.
I can't reproduce, but it may have something to do with window sizes mismatch (AVPlaceboWidget is actually a "subsurface").
Try this hacky patch:
github.com/nowrep/chiaki4deck@fbeea2a8e7@nowrep you should be able to reproduce if you try launching with the stream command as your non-steam game instead or downloading the gen-launcher.sh script replacing io.github.streetpea.Chiaki4deck with io.github.streetpea.Chiaki4deck-hdr and then running it and then adding the resulting
~/.var/app/io.github.streetpea.Chiaki4deck-hdr/config/Chiaki/Chiaki-launcher.shas a non steam game and launching it. Either of these will have you launch via the stream commandgithub.com/streetpea/chiaki4deck@891c609f6b/gui/src/main.cpp (L135)and trigger hdr not picking up.I'll test your update and see if that fixes it.
I did it exactly like that (so it opened only the stream window) and hdr still worked.
@nowrep did you have a monitor attached? Hdr still works when I have a monitor attached but doesnt if I don't when launching via the stream command.
No I don't have monitor attached.
That's weird @nowrep which update branch from Steam deck are you on: stable, beta or preview?
Stable (3.5.7).
I'm on stable (3.5.7) as well so am at a bit of a loss on why you can't reproduce but I'll try your fix and see if it works 🤷♂️
@nowrep HDR is working now using the stream command when I use your swapchain-resize branch 👍
FWIW I've never used Chiaki before, installed this last night and ran flawlessly with full HDR on every game I tested. PS5 is hardwired LAN connection, was able to push my bitrate as high as 80k with no stuttering and beautiful (practically native looking) picture. Thanks!
Thank you for the documentation @streetpea!
And much thanks to you @nowrep for all the help and fixing my stupid bugs ❤️
I think this is ready for review now. The code could probably take some more cleaning up and some more testing with a final build would be great as well. Especially if the occasional white flashes are tolerable with HDR enabled or not. I had a look around the code base where one might change the color to black, but haven't had much luck. Does anybody know what needs to happen for the white flashes trigger vs green blocking in case of a corrupted/missing frame (with hardware decoding)?
I just updated the testing flatpak to the latest build. You can update to the latest version via the discover store or
flatpak upgrade io.github.streetpea.Chiaki4deck-hdrfrom the konsoleAnother small thing that I've noticed is if you set the
Action on DisconnecttoAskand bring up the menu (using ctrl+q) or hitting x on the screen and then try to go back to the session the screen will be frozen (you can still hear audio from what you're doing in the background) but the logs just printAVCodec internal buffer is full removing frames before pushingso it seems like the the libplacebo library isn't able to process the frames for the rest of the session when this happens. This doesn't happen with the opengl renderer. If you hitctrl+qor x the window after that it just crashes out of the game with the placebo renderer. It uses a QMessageBox for this (seegithub.com/streetpea/chiaki4deck@891c609f6b/gui/src/streamwindow.cpp (L169)). This is using the close event ... maybe the widget is being closed or there is some interaction with that which is causing this since creating the QMessageBox itself doesn't cause this.Cool, can't wait to test(High-five)
Regarding the flashing frames could we just drop those frames instead of playing them so it lags during that time versus flashing? Is there a specific condition that is associated with the flashing frames?
You can try dropping the corrupt frames instead of flushing them by comment out this line:
https://github.com/streetpea/chiaki4deck/blob/hdr/lib/src/videoreceiver.c#L116
I've also attempted swapping the frame_index_cur with the frame_index_prev_complete before returning from that if statement but there's still a lot of dropped frames which turn the entire screen grey.
For now choosing vaapi produces a better user experience to me than software decoding; might be preferred to only allow vaapi with HDR on if that's the only hw decoder that works.
This is just a (probably stupid) idea, but couldn't we keep around a static black frame that we insert whenever we encounter a corrupt frame? Black should be a lot less irritating than white or gray on the OLED screen.
@jbaiter That would be a great improvement; I'm still trying to learn where the actual corrupt/missing frame data is since a lot of references are to indexes. Also how to form the raw data for a static black frame.
Second this, using VAAPI on Deck gamemode, right now(non hdr ver) video is much choppier than Android PSPlay, same WiFi network, PS5 on wired LAN, can easily support 100Mbps.
I think we should implement error concealment here:
github.com/streetpea/chiaki4deck@891c609f6b/lib/src/videoreceiver.c (L134). The simplest form of error concealment would be to just keep a copy of the last successfully pushed frame and send that via the video sample cb instead of the frame where fec failed. Maybe that will fix the flashes (do they occur when fec fails?)I think trying to improve error behavior shouldn't block this PR, it can be done in followup PR.
That would definitely not work.
You can try
github.com/nowrep/chiaki4deck@76eaf32446for the errors, it simply skips rendering frames that had decoding error. It does seem to work but it's far from ideal solution.@nowrep i tend to agree that better handling streaming errors is outside of the scope of this pr so I created a new issue for it #108. Having said that, there were complaints about discomfort particularly when the flashes occurred during HDR streaming because of the increased brightness so if your branch does fix that it could be good to add your change as a hot fix for that.
Are they any other changes we should add before merging this pr?
Should be good now, only need to fix build
Merged your latest change @nowrep! Many thanks for all the work ❤️