summaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gspca.c
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2012-01-04 13:44:02 -0300
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 08:52:54 -0200
commit18bef42c2d9a63e028261b88e9202b6d0d34292b (patch)
tree554e1518e9d117c47b56c61efd818f50ef48b857 /drivers/media/video/gspca/gspca.c
parent965b37a477915b75ec09cd38d077d0eee9e71abf (diff)
downloadop-kernel-dev-18bef42c2d9a63e028261b88e9202b6d0d34292b.zip
op-kernel-dev-18bef42c2d9a63e028261b88e9202b6d0d34292b.tar.gz
[media] gspca - main: Change the bandwidth estimation of isochronous transfer
Having: - a mean image size of 0.375 time the max compressed image size and - a frame rate of 30 fps for small images or with USB 2.0/3.0 seems more realistic and gives less image freezes. Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gspca.c')
-rw-r--r--drivers/media/video/gspca/gspca.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index 5ce3557..cdd43ff 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -633,13 +633,14 @@ static u32 which_bandwidth(struct gspca_dev *gspca_dev)
u32 bandwidth;
int i;
+ /* get the (max) image size */
i = gspca_dev->curr_mode;
bandwidth = gspca_dev->cam.cam_mode[i].sizeimage;
- /* if the image is compressed, estimate the mean image size */
+ /* if the image is compressed, estimate its mean size */
if (bandwidth < gspca_dev->cam.cam_mode[i].width *
gspca_dev->cam.cam_mode[i].height)
- bandwidth /= 3;
+ bandwidth = bandwidth * 3 / 8; /* 0.375 */
/* estimate the frame rate */
if (gspca_dev->sd_desc->get_streamparm) {
@@ -649,7 +650,14 @@ static u32 which_bandwidth(struct gspca_dev *gspca_dev)
gspca_dev->sd_desc->get_streamparm(gspca_dev, &parm);
bandwidth *= parm.parm.capture.timeperframe.denominator;
} else {
- bandwidth *= 15; /* 15 fps */
+
+ /* don't hope more than 15 fps with USB 1.1 and
+ * image resolution >= 640x480 */
+ if (gspca_dev->width >= 640
+ && gspca_dev->dev->speed == USB_SPEED_FULL)
+ bandwidth *= 15; /* 15 fps */
+ else
+ bandwidth *= 30; /* 30 fps */
}
PDEBUG(D_STREAM, "min bandwidth: %d", bandwidth);
OpenPOWER on IntegriCloud