This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 1949991fe0b4672a2107ba767a943b0fec373c23
Author: Peter Bee <bijun...@xiaomi.com>
AuthorDate: Tue Feb 7 12:32:49 2023 +0800

    drivers/video: add sequence number to video frames
    
    Signed-off-by: Peter Bee <bijun...@xiaomi.com>
---
 drivers/video/video.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/video/video.c b/drivers/video/video.c
index ec66781efa..c2e587b496 100644
--- a/drivers/video/video.c
+++ b/drivers/video/video.c
@@ -119,6 +119,7 @@ struct video_type_inf_s
   struct v4l2_fract    frame_interval;
   video_framebuff_t    bufinf;
   FAR uint8_t          *bufheap;   /* for V4L2_MEMORY_MMAP buffers */
+  uint32_t             seqnum;
 };
 
 typedef struct video_type_inf_s video_type_inf_t;
@@ -701,6 +702,7 @@ static void change_video_state(FAR video_mng_t    *vmng,
               video_framebuff_get_vacant_container(&vmng->video_inf.bufinf);
       if (container != NULL)
         {
+          vmng->video_inf.seqnum = 0;
           start_capture(V4L2_BUF_TYPE_VIDEO_CAPTURE,
                         vmng->video_inf.nr_fmt,
                         vmng->video_inf.fmt,
@@ -1280,6 +1282,7 @@ static int video_qbuf(FAR struct video_mng_s *vmng,
             video_framebuff_get_vacant_container(&type_inf->bufinf);
           if (container != NULL)
             {
+              type_inf->seqnum = 0;
               start_capture(buf->type,
                             type_inf->nr_fmt,
                             type_inf->fmt,
@@ -3310,6 +3313,7 @@ static int video_complete_capture(uint8_t err_code, 
uint32_t datasize,
           IMGDATA_SET_BUF(g_video_data,
             (FAR uint8_t *)container->buf.m.userptr,
             container->buf.length);
+          container->buf.sequence = type_inf->seqnum++;
         }
     }
 

Reply via email to