aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/v4l2.c
diff options
context:
space:
mode:
authorLuca Abeni <lucabe72@email.it>2006-10-22 09:56:08 +0000
committerLuca Abeni <lucabe72@email.it>2006-10-22 09:56:08 +0000
commit7c7e7464e3f49e9a1fa98b06c4261e75ce71290b (patch)
tree435a56f37312e0eacdddfc7ce8c1b77f9ab98938 /libavformat/v4l2.c
parent39a94d24f7e7a71f13faf51856d5b13f5db239eb (diff)
downloadandroid_external_ffmpeg-7c7e7464e3f49e9a1fa98b06c4261e75ce71290b.tar.gz
android_external_ffmpeg-7c7e7464e3f49e9a1fa98b06c4261e75ce71290b.tar.bz2
android_external_ffmpeg-7c7e7464e3f49e9a1fa98b06c4261e75ce71290b.zip
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) Originally committed as revision 6756 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/v4l2.c')
-rw-r--r--libavformat/v4l2.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/v4l2.c b/libavformat/v4l2.c
index 10841aa5dc..00adccaa80 100644
--- a/libavformat/v4l2.c
+++ b/libavformat/v4l2.c
@@ -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;