ionvideo: Fixed fillbuffer failure causes throwing buffer
authorRenjiang Han <renjiang.han@amlogic.com>
Tue, 31 Oct 2017 09:22:45 +0000 (17:22 +0800)
committerJianxin Pan <jianxin.pan@amlogic.com>
Tue, 31 Oct 2017 13:39:16 +0000 (06:39 -0700)
PD#152274: Fixed fillbuffer failure causes throwing buffer

Change-Id: Icafef860f57073ba2fc8417e2287f46c9acf9f72
Signed-off-by: Renjiang Han <renjiang.han@amlogic.com>
drivers/amlogic/media/video_processor/ionvideo/ionvideo.c

index 2e7d96e..1a92995 100644 (file)
@@ -386,17 +386,20 @@ static void ionvideo_thread_tick(struct ionvideo_dev *dev)
                return;
        }
        mutex_lock(&dev->mutex_input);
-       if (v4l2q_empty(&dev->input_queue)) {
+       buf = v4l2q_peek(&dev->input_queue);
+       if (buf == NULL) {
                dprintk(dev, 3, "No active queue to serve\n");
                mutex_unlock(&dev->mutex_input);
                schedule_timeout_interruptible(msecs_to_jiffies(20));
                return;
        }
-       buf = v4l2q_pop(&dev->input_queue);
        mutex_unlock(&dev->mutex_input);
        /* Fill buffer */
        if (ionvideo_fillbuff(dev, buf))
                return;
+       mutex_lock(&dev->mutex_input);
+       buf = v4l2q_pop(&dev->input_queue);
+       mutex_unlock(&dev->mutex_input);
        dev->vf_wait_cnt = 0;
 
        mutex_lock(&dev->mutex_output);