summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-06-14 22:58:53 +0200
committerhans@rhel5-devel.localdomain <hans@rhel5-devel.localdomain>2009-06-14 22:58:53 +0200
commita48e6ba1941c59fc3fee73372eec6d3931000982 (patch)
tree4c8a4768d77fd9a022f1d52308dc248b1a52b7fd
parentb0d33e19d6aa45f2c7504810f971d1b607faf88c (diff)
downloadmediapointer-dvb-s2-a48e6ba1941c59fc3fee73372eec6d3931000982.tar.gz
mediapointer-dvb-s2-a48e6ba1941c59fc3fee73372eec6d3931000982.tar.bz2
libv4l: Detect ov518 decompression errors
From: Hans de Goede <hdegoede@redhat.com> Sometimes the ov518 gives us an incomplete frame, detect this and throw it away. Priority: normal Signed-off-by: Hans de Goede <hdegoede@redhat.com>
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c4
-rw-r--r--v4l2-apps/libv4l/libv4lconvert/ov518-decomp.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
index fe3185018..998bc154d 100644
--- a/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
+++ b/v4l2-apps/libv4l/libv4lconvert/libv4lconvert.c
@@ -658,7 +658,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
if (v4lconvert_helper_decompress(data, LIBDIR "/libv4l/ov511-decomp",
src, src_size, d, d_size, width, height, yvu)) {
/* Corrupt frame, better get another one */
- errno = -EAGAIN;
+ errno = EAGAIN;
return -1;
}
break;
@@ -666,7 +666,7 @@ static int v4lconvert_convert_pixfmt(struct v4lconvert_data *data,
if (v4lconvert_helper_decompress(data, LIBDIR "/libv4l/ov518-decomp",
src, src_size, d, d_size, width, height, yvu)) {
/* Corrupt frame, better get another one */
- errno = -EAGAIN;
+ errno = EAGAIN;
return -1;
}
break;
diff --git a/v4l2-apps/libv4l/libv4lconvert/ov518-decomp.c b/v4l2-apps/libv4l/libv4lconvert/ov518-decomp.c
index f8f37649e..51b8d8c60 100644
--- a/v4l2-apps/libv4l/libv4lconvert/ov518-decomp.c
+++ b/v4l2-apps/libv4l/libv4lconvert/ov518-decomp.c
@@ -1325,7 +1325,7 @@ decompress420NoMMXOV518(unsigned char *pIn,
return 1;
/* Did we decode enough? */
- if (cinfo->bytes >= cinfo->rawLen - 897)
+ if (cinfo->bytes >= cinfo->rawLen - (897 + 64))
return 0;
else
return 1;
@@ -1420,7 +1420,8 @@ static int v4lconvert_ov518_to_yuv420(unsigned char *src, unsigned char *dst,
return -1;
/* Decompress, skipping the 8-byte SOF header */
- decompress420NoMMXOV518(src + 8, dst, pTmp, w, h, numpix, &cinfo, yvu);
+ if (decompress420NoMMXOV518(src + 8, dst, pTmp, w, h, numpix, &cinfo, yvu))
+ return -1;
return 0;
}