ayufan / camera-streamer

High-performance low-latency camera streamer for Raspberry PI's
291 stars 46 forks source link

Fix bytesperline calculation for libcamera0.2 #140

Closed KapJI closed 3 months ago

KapJI commented 4 months ago

For libcamera0.2 configuration.stride is already set to some incorrect value and configurations->validate() doesn't update it if it's not 0.

For libcamera0.1 it was set to 0. So set it to 0 manually to make sure configurations->validate() computes the correct value.

Before:

device/buffer_list.c: CAMERA:capture: Using: 1920x1080/YUYV, buffers=3, bytesperline=3840, sizeimage=0.0MiB
device/buffer_list.c: CAMERA:capture:1: Using: 2304x1296/BG10, buffers=3, bytesperline=5760, sizeimage=0.0MiB
ERROR V4L2 v4l2_videodevice.cpp:1697 /dev/video13[26:out]: Failed to queue buffer 0: Invalid argument
ERROR RPISTREAM rpi_stream.cpp:276 Failed to queue buffer for ISP Input

After:

device/buffer_list.c: CAMERA:capture: Using: 1920x1080/YUYV, buffers=3, bytesperline=3840, sizeimage=0.0MiB
device/buffer_list.c: CAMERA:capture:1: Using: 2304x1296/BG10, buffers=3, bytesperline=2880, sizeimage=0.0MiB

Tested both with libcamera0.1 and libcamera0.2 on raspberry pi 4. Errors are gone and streaming works fine with libcamera0.2 finally.

Thanks to @tom-ard for help with debugging.

Fixes #139

arcadien commented 4 months ago

fixes #138

arcadien commented 4 months ago

Thanks for the debug!

automiketic commented 3 months ago

I just came to say thanks @KapJI ! I spent the last 4 hours troubleshooting my camera then found this. I made the change and instantly I'm up and running!. @ayufan please pull this ASAP. I found my way here from crowsnest and it was not an easy journey lol.

ETE-Design commented 2 months ago

@ayufan Can you pls. "Merge" this again? Seems like the files to download Expired - Or even better make a new "Release"

DropbearNinja commented 1 month ago

Where do you set configuration.stride = 0?