Commit 0b053777 authored by lucabe's avatar lucabe

Make read_packet fail is the v4l2 driver returns an unexpected frame size

(driver's bug? If not, we will have to support this in some way)


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@6756 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 5fc177cd
......@@ -308,7 +308,12 @@ static int mmap_read_frame(struct video_data *s, void *frame, int64_t *ts)
return -1;
}
assert (buf.index < s->buffers);
assert(buf.bytesused == s->frame_size);
if (buf.bytesused != s->frame_size) {
av_log(NULL, AV_LOG_ERROR, "The v4l2 frame is %d bytes, but %d bytes are expected\n", buf.bytesused, s->frame_size);
return -1;
}
/* Image is at s->buff_start[buf.index] */
memcpy(frame, s->buf_start[buf.index], buf.bytesused);
*ts = buf.timestamp.tv_sec * int64_t_C(1000000) + buf.timestamp.tv_usec;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment