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

Race hazard accessing camera between motion/static stream threads #21

Open
fridgemagnet3 opened this issue Jan 19, 2024 · 1 comment
Open

Comments

@fridgemagnet3
Copy link

There is, I think, a race hazard if you have clients using the MPJEG stream and static picture URL at the same time in that that that it is possible for both threads to be accessing the camera object at the same time. This can then result in bad things happening with regard to the memory buffer pointer returned from the camera class. I can very quickly crash the board under these conditions.

I think you need a semaphore around the camera object accesses - the attached patch seems to work for me.

Cheers,

Jon.

cam_race_hazard.diff.gz

@arkhipenko
Copy link
Owner

I actually did not care about static picture taking in this code at all. It is kind of a leftover from the example it was built upon.
The goal of this POC was to make multi-client video streaming work on VLC, Blynk App video feed and browsers.
So yeah, please go ahead and improve!
Thank you.

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