aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2012-01-04 11:44:02 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-01-06 05:52:54 -0500
commit18bef42c2d9a63e028261b88e9202b6d0d34292b (patch)
tree554e1518e9d117c47b56c61efd818f50ef48b857 /drivers/media/video
parent965b37a477915b75ec09cd38d077d0eee9e71abf (diff)
[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')
-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 5ce3557bde89..cdd43ff4aa02 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)
633 u32 bandwidth; 633 u32 bandwidth;
634 int i; 634 int i;
635 635
636 /* get the (max) image size */
636 i = gspca_dev->curr_mode; 637 i = gspca_dev->curr_mode;
637 bandwidth = gspca_dev->cam.cam_mode[i].sizeimage; 638 bandwidth = gspca_dev->cam.cam_mode[i].sizeimage;
638 639
639 /* if the image is compressed, estimate the mean image size */ 640 /* if the image is compressed, estimate its mean size */
640 if (bandwidth < gspca_dev->cam.cam_mode[i].width * 641 if (bandwidth < gspca_dev->cam.cam_mode[i].width *
641 gspca_dev->cam.cam_mode[i].height) 642 gspca_dev->cam.cam_mode[i].height)
642 bandwidth /= 3; 643 bandwidth = bandwidth * 3 / 8; /* 0.375 */
643 644
644 /* estimate the frame rate */ 645 /* estimate the frame rate */
645 if (gspca_dev->sd_desc->get_streamparm) { 646 if (gspca_dev->sd_desc->get_streamparm) {
@@ -649,7 +650,14 @@ static u32 which_bandwidth(struct gspca_dev *gspca_dev)
649 gspca_dev->sd_desc->get_streamparm(gspca_dev, &parm); 650 gspca_dev->sd_desc->get_streamparm(gspca_dev, &parm);
650 bandwidth *= parm.parm.capture.timeperframe.denominator; 651 bandwidth *= parm.parm.capture.timeperframe.denominator;
651 } else { 652 } else {
652 bandwidth *= 15; /* 15 fps */ 653
654 /* don't hope more than 15 fps with USB 1.1 and
655 * image resolution >= 640x480 */
656 if (gspca_dev->width >= 640
657 && gspca_dev->dev->speed == USB_SPEED_FULL)
658 bandwidth *= 15; /* 15 fps */
659 else
660 bandwidth *= 30; /* 30 fps */
653 } 661 }
654 662
655 PDEBUG(D_STREAM, "min bandwidth: %d", bandwidth); 663 PDEBUG(D_STREAM, "min bandwidth: %d", bandwidth);