Closed EtomicBomb closed 2 years ago
I'm going to test this later. Returning an error (or None in the case of next()
should definitely be the default behavior.
Okay, I was able to reproduce this.
Do you want to work on a PR that adds something like a set_timeout(..)
and a poll(..)
method to the two stream implementations in src/io/{mmap, userptr}/stream.rs
?
The next()
method should then perform the polling and return None
in case of timeout I think. I'm going to merge the next
branch into master today or tomorrow, so I'd advise to start on top of that branch instead of the current master.
I had the same problem when using: https://github.com/loyd/rscam
With the changes here https://github.com/loyd/rscam/pull/32/files timeout can be added and also the pselect
will return an error when the camera is unplugged.
When I start a stream and unplug the camera, the
stream.next()
call blocks forever. It would be nice if I could set a timeout. Perhaps I'm missing something, but I can't see a way to do that in this library. It seems like there's a poll function that's made for this. Perhaps this should be the standard behavior - I think most users would expect an error when a camera is unplugged.