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

CAP: Can't release HW buffer=1 (skipped frame): Cannot allocate memory #268

Open
breakingflower opened this issue Mar 26, 2024 · 4 comments

Comments

@breakingflower
Copy link

I'm getting the following on an RPI zero 2w and camera v3 noir:
Device:

  • RPI Zero 2W
  • Camera: v3 module NoIR
  • os: raspbian (debian) 12

Steps to reproduce:

  • fresh install latest raspbian image
    Do upgrades and install modules
sudo apt update && sudo apt -y upgrade
sudo apt install build-essential libevent-dev libjpeg-dev libbsd-dev git
git clone --depth=1 https://github.com/pikvm/ustreamer
cd ustreamer
make
sudo apt -y install libcamera-tools libcamera-v4l2
sudo modprobe bcm2835-v4l2
libcamerify ./ustreamer --host :: --encoder=m2m-image

Output:

pi@webcampi:~/ustreamer $ libcamerify ./ustreamer --host :: --encoder=m2m-image --debug
-- INFO  [220.678          ] -- Starting PiKVM uStreamer 6.7 ...
-- DEBUG [220.679          ] -- Installing SIGINT handler ...
-- DEBUG [220.679          ] -- Installing SIGTERM handler ...
-- DEBUG [220.679          ] -- Ignoring SIGPIPE ...
-- DEBUG [220.679          ] -- HTTP: Binding HTTP to [::]:8080 ...
-- INFO  [220.679          ] -- HTTP: Listening HTTP on [::]:8080
-- INFO  [220.680          ] -- Using V4L2 device: /dev/video0
-- INFO  [220.680          ] -- Using desired FPS: 0
-- INFO  [220.680          ] -- HTTP: Starting eventloop ...
-- DEBUG [220.680          ] -- CAP: Opening capture device ...
[0:03:40.681904693] [1439] ERROR IPAModule ipa_module.cpp:172 Symbol ipaModuleInfo not found
[0:03:40.682034484] [1439] ERROR IPAModule ipa_module.cpp:292 v4l2-compat.so: IPA module has no valid info
[0:03:40.682168024] [1439]  INFO Camera camera_manager.cpp:284 libcamera v0.2.0+46-075b54d5
-- DEBUG [220.696          ] -- HTTP: Repeating exposed ...
[0:03:40.837625987] [1441]  WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise
[0:03:40.843194123] [1441]  INFO RPI vc4.cpp:447 Registered camera /base/soc/i2c0mux/i2c@1/imx708@1a to Unicam device /dev/media3 and ISP device /dev/media0
-- DEBUG [220.844          ] -- CAP: Capture device fd=8 opened
-- DEBUG [220.844          ] -- CAP: Querying device capabilities ...
-- INFO  [220.844          ] -- CAP: Using capture type: single-planar
-- INFO  [220.844          ] -- CAP: Using input channel: 0
-- DEBUG [220.845          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [220.845          ] -- CAP: Probing device format=YUYV, stride=1280, resolution=640x480 ...
[0:03:40.845366450] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:40.846031133] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [220.848          ] -- CAP: Using resolution: 640x480
-- INFO  [220.849          ] -- CAP: Using format: YUYV
-- DEBUG [220.849          ] -- CAP: Querying HW FPS ...
-- INFO  [220.849          ] -- CAP: Querying HW FPS changing is not supported
-- INFO  [220.849          ] -- CAP: Using IO method: MMAP
-- DEBUG [220.849          ] -- CAP: Requesting 5 device buffers for MMAP ...
[0:03:40.849082829] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:40.849748866] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [220.855          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [220.856          ] -- CAP: Allocating device buffers ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [220.856          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [220.856          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [220.856          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [220.856          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [220.856          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [220.856          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [220.857          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [220.857          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [220.857          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- DEBUG [220.857          ] -- CAP: Exporting device buffer=0 to DMA ...
-- DEBUG [220.857          ] -- CAP: Exporting device buffer=1 to DMA ...
-- DEBUG [220.857          ] -- CAP: Exporting device buffer=2 to DMA ...
-- DEBUG [220.857          ] -- CAP: Exporting device buffer=3 to DMA ...
-- DEBUG [220.857          ] -- CAP: Exporting device buffer=4 to DMA ...
-- INFO  [221.002          ] -- CAP: Capturing started
-- DEBUG [221.002          ] -- Preparing M2M-IMAGE encoder ...
-- INFO  [221.002          ] -- JPEG-0: Initializing encoder ...
-- INFO  [221.002          ] -- JPEG-1: Initializing encoder ...
-- INFO  [221.002          ] -- JPEG-2: Initializing encoder ...
-- INFO  [221.002          ] -- JPEG-3: Initializing encoder ...
-- INFO  [221.003          ] -- Using JPEG quality: 80%
-- INFO  [221.003          ] -- Creating pool JPEG with 4 workers ...
-- DEBUG [221.003          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [221.003          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [221.003          ] -- Hello! I am a worker jw-1 ^_^
-- DEBUG [221.003          ] -- Worker jw-1 waiting for a new job ...
-- DEBUG [221.003          ] -- Hello! I am a worker jw-2 ^_^
-- DEBUG [221.003          ] -- Worker jw-2 waiting for a new job ...
-- DEBUG [221.003          ] -- Hello! I am a worker jw-3 ^_^
-- DEBUG [221.003          ] -- Worker jw-3 waiting for a new job ...
-- INFO  [221.004          ] -- Capturing ...
-- DEBUG [221.004          ] -- CAP: Calling select() on video device ...
-- DEBUG [221.250          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [221.251          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [221.251          ] -- CAP: Grabbed HW buffer=0: bytesused=614400, grab_ts=221.229, latency=0.022, skipped=0
-- PERF  [221.251          ] -- A new second has come; captured_fps=0
-- DEBUG [221.251          ] -- CAP: Calling select() on video device ...
......
-- VERB  [227.263          ] -- Compressed new JPEG: size=12129, time=0.012, worker=jw-0, buffer=0
-- DEBUG [227.263          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [227.283          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [227.283          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [227.284          ] -- CAP: Grabbed HW buffer=1: bytesused=614400, grab_ts=227.259, latency=0.025, skipped=0
-- DEBUG [227.284          ] -- CAP: Calling select() on video device ...
-- VERB  [227.284          ] -- Correcting pool's JPEG approx_job_time: 0.012 -> 0.012 (last_job_time=0.012)
-- VERB  [227.284          ] -- JPEG: Fluency: delay=0.003, grab_after=227.287
-- DEBUG [227.284          ] -- JPEG: Assigned new frame in buffer=1 to worker=jw-1
-- VERB  [227.284          ] -- Compressing JPEG using M2M-IMAGE: worker=jw-1, buffer=1
-- DEBUG [227.284          ] -- JPEG-1: Compressing new frame; force_key=0 ...
-- DEBUG [227.284          ] -- JPEG-1: Grabbing INPUT buffer ...
-- DEBUG [227.285          ] -- JPEG-1: Grabbed INPUT buffer=0
-- PERF  [227.285          ] -- JPEG: ##### Encoded JPEG exposed; worker=jw-0, latency=0.059
-- DEBUG [227.286          ] -- CAP: Releasing HW buffer=0 ...
-- DEBUG [227.287          ] -- CAP: HW buffer=0 released
-- DEBUG [227.289          ] -- HTTP: Updating exposed frame (online=1) ...
-- VERB  [227.289          ] -- HTTP: Exposed frame: online=1, exp_time=0.000000
-- DEBUG [227.291          ] -- JPEG-1: Sending (releasing) INPUT buffer ...
-- DEBUG [227.291          ] -- JPEG-1: Polling encoder ...
-- DEBUG [227.295          ] -- JPEG-1: Fetching OUTPUT buffer ...
-- DEBUG [227.295          ] -- JPEG-1: Releasing OUTPUT buffer=0 ...
-- VERB  [227.295          ] -- JPEG-1: Compressed new frame: size=12143, time=0.011, force_key=0
-- VERB  [227.295          ] -- Compressed new JPEG: size=12143, time=0.011, worker=jw-1, buffer=1
-- DEBUG [227.295          ] -- Worker jw-1 waiting for a new job ...
-- DEBUG [227.316          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [227.317          ] -- CAP: Grabbing hw buffer ...
-- DEBUG [227.317          ] -- CAP: Grabbed HW buffer=2: bytesused=614400, grab_ts=227.293, latency=0.024, skipped=0
-- DEBUG [227.317          ] -- CAP: Calling select() on video device ...
-- VERB  [227.317          ] -- Correcting pool's JPEG approx_job_time: 0.012 -> 0.012 (last_job_time=0.012)
-- VERB  [227.318          ] -- JPEG: Fluency: delay=0.003, grab_after=227.320
-- DEBUG [227.318          ] -- JPEG: Assigned new frame in buffer=2 to worker=jw-0
-- VERB  [227.318          ] -- Compressing JPEG using M2M-IMAGE: worker=jw-0, buffer=2
-- DEBUG [227.318          ] -- JPEG-0: Compressing new frame; force_key=0 ...
-- DEBUG [227.318          ] -- JPEG-0: Grabbing INPUT buffer ...
-- PERF  [227.319          ] -- JPEG: ##### Encoded JPEG exposed; worker=jw-1, latency=0.060
-- DEBUG [227.319          ] -- JPEG-0: Grabbed INPUT buffer=0
-- DEBUG [227.320          ] -- CAP: Releasing HW buffer=1 ...
-- DEBUG [227.320          ] -- CAP: HW buffer=1 released
-- DEBUG [227.321          ] -- HTTP: Updating exposed frame (online=1) ...
-- VERB  [227.321          ] -- HTTP: Exposed frame: online=1, exp_time=0.000000
-- DEBUG [227.325          ] -- JPEG-0: Sending (releasing) INPUT buffer ...
-- DEBUG [227.325          ] -- JPEG-0: Polling encoder ...
-- DEBUG [227.329          ] -- JPEG-0: Fetching OUTPUT buffer ...
-- DEBUG [227.329          ] -- JPEG-0: Releasing OUTPUT buffer=0 ...
-- VERB  [227.329          ] -- JPEG-0: Compressed new frame: size=12163, time=0.011, force_key=0
-- VERB  [227.329          ] -- Compressed new JPEG: size=12163, time=0.011, worker=jw-0, buffer=2
-- DEBUG [227.330          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [227.350          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [227.350          ] -- CAP: Grabbing hw buffer ...
-- ERROR [227.350          ] -- CAP: Can't grab HW buffer: Resource temporarily unavailable
-- INFO  [227.422          ] -- Destroying workers pool JPEG ...
-- DEBUG [227.422          ] -- Bye-bye (worker jw-0)
-- DEBUG [227.422          ] -- Bye-bye (worker jw-1)
-- DEBUG [227.423          ] -- Bye-bye (worker jw-2)
-- DEBUG [227.423          ] -- Bye-bye (worker jw-3)
-- DEBUG [227.423          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [227.437          ] -- CAP: Releasing HW buffers ...
-- INFO  [227.440          ] -- CAP: Capturing stopped
================================================================================
-- DEBUG [227.440          ] -- CAP: Opening capture device ...
-- DEBUG [227.441          ] -- CAP: Capture device fd=8 opened
-- DEBUG [227.441          ] -- CAP: Querying device capabilities ...
-- INFO  [227.441          ] -- CAP: Using capture type: single-planar
-- INFO  [227.441          ] -- CAP: Using input channel: 0
-- DEBUG [227.441          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [227.442          ] -- CAP: Probing device format=YUYV, stride=1280, resolution=640x480 ...
[0:03:47.442769705] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:47.445020992] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [227.447          ] -- CAP: Using resolution: 640x480
-- INFO  [227.448          ] -- CAP: Using format: YUYV
-- DEBUG [227.448          ] -- CAP: Querying HW FPS ...
-- INFO  [227.448          ] -- CAP: Querying HW FPS changing is not supported
-- INFO  [227.448          ] -- CAP: Using IO method: MMAP
-- DEBUG [227.448          ] -- CAP: Requesting 5 device buffers for MMAP ...
[0:03:47.448470916] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:47.449442680] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [227.458          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [227.458          ] -- CAP: Allocating device buffers ...
-- DEBUG [227.458          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [227.458          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [227.458          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [227.458          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [227.458          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [227.458          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [227.458          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [227.459          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [227.459          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [227.459          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- DEBUG [227.459          ] -- CAP: Exporting device buffer=0 to DMA ...
-- DEBUG [227.459          ] -- CAP: Exporting device buffer=1 to DMA ...
-- DEBUG [227.459          ] -- CAP: Exporting device buffer=2 to DMA ...
-- DEBUG [227.459          ] -- CAP: Exporting device buffer=3 to DMA ...
-- DEBUG [227.459          ] -- CAP: Exporting device buffer=4 to DMA ...
-- INFO  [227.583          ] -- CAP: Capturing started
-- DEBUG [227.583          ] -- Preparing M2M-IMAGE encoder ...
-- INFO  [227.583          ] -- Using JPEG quality: 80%
-- INFO  [227.583          ] -- Creating pool JPEG with 4 workers ...
-- DEBUG [227.584          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [227.584          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [227.584          ] -- Hello! I am a worker jw-1 ^_^
-- DEBUG [227.584          ] -- Worker jw-1 waiting for a new job ...
-- DEBUG [227.585          ] -- Hello! I am a worker jw-3 ^_^
-- DEBUG [227.585          ] -- Worker jw-3 waiting for a new job ...
-- DEBUG [227.585          ] -- Hello! I am a worker jw-2 ^_^
-- DEBUG [227.586          ] -- Worker jw-2 waiting for a new job ...
-- INFO  [227.586          ] -- Capturing ...
-- DEBUG [227.586          ] -- CAP: Calling select() on video device ...
-- DEBUG [227.613          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [227.613          ] -- CAP: Grabbing hw buffer ...
[0:03:47.613340982] [1439] ERROR V4L2Compat v4l2_camera_proxy.cpp:680 Failed to clear eventfd POLLIN
-- DEBUG [227.613          ] -- CAP: Dropped too small frame, assuming it was broken: buffer=1, bytesused=0
-- DEBUG [227.614          ] -- CAP: Releasing HW buffer=1 (broken frame) ...
[0:03:47.613772229] [1439] ERROR Request request.cpp:472 FrameBuffer already set for stream
[0:03:47.613892801] [1439] ERROR V4L2Compat v4l2_camera.cpp:259 Can't set buffer for request
-- ERROR [227.614          ] -- CAP: Can't release HW buffer=1 (broken frame): Cannot allocate memory
-- INFO  [227.686          ] -- Destroying workers pool JPEG ...
-- DEBUG [227.686          ] -- Bye-bye (worker jw-0)
-- DEBUG [227.686          ] -- Bye-bye (worker jw-1)
-- DEBUG [227.687          ] -- Bye-bye (worker jw-2)
-- DEBUG [227.687          ] -- Bye-bye (worker jw-3)
-- DEBUG [227.687          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [227.701          ] -- CAP: Releasing HW buffers ...
-- INFO  [227.704          ] -- CAP: Capturing stopped
================================================================================
-- DEBUG [227.706          ] -- CAP: Opening capture device ...
-- DEBUG [227.707          ] -- CAP: Capture device fd=8 opened
-- DEBUG [227.707          ] -- CAP: Querying device capabilities ...
-- INFO  [227.707          ] -- CAP: Using capture type: single-planar
-- INFO  [227.707          ] -- CAP: Using input channel: 0
-- DEBUG [227.707          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [227.707          ] -- CAP: Probing device format=YUYV, stride=1280, resolution=640x480 ...
[0:03:47.708395174] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:47.709811206] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [227.712          ] -- CAP: Using resolution: 640x480
-- INFO  [227.712          ] -- CAP: Using format: YUYV
-- DEBUG [227.712          ] -- CAP: Querying HW FPS ...
-- INFO  [227.712          ] -- CAP: Querying HW FPS changing is not supported
-- INFO  [227.712          ] -- CAP: Using IO method: MMAP
-- DEBUG [227.712          ] -- CAP: Requesting 5 device buffers for MMAP ...
[0:03:47.712990975] [1439]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:03:47.713875084] [1441]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [227.722          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [227.723          ] -- CAP: Allocating device buffers ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [227.723          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [227.723          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [227.723          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [227.723          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [227.723          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [227.723          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [227.724          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [227.724          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [227.724          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [227.724          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- DEBUG [227.724          ] -- CAP: Exporting device buffer=0 to DMA ...
-- DEBUG [227.724          ] -- CAP: Exporting device buffer=1 to DMA ...
-- DEBUG [227.724          ] -- CAP: Exporting device buffer=2 to DMA ...
-- DEBUG [227.724          ] -- CAP: Exporting device buffer=3 to DMA ...
-- DEBUG [227.724          ] -- CAP: Exporting device buffer=4 to DMA ...
-- INFO  [227.857          ] -- CAP: Capturing started
-- DEBUG [227.857          ] -- Preparing M2M-IMAGE encoder ...
-- INFO  [227.857          ] -- Using JPEG quality: 80%
-- INFO  [227.858          ] -- Creating pool JPEG with 4 workers ...
-- DEBUG [227.858          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [227.858          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [227.858          ] -- Hello! I am a worker jw-2 ^_^
-- DEBUG [227.859          ] -- Worker jw-2 waiting for a new job ...
-- DEBUG [227.859          ] -- Hello! I am a worker jw-1 ^_^
-- DEBUG [227.860          ] -- Hello! I am a worker jw-3 ^_^
-- DEBUG [227.860          ] -- Worker jw-3 waiting for a new job ...
-- DEBUG [227.860          ] -- Worker jw-1 waiting for a new job ...
-- INFO  [227.860          ] -- Capturing ...
-- DEBUG [227.860          ] -- CAP: Calling select() on video device ...
-- DEBUG [227.888          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [227.888          ] -- CAP: Grabbing hw buffer ...
[0:03:47.888327480] [1439] ERROR V4L2Compat v4l2_camera_proxy.cpp:680 Failed to clear eventfd POLLIN
[0:03:47.888508729] [1439] ERROR V4L2Compat v4l2_camera_proxy.cpp:680 Failed to clear eventfd POLLIN
[0:03:47.888609562] [1439] ERROR Request request.cpp:472 FrameBuffer already set for stream
[0:03:47.888666228] [1439] ERROR V4L2Compat v4l2_camera.cpp:259 Can't set buffer for request
-- ERROR [227.889          ] -- CAP: Can't release HW buffer=1 (skipped frame): Cannot allocate memory
-- INFO  [227.960          ] -- Destroying workers pool JPEG ...
-- DEBUG [227.961          ] -- Bye-bye (worker jw-0)
-- DEBUG [227.961          ] -- Bye-bye (worker jw-1)
-- DEBUG [227.961          ] -- Bye-bye (worker jw-2)
-- DEBUG [227.961          ] -- Bye-bye (worker jw-3)
-- DEBUG [227.962          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [227.975          ] -- CAP: Releasing HW buffers ...
-- INFO  [227.978          ] -- CAP: Capturing stopped
================================================================================
-- DEBUG [227.979          ] -- CAP: Opening capture device ...
-- DEBUG [227.980          ] -- CAP: Capture device fd=8 opened
-- DEBUG [227.980          ] -- CAP: Querying device capabilities ...
-- INFO  [227.981          ] -- CAP: Using capture type: single-planar
-- INFO  [227.981          ] -- CAP: Using input channel: 0
-- DEBUG [227.981          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [227.981          ] -- CAP: Probing device format=YUYV, stride=1280, resolution=640x480 ...

It seems there is something happening with releasing memory. When I open the stream page I notice the first seconds images are changing, then the module breaks & starts errorring and can't restore itself.

@breakingflower
Copy link
Author

Specifically this is repeating:

================================================================================
-- DEBUG [526.135          ] -- CAP: Opening capture device ...
-- DEBUG [526.136          ] -- CAP: Capture device fd=8 opened
-- DEBUG [526.136          ] -- CAP: Querying device capabilities ...
-- INFO  [526.136          ] -- CAP: Using capture type: single-planar
-- INFO  [526.136          ] -- CAP: Using input channel: 0
-- DEBUG [526.136          ] -- CAP: Using TV standard: DEFAULT
-- DEBUG [526.136          ] -- CAP: Probing device format=YUYV, stride=1280, resolution=640x480 ...
[0:08:46.137992840] [2993]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:08:46.139052634] [2984]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [526.141          ] -- CAP: Using resolution: 640x480
-- INFO  [526.141          ] -- CAP: Using format: YUYV
-- DEBUG [526.141          ] -- CAP: Querying HW FPS ...
-- INFO  [526.142          ] -- CAP: Querying HW FPS changing is not supported
-- INFO  [526.142          ] -- CAP: Using IO method: MMAP
-- DEBUG [526.142          ] -- CAP: Requesting 5 device buffers for MMAP ...
[0:08:46.142377586] [2993]  INFO Camera camera.cpp:1183 configuring streams: (0) 640x480-YUYV
[0:08:46.143375035] [2984]  INFO RPI vc4.cpp:611 Sensor: /base/soc/i2c0mux/i2c@1/imx708@1a - Selected sensor format: 1536x864-SBGGR10_1X10 - Selected unicam format: 1536x864-pBAA
-- INFO  [526.154          ] -- CAP: Requested 5 device buffers, got 5
-- DEBUG [526.154          ] -- CAP: Allocating device buffers ...
-- DEBUG [526.154          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=0 ...
-- DEBUG [526.154          ] -- CAP: Mapping device buffer=0 ...
-- DEBUG [526.154          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=1 ...
-- DEBUG [526.154          ] -- CAP: Mapping device buffer=1 ...
-- DEBUG [526.154          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=2 ...
-- DEBUG [526.154          ] -- CAP: Mapping device buffer=2 ...
-- DEBUG [526.154          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=3 ...
-- DEBUG [526.154          ] -- CAP: Mapping device buffer=3 ...
-- DEBUG [526.154          ] -- CAP: Calling us_xioctl(VIDIOC_QUERYBUF) for device buffer=4 ...
-- DEBUG [526.154          ] -- CAP: Mapping device buffer=4 ...
-- DEBUG [526.155          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=0 ...
-- DEBUG [526.155          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=1 ...
-- DEBUG [526.155          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=2 ...
-- DEBUG [526.155          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=3 ...
-- DEBUG [526.155          ] -- CAP: Calling us_xioctl(VIDIOC_QBUF) for buffer=4 ...
-- DEBUG [526.155          ] -- CAP: Exporting device buffer=0 to DMA ...
-- DEBUG [526.155          ] -- CAP: Exporting device buffer=1 to DMA ...
-- DEBUG [526.155          ] -- CAP: Exporting device buffer=2 to DMA ...
-- DEBUG [526.155          ] -- CAP: Exporting device buffer=3 to DMA ...
-- DEBUG [526.155          ] -- CAP: Exporting device buffer=4 to DMA ...
-- INFO  [526.288          ] -- CAP: Capturing started
-- DEBUG [526.289          ] -- Preparing M2M-IMAGE encoder ...
-- INFO  [526.289          ] -- Using JPEG quality: 80%
-- INFO  [526.289          ] -- Creating pool JPEG with 4 workers ...
-- DEBUG [526.289          ] -- Hello! I am a worker jw-0 ^_^
-- DEBUG [526.289          ] -- Worker jw-0 waiting for a new job ...
-- DEBUG [526.289          ] -- Hello! I am a worker jw-1 ^_^
-- DEBUG [526.290          ] -- Worker jw-1 waiting for a new job ...
-- DEBUG [526.290          ] -- Hello! I am a worker jw-2 ^_^
-- DEBUG [526.290          ] -- Worker jw-2 waiting for a new job ...
-- DEBUG [526.290          ] -- Hello! I am a worker jw-3 ^_^
-- DEBUG [526.290          ] -- Worker jw-3 waiting for a new job ...
-- INFO  [526.291          ] -- Capturing ...
-- DEBUG [526.291          ] -- CAP: Calling select() on video device ...
-- DEBUG [526.312          ] -- CAP: Device select() --> 1; has_read=1, has_error=0
-- DEBUG [526.312          ] -- CAP: Grabbing hw buffer ...
[0:08:46.312238065] [2993] ERROR V4L2Compat v4l2_camera_proxy.cpp:680 Failed to clear eventfd POLLIN
[0:08:46.312384419] [2993] ERROR V4L2Compat v4l2_camera_proxy.cpp:680 Failed to clear eventfd POLLIN
[0:08:46.312469628] [2993] ERROR Request request.cpp:472 FrameBuffer already set for stream
[0:08:46.312518118] [2993] ERROR V4L2Compat v4l2_camera.cpp:259 Can't set buffer for request
-- ERROR [526.313          ] -- CAP: Can't release HW buffer=1 (skipped frame): Cannot allocate memory
-- INFO  [526.391          ] -- Destroying workers pool JPEG ...
-- DEBUG [526.392          ] -- Bye-bye (worker jw-0)
-- DEBUG [526.392          ] -- Bye-bye (worker jw-1)
-- DEBUG [526.393          ] -- Bye-bye (worker jw-2)
-- DEBUG [526.393          ] -- Bye-bye (worker jw-3)
-- DEBUG [526.393          ] -- CAP: Calling VIDIOC_STREAMOFF ...
-- DEBUG [526.407          ] -- CAP: Releasing HW buffers ...
-- INFO  [526.410          ] -- CAP: Capturing stopped
================================================================================

@mdevaev
Copy link
Member

mdevaev commented Mar 26, 2024

It seems this is a problem inside libcamerify. I recommend to address it to its developers.

@davhenriques
Copy link

I am have the same hardware and having the same issue. Have you found any solution yet?

@mdevaev
Copy link
Member

mdevaev commented Jul 25, 2024

Try sudo modprobe bcm2835-v4l2 and then start ustreamer via libcamerify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants