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

RPI stream error: Failed to queue buffer for ISP Input #236

Closed
Sharsie opened this issue Jan 29, 2022 · 7 comments
Closed

RPI stream error: Failed to queue buffer for ISP Input #236

Sharsie opened this issue Jan 29, 2022 · 7 comments

Comments

@Sharsie
Copy link

Sharsie commented Jan 29, 2022

I'm having an issue with libcamera-vid after it runs for a while. I tried several output targets as I started with udp/tcp streaming, saving to nfs and finally tried saving the files locally to eliminate any issues with networking.

I tried multiple resolutions, ended up running it at half of the camera, but it made no difference (camera is Waveshare RPi IR-CUT Camera (B)). It's running without a timeout and at some point (usually within 1-2 minutes), I receive an error rpi_stream.cpp:242 Failed to queue buffer for ISP Input at which point it just stops outputting.

However, the libcamera-vid command keeps running and I have to kill it manually. I was initially blaming the memory, but it never peaked over a 100mb threshold of 400mb available, so I kinda ruled that out and I'm out of ideas. I can't really find any relevant information, so any suggestions on where to start or how to help debugging this would be very appreciated.

I also tried running the command with LIBCAMERA_LOG_LEVELS=0, however it started producing about 4-5 times smaller files that were all about 2.5MB (10s segments at 1292x972) and could not be opened, however I never received the error. So I am unsure of what happened there.

Bug report

camera-bug-report

Additional context

I am running a clean install of Raspberry Pi OS Lite that only includes ssh access and wifi connection

@naushir
Copy link
Collaborator

naushir commented Jan 31, 2022

** uname -a **
Linux kingston21348751933 5.10.92+ #1514 Mon Jan 17 17:35:21 GMT 2022 armv6l GNU/Linux

This seems to be a custom kernel you are running. Can you switch to the Raspberry Pi downstream kernel and try this again?

@naushir
Copy link
Collaborator

naushir commented Jan 31, 2022

I can reproduce this on the RPi kernel as well. Will investigate to see what could be the cause.

@Sharsie
Copy link
Author

Sharsie commented Jan 31, 2022

Thank you, I am unaware of having a custom kernel though, I tried motioneyeOS previously, but it would be very silly of me if I flashed wrong file instead of RPi OS (though I have not ruled that out, will investigate once I am back home).
As far as I know, I flashed RPi OS lite that I downloaded on 30th of October 2021, updated with apt during this weekend and that's pretty much it.
I'll start by reflashing a clean version of latest rpi os to make sure i'm not running anything weird. I'll be happy to help with any debugging if needed from tomorrow onwards.
Thanks a lot for looking into it.

@naushir
Copy link
Collaborator

naushir commented Jan 31, 2022

I'll start by reflashing a clean version of latest rpi os to make sure i'm not running anything weird.

Looks like this problem exists in the RPi kernel as well, since I am able to reproduce it. I doubt you would get any better results if you try with it as well :-)

@naushir
Copy link
Collaborator

naushir commented Feb 1, 2022

We have identified the cause of this problem, and a fix has been submitted for review/merge here. Hopefully this should be merged very soon.

@Sharsie
Copy link
Author

Sharsie commented Feb 1, 2022

That's great news, thank you very much!

kbingham pushed a commit to kbingham/libcamera that referenced this issue Feb 1, 2022
…nput stream

The ISP input stream currently only allocates a single slot in the
V4L2VideoDevice cache as it follows the number of buffers allocated for use.
However, this is wrong as the ISP input stream imports buffers from Unicam
image stream.  As a consequence of this, only one cache slot was used during
runtime for the ISP input stream, and if multiple buffers were to be queued
simultaneously, the queue operation would return a failure.

Fix this by passing the same number of RAW buffers available from the Unicam
image stream. Additionally, double this count in the cases where buffers could
be allocated externally from the application.

Bug: raspberrypi/rpicam-apps#236
Bug: raspberrypi/rpicam-apps#238
Bug: raspberrypi/rpicam-apps#240
Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
@naushir
Copy link
Collaborator

naushir commented Feb 2, 2022

The fixes for this issue have now been merged. You can get the latest libraries by doing:

sudo apt update
sudo apt upgrade

I'll close this issue down now, please re-open if you still have problems.

@naushir naushir closed this as completed Feb 2, 2022
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

2 participants