aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2010-05-08 07:55:42 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 13:06:03 -0400
commitd6b6d7aef458e1c1ce6997929d38aaa48fe637c2 (patch)
tree2f937c093e04cb4063633535ff528a2f1cb5e59f /drivers
parentccfb30288228aaaf40a849bffe434bc9eb46b23c (diff)
V4L/DVB: gspca_ovfx2: drop first frames in stream if not synced
With the ovfx2 bridge sometimes the first few frames in a stream would be no good, as the bridge and sensor are not in complete hsync / vsync yet. This can easily be detected by checking the framesize. So if the framesize is short and it is one of the 1ste 3 frames after an sd_start, drop it. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/gspca/ov519.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index f36e11a0458d..aa3de2f5a272 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -90,6 +90,7 @@ struct sd {
90#define QUALITY_DEF 50 90#define QUALITY_DEF 50
91 91
92 __u8 stopped; /* Streaming is temporarily paused */ 92 __u8 stopped; /* Streaming is temporarily paused */
93 __u8 first_frame;
93 94
94 __u8 frame_rate; /* current Framerate */ 95 __u8 frame_rate; /* current Framerate */
95 __u8 clockdiv; /* clockdiv override */ 96 __u8 clockdiv; /* clockdiv override */
@@ -3961,6 +3962,8 @@ static int sd_start(struct gspca_dev *gspca_dev)
3961 sd_reset_snapshot(gspca_dev); 3962 sd_reset_snapshot(gspca_dev);
3962 sd->snapshot_pressed = 0; 3963 sd->snapshot_pressed = 0;
3963 3964
3965 sd->first_frame = 3;
3966
3964 ret = ov51x_restart(sd); 3967 ret = ov51x_restart(sd);
3965 if (ret < 0) 3968 if (ret < 0)
3966 goto out; 3969 goto out;
@@ -4153,13 +4156,25 @@ static void ovfx2_pkt_scan(struct gspca_dev *gspca_dev,
4153 u8 *data, /* isoc packet */ 4156 u8 *data, /* isoc packet */
4154 int len) /* iso packet length */ 4157 int len) /* iso packet length */
4155{ 4158{
4159 struct sd *sd = (struct sd *) gspca_dev;
4160 struct gspca_frame *frame;
4161
4162 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
4163
4156 /* A short read signals EOF */ 4164 /* A short read signals EOF */
4157 if (len < OVFX2_BULK_SIZE) { 4165 if (len < OVFX2_BULK_SIZE) {
4158 gspca_frame_add(gspca_dev, LAST_PACKET, data, len); 4166 /* If the frame is short, and it is one of the first ones
4167 the sensor and bridge are still syncing, so drop it. */
4168 if (sd->first_frame) {
4169 sd->first_frame--;
4170 frame = gspca_get_i_frame(gspca_dev);
4171 if (!frame || (frame->data_end - frame->data) <
4172 (sd->gspca_dev.width * sd->gspca_dev.height))
4173 gspca_dev->last_packet_type = DISCARD_PACKET;
4174 }
4175 gspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);
4159 gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0); 4176 gspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);
4160 return;
4161 } 4177 }
4162 gspca_frame_add(gspca_dev, INTER_PACKET, data, len);
4163} 4178}
4164 4179
4165static void sd_pkt_scan(struct gspca_dev *gspca_dev, 4180static void sd_pkt_scan(struct gspca_dev *gspca_dev,