I am trying to implement a multi-camera setup with the Xavier. I have 4 cameras connected to it. I also referred to samples/sensors/camera/camera_multiple_gmsl/main.cpp.
The sample suggests to call dwSensorCamera_readFrame() in the same thread. (dwSensorCamera_readFrame() is called for each camera sibling ID in a simple ‘for’ loop). I was wondering if it was possible to have a separate thread for each camera to read frames. When I tried to implement such an architecture, I ended up with DW_FAILURE errors when I was trying to call dwSensorCamera_returnFrame(). It eventually led to DW_TIMEOUT in dwSensorCamera_readFrame() since the frames failed to be returned successfully.
I am surprised to see that the dwSensorCamera_returnFrame() API does not return a DW_FAILURE according to the docs. I encounter a “DW_FAILURE” when I call dwSensorCamera_returnFrame(). (Error code 33)
If it helps, my camera params are :
“camera-type=ar0231-rccb-bae-sf3324,”
“camera-group=a,”
“camera-count=4,”
“camera-mask=1111”
and I am using Drive Software 9.
When I try to read/return frames on the same thread for all 4 cameras, it seems to be working. However, I would still like to have a separate thread for each camera.
DriveWorks functions are thread-unsafe unless stated otherwise (see “Memory Management Policies and Multithreading”). Try synchronizing so that only a single call related to the dwSensorObject is in flight at any time.