diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-03-10 11:27:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-03-10 11:27:26 -0300 |
commit | cafc731a90a72a074c05cf2d7e4a67f3fa596b76 (patch) | |
tree | 251ff3c0ea4e48a563439d6e143a081ca7afe4fc /linux/drivers/media/video/em28xx/em28xx-core.c | |
parent | 463d9d496cf51caabf90b3f64ef602768600bbd1 (diff) | |
parent | 18af961f48808a7aaad697abc64a3c6ee405aef1 (diff) | |
download | mediapointer-dvb-s2-cafc731a90a72a074c05cf2d7e4a67f3fa596b76.tar.gz mediapointer-dvb-s2-cafc731a90a72a074c05cf2d7e4a67f3fa596b76.tar.bz2 |
merge: http://linuxtv.org/hg/~mkrufky/tuner
From: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/em28xx/em28xx-core.c')
-rw-r--r-- | linux/drivers/media/video/em28xx/em28xx-core.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/linux/drivers/media/video/em28xx/em28xx-core.c b/linux/drivers/media/video/em28xx/em28xx-core.c index efc0e4a99..1f6abc803 100644 --- a/linux/drivers/media/video/em28xx/em28xx-core.c +++ b/linux/drivers/media/video/em28xx/em28xx-core.c @@ -876,19 +876,27 @@ int em28xx_set_alternate(struct em28xx *dev) { int errCode, prev_alt = dev->alt; int i; - unsigned int min_pkt_size = dev->bytesperline+4; + unsigned int min_pkt_size = dev->bytesperline + 4; - /* When image size is bigger than a ceirtain value, + /* When image size is bigger than a certain value, the frame size should be increased, otherwise, only green screen will be received. */ if (dev->frame_size > 720*240*2) min_pkt_size *= 2; - for (i = 0; i < dev->num_alt; i++) - if (dev->alt_max_pkt_size[i] >= min_pkt_size) + for (i = 0; i < dev->num_alt; i++) { + /* stop when the selected alt setting offers enough bandwidth */ + if (dev->alt_max_pkt_size[i] >= min_pkt_size) { + dev->alt = i; break; - dev->alt = i; + /* otherwise make sure that we end up with the maximum bandwidth + because the min_pkt_size equation might be wrong... + */ + } else if (dev->alt_max_pkt_size[i] > + dev->alt_max_pkt_size[dev->alt]) + dev->alt = i; + } if (dev->alt != prev_alt) { em28xx_coredbg("minimum isoc packet size: %u (alt=%d)\n", |