Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve streaming error handling #108

Closed
streetpea opened this issue Dec 8, 2023 · 10 comments
Closed

Improve streaming error handling #108

streetpea opened this issue Dec 8, 2023 · 10 comments

Comments

@streetpea
Copy link
Owner

Improve handling of streaming errors such as corrupted frames that currently causes flashes sometimes and green or gray covering the screen other times.

@streetpea
Copy link
Owner Author

@nowrep have you made enough progress on this to add a patch towards this in the upcoming release or do you think any progress on this should wait for the next release (could make a bug fix release later for progress on this).

@nowrep
Copy link
Contributor

nowrep commented Dec 9, 2023

nowrep@3b7dbf7

This is what I have so far. Not perfect, but seems to behave a bit better so I'd say it's at least worth testing.

@nowrep
Copy link
Contributor

nowrep commented Dec 9, 2023

What it does is simply re-submit last good frame on FEC error. But on its own it wouldn't work, because ffmpeg would error out on duplicate frame number / POC. So it also includes ffmpeg patch to deal with this, it could be done without patching ffmpeg but it's way more code so I did it the "lazy" way 😃

@jbaiter
Copy link
Contributor

jbaiter commented Dec 9, 2023

thanks for the explanation, I deleted my comment because it was based on an older state of the code, sorry about that.

@panthurrr
Copy link

panthurrr commented Dec 10, 2023

I get a lot of whole screen flashes on this fec-replay branch: nowrep@3b7dbf7

If anyone knows a good way to run a debugger like gdb with gamemode I'll give that a try to see which part is directly producing the missing frames. Tried locally building and running a debugger which crashed desktop mode so that didn't get me very far but if anyone has experience with remote debugging on Steam Deck then hopefully that would be useful.

Using hw decoder of none + 90000 bitrate to produce more egregious data:
https://github.com/panthurrr/chiaki4deck/blob/logs/chiaki_session_2023-12-09_17-46-44-867867.log

@streetpea
Copy link
Owner Author

streetpea commented Dec 10, 2023

@panthurrr you can follow this https://streetpea.github.io/chiaki4deck/diy/steamdeckdev/ for using gdb on steam deck builds.Install 23.08 not 22.08 though as it changed since the last release. You can use desktop mode for this if you follow those instructions.

@streetpea
Copy link
Owner Author

streetpea commented Dec 10, 2023

@Panthurr I would also suggest printing out the logs in stdout and stderr to a file like:

flatpak run io.github.streetpea.Chiaki4deck-hdr &> chiaki4deck.log

(I updated Chiaki4deck-hdr repo to add the fixing POC change)
so you can see the ffmpeg logs which aren't part of the Chiaki logs. You can see my output doing this below. You can see the Fixing duplicate POC coming into effect but you can still see Could not find ref with POC of earlier numbers as well
chiaki4deck.log

I also get a lot of white flashes with vaapi off and bitrate set to 90000 (log above). Using an older version of the code without the change is just as bad if not worse so at the very least this change doesn't seem to make things worse but there is still work to be done to eliminate the flashing.

@nowrep
Copy link
Contributor

nowrep commented Dec 10, 2023

Alright, updated branch. Should be better now, it also survives the "settings->internet" test now.

Use vaapi with this please. Also the ffmpeg patches are required, it won't work at all without it.

@streetpea
Copy link
Owner Author

@nowrep I tested this out and now it only has fixing duplicate POC and afterwards does not have the could not find ref with POC. There is also no more white flashing in these instances. I did encounter one white flash at the very beginning of one of the test streaming sessions but that was just could not find ref with POC with negative numbers like

[hevc @ 0x557806a9df40] Could not find ref with POC -7
[hevc @ 0x557806a9df40] Could not find ref with POC -8
[hevc @ 0x557806a9df40] Could not find ref with POC -9
[hevc @ 0x557806a9df40] Could not find ref with POC -10
[hevc @ 0x557806a9df40] Could not find ref with POC -11
[hevc @ 0x557806a9df40] Could not find ref with POC -12
[hevc @ 0x557806a9df40] Could not find ref with POC -13
[hevc @ 0x557806a9df40] Could not find ref with POC -14
[hevc @ 0x557806a9df40] Could not find ref with POC -15

and didn't have the fixing duplicate POC so I think that happened in a different error case. Anyway, the streaming errors are definitely much improved versus the current state so I will add this to the release. If there are any more advancements you can make on this @nowrep I can add them to a patch release afterwards. Otherwise, this seem like a great improvement. Thanks for all your contributions @nowrep!

@nowrep
Copy link
Contributor

nowrep commented Dec 11, 2023

Hmm no idea how the negative numbers happened. But I guess if the very first frame is corrupted it could happen?

Also offtopic here: you can get vulkan video on deck (export RADV_PERFTEST=video_decode) but it's currently broken for 10bit (hdr) and I can reproduce the same on my desktop. It's either ffmpeg or mesa bug.

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

No branches or pull requests

4 participants