read() returns wrong length
Bug #796141 reported by
Neil Whelchel
This bug affects 2 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
python-v4l2capture |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
A call to read() and read_and_queue() return a string the length of the buffer, not the size of the payload.
The size of the buffer is usually much bigger than the actual image. The documentation for V4L2 shows that struct v4l2_buffer contains a field called bytesused, this is the actual payload size. It also contains a length field, which is the size of the buffer, and this is what is being used by read() when it should be bytesused.
Changed in python-v4l2-capture: | |
status: | New → In Progress |
Changed in python-v4l2-capture: | |
status: | In Progress → Fix Released |
To post a comment you must log in.
I ran into this problem a while ago but I forgot to send in the patch I wrote. I was trying to pass some image data between different modules in a project and realized that each read of a 320x240 webcam image generated 16MB of data!
I've attached a patch that I've been using for a while, seems to be working fine so far.