-
-
Notifications
You must be signed in to change notification settings - Fork 238
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
Assert with v4l2loopback #43
Comments
This is the interteresting case. Try this: https://superuser.com/questions/411897/using-desktop-as-fake-webcam-on-linux After getting |
Thanks for the quick response. I've tried that and it works - for couple of seconds and then uStreamer dumps core with assertion (ffmpeg runs further without any errors nor interruption). See below
My system is recent Arch with kernel 5.4.61-1-lts #1 SMP Wed, 26 Aug 2020 18:35:48 +0000 x86_64 GNU/Linux . I'm running X11 with FVWM (i.e. very basice) window manager. I've connected to the mjpeg stream with Chromium 84.0.4147.105 (I used the trick I've also tried rgb24 and different |
Which version of ustreamer are you using? |
Okay, reproduced. |
This looks like a ustreamer bug, but it actually looks like a v4l2loopback bug. The device gives us two buffers with the index 0 and 1. The problem is (simplified):
Log
Because of the race situation, two workers try to encode and release the same buffer at the same time. Unlike regular software, ustreamer encodes buffers in parallel, so this bug might not have been noticed earlier. Can I ask you to report this issue to the v4l2loopback developer and talk to them? I have a lot of work on the main direction right now :( |
Sorry for coming back so late. Thanks for such speedy investigation! I'll try to report it to v4l2loopback and see what can be done. I'm though alsou certain ustreamer should not dump its core and somehow "skip" this inconsistency despite producing garbled or somehow distorted results. Dumping core is far worse in long running apps (which ustreamer is meant for) in practice than producing garbled/distorted results (ideally with a warning/error message for the first occurence of such issue). Btw. this is not an objection - I myself write asserts everywhere instead of logging and only if such real issues come up I'll "upgrade" the assert to a log message or whatever. I'd be happy if ustreamer took this approach this time as well 😉. Thoughts? |
This is an incorrect situation and I do not know the correct way to handle it. Okay, I'm skipping a frame, but what should I do with the buffer? Should I release him or not? Even if I have a solution in this particular case, I believe that it is better for the software to fall than to do something strange that can lead to system failure. |
There is no correct way to handle that 😉.
I'd probably release him and issue a warn/error message. Basically I'd try to get rid of everything pointing to (or being referenced) from the state which caused the issue.
Hm, I'd prefer to not break long running systems disregarding what the input device does. There might even exist HW behaving in such strange ways. Why would you prefer falling instead of gracefully "handling" it by "forgetting about the issue"? |
Good point.
Minor errors can always be ignored, but what you found is a fundamental driver problem. It can be dangerous to continue working. Incorrect behavior can be caused by anything. What if the driver damages the kernel memory if I continue working? The problem should be fixed, not just ignored, even with a warning.
I didn't say I wouldn't do anything about this problem :) First I have to find out if it's even possible to work in this situation. If not, assert will be the best solution. Like this:
|
Okay, I changed my mind. I think in this situation, I can report the error message and reinitialize the device. |
Okay, now in master is my fix for this problem. Ustreamer doesn't crash with an assert, it just closes the stream with the error and opens it again:
Given that this is incorrect driver behavior with memory corruption, this is all I can do. As a temporary solution for v4l2loopback I suggest using a single buffer using uStreamer option |
Feel free to reopen if needed. |
Thanks a lot! I'll test once there is a new release with this patch. |
Does anyone have any idea how to use uStreamer (patched if needed) for low-latency streaming of desktop (whole or at least a given window) into mjpeg?
The text was updated successfully, but these errors were encountered: