This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: coda: fix mpeg2 sequence number handling
Author:  Philipp Zabel <[email protected]>
Date:    Tue Jun 18 12:45:10 2019 -0400

Sequence number handling assumed that the BIT processor frame number
starts counting at 1, but this is not true for the MPEG-2 decoder,
which starts at 0. Fix the sequence counter offset detection to handle
this.

Signed-off-by: Philipp Zabel <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/platform/coda/coda-bit.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

---

diff --git a/drivers/media/platform/coda/coda-bit.c 
b/drivers/media/platform/coda/coda-bit.c
index 06a352659bae..45ffe2e87e0a 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1746,6 +1746,7 @@ static int __coda_start_decoding(struct coda_ctx *ctx)
                v4l2_err(&dev->v4l2_dev, "CODA_COMMAND_SEQ_INIT timeout\n");
                return ret;
        }
+       ctx->sequence_offset = ~0U;
        ctx->initialized = 1;
 
        /* Update kfifo out pointer from coda bitstream read pointer */
@@ -2169,7 +2170,9 @@ static void coda_finish_decode(struct coda_ctx *ctx)
                v4l2_err(&dev->v4l2_dev,
                         "decoded frame index out of range: %d\n", decoded_idx);
        } else {
-               val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM) - 1;
+               val = coda_read(dev, CODA_RET_DEC_PIC_FRAME_NUM);
+               if (ctx->sequence_offset == -1)
+                       ctx->sequence_offset = val;
                val -= ctx->sequence_offset;
                spin_lock(&ctx->buffer_meta_lock);
                if (!list_empty(&ctx->buffer_meta_list)) {

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to