mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-07-18 01:31:54 +00:00
Add option to which allows to handle truncated frames. (#289)
Extension of c96559e4ac.
Some cheap Chinise cameras produces frames which are detected as 'broken'. However they
are later handled well.
Introduce an option which allows disable the check on demand.
This commit is contained in:
@@ -544,8 +544,8 @@ bool _capture_is_buffer_valid(const us_capture_s *cap, const struct v4l2_buffer
|
||||
const u8 *const eoi_ptr = end_ptr - 2;
|
||||
const u16 eoi_marker = (((u16)(eoi_ptr[0]) << 8) | eoi_ptr[1]);
|
||||
if (eoi_marker != 0xFFD9 && eoi_marker != 0xD900 && eoi_marker != 0x0000) {
|
||||
_LOG_DEBUG("Discarding truncated JPEG frame: eoi_marker=0x%04x, bytesused=%u", eoi_marker, buf->bytesused);
|
||||
return false;
|
||||
_LOG_DEBUG("Got truncated JPEG frame: eoi_marker=0x%04x, bytesused=%u", eoi_marker, buf->bytesused);
|
||||
return cap->allow_truncated_frames;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,6 +119,7 @@ typedef struct {
|
||||
uint timeout;
|
||||
us_controls_s ctl;
|
||||
us_capture_runtime_s *run;
|
||||
bool allow_truncated_frames;
|
||||
} us_capture_s;
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user