[BUGFIX #299] Do not exit thread upon EAGAIN error when fetching frames #301
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To use the latest Camera v3 from Raspberry Pi, we need to use libcamerify which is a V4L2 compatibility layer preload.
libcamerify -d v4l2rtspserver
I don't know if it is due to libcamerify, but sometimes the camera seems to be temporary unavailable:
[NOTICE] /home/azsde/v4l2rtspserver/src/V4L2DeviceSource.cpp:203
V4L2DeviceSource::getNextFrame errno:11 Resource temporarily unavailable
[ERROR] /home/azsde/v4l2rtspserver/src/V4L2DeviceSource.cpp:111
error:Resource temporarily unavailable
[NOTICE] /home/azsde/v4l2rtspserver/src/V4L2DeviceSource.cpp:122
This causes v4l2rtspserver to hang indefinitely.
Looking into the code, it seems that if V4L2DeviceSource cannot get the next frame, it will stop the thread in charge of fetching the the frames, not matter what error we have.
Instead of doing so, we check the errno for the EAGAIN value and do not exit if errno equals EAGAIN.