aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/gspca/gspca.c33
-rw-r--r--drivers/media/video/gspca/gspca.h1
2 files changed, 22 insertions, 12 deletions
diff --git a/drivers/media/video/gspca/gspca.c b/drivers/media/video/gspca/gspca.c
index e4c998965ab2..4694dc14a249 100644
--- a/drivers/media/video/gspca/gspca.c
+++ b/drivers/media/video/gspca/gspca.c
@@ -102,6 +102,22 @@ static struct vm_operations_struct gspca_vm_ops = {
102 .close = gspca_vm_close, 102 .close = gspca_vm_close,
103}; 103};
104 104
105/* get the current input frame buffer */
106struct gspca_frame *gspca_get_i_frame(struct gspca_dev *gspca_dev)
107{
108 struct gspca_frame *frame;
109 int i;
110
111 i = gspca_dev->fr_i;
112 i = gspca_dev->fr_queue[i];
113 frame = &gspca_dev->frame[i];
114 if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
115 != V4L2_BUF_FLAG_QUEUED)
116 return NULL;
117 return frame;
118}
119EXPORT_SYMBOL(gspca_get_i_frame);
120
105/* 121/*
106 * fill a video frame from an URB and resubmit 122 * fill a video frame from an URB and resubmit
107 */ 123 */
@@ -110,7 +126,7 @@ static void fill_frame(struct gspca_dev *gspca_dev,
110{ 126{
111 struct gspca_frame *frame; 127 struct gspca_frame *frame;
112 __u8 *data; /* address of data in the iso message */ 128 __u8 *data; /* address of data in the iso message */
113 int i, j, len, st; 129 int i, len, st;
114 cam_pkt_op pkt_scan; 130 cam_pkt_op pkt_scan;
115 131
116 if (urb->status != 0) { 132 if (urb->status != 0) {
@@ -124,11 +140,8 @@ static void fill_frame(struct gspca_dev *gspca_dev,
124 for (i = 0; i < urb->number_of_packets; i++) { 140 for (i = 0; i < urb->number_of_packets; i++) {
125 141
126 /* check the availability of the frame buffer */ 142 /* check the availability of the frame buffer */
127 j = gspca_dev->fr_i; 143 frame = gspca_get_i_frame(gspca_dev);
128 j = gspca_dev->fr_queue[j]; 144 if (!frame) {
129 frame = &gspca_dev->frame[j];
130 if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
131 != V4L2_BUF_FLAG_QUEUED) {
132 gspca_dev->last_packet_type = DISCARD_PACKET; 145 gspca_dev->last_packet_type = DISCARD_PACKET;
133 break; 146 break;
134 } 147 }
@@ -185,7 +198,6 @@ static void bulk_irq(struct urb *urb
185{ 198{
186 struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context; 199 struct gspca_dev *gspca_dev = (struct gspca_dev *) urb->context;
187 struct gspca_frame *frame; 200 struct gspca_frame *frame;
188 int j;
189 201
190 PDEBUG(D_PACK, "bulk irq"); 202 PDEBUG(D_PACK, "bulk irq");
191 if (!gspca_dev->streaming) 203 if (!gspca_dev->streaming)
@@ -199,11 +211,8 @@ static void bulk_irq(struct urb *urb
199 } 211 }
200 212
201 /* check the availability of the frame buffer */ 213 /* check the availability of the frame buffer */
202 j = gspca_dev->fr_i; 214 frame = gspca_get_i_frame(gspca_dev);
203 j = gspca_dev->fr_queue[j]; 215 if (!frame) {
204 frame = &gspca_dev->frame[j];
205 if ((frame->v4l2_buf.flags & BUF_ALL_FLAGS)
206 != V4L2_BUF_FLAG_QUEUED) {
207 gspca_dev->last_packet_type = DISCARD_PACKET; 216 gspca_dev->last_packet_type = DISCARD_PACKET;
208 } else { 217 } else {
209 PDEBUG(D_PACK, "packet l:%d", urb->actual_length); 218 PDEBUG(D_PACK, "packet l:%d", urb->actual_length);
diff --git a/drivers/media/video/gspca/gspca.h b/drivers/media/video/gspca/gspca.h
index 78a35a88cf97..72a288573051 100644
--- a/drivers/media/video/gspca/gspca.h
+++ b/drivers/media/video/gspca/gspca.h
@@ -178,6 +178,7 @@ struct gspca_frame *gspca_frame_add(struct gspca_dev *gspca_dev,
178 struct gspca_frame *frame, 178 struct gspca_frame *frame,
179 const __u8 *data, 179 const __u8 *data,
180 int len); 180 int len);
181struct gspca_frame *gspca_get_i_frame(struct gspca_dev *gspca_dev);
181#ifdef CONFIG_PM 182#ifdef CONFIG_PM
182int gspca_suspend(struct usb_interface *intf, pm_message_t message); 183int gspca_suspend(struct usb_interface *intf, pm_message_t message);
183int gspca_resume(struct usb_interface *intf); 184int gspca_resume(struct usb_interface *intf);