[media] s5p-mfc: Only set timestamp/timecode for new frames
authorIlja Friedel <ihf@chromium.org>
Tue, 21 Oct 2014 11:06:58 +0000 (08:06 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Tue, 28 Oct 2014 17:43:25 +0000 (15:43 -0200)
Timestamp i of a previously decoded buffer was overwritten for some
H.264 streams with timestamp i+1 of the next buffer. This happened when
encountering frame_type S5P_FIMV_DECODE_FRAME_SKIPPED, indicating no
new frame.

In most cases this wrong indexing might not have been noticed except
for a one frame delay in frame presentation. For H.264 streams though
that require reordering of frames for presentation, it caused a slightly
erratic presentation time lookup and consequently dropped frames in the
Pepper Flash plugin.

Signed-off-by: Ilja H. Friedel <ihf@google.com>
Signed-off-by: Kiran AVND <avnd.kiran@samsung.com>
Signed-off-by: Arun Kumar K <arun.kk@samsung.com>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/platform/s5p-mfc/s5p_mfc.c

index 79c9537..eb71055 100644 (file)
@@ -220,11 +220,14 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
        size_t dec_y_addr;
        unsigned int frame_type;
 
-       dec_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dec_y_adr, dev);
+       /* Make sure we actually have a new frame before continuing. */
        frame_type = s5p_mfc_hw_call(dev->mfc_ops, get_dec_frame_type, dev);
+       if (frame_type == S5P_FIMV_DECODE_FRAME_SKIPPED)
+               return;
+       dec_y_addr = s5p_mfc_hw_call(dev->mfc_ops, get_dec_y_adr, dev);
 
        /* Copy timestamp / timecode from decoded src to dst and set
-          appropriate flags */
+          appropriate flags. */
        src_buf = list_entry(ctx->src_queue.next, struct s5p_mfc_buf, list);
        list_for_each_entry(dst_buf, &ctx->dst_queue, list) {
                if (vb2_dma_contig_plane_dma_addr(dst_buf->b, 0) == dec_y_addr) {
@@ -250,6 +253,11 @@ static void s5p_mfc_handle_frame_copy_time(struct s5p_mfc_ctx *ctx)
                                dst_buf->b->v4l2_buf.flags |=
                                                V4L2_BUF_FLAG_BFRAME;
                                break;
+                       default:
+                               /* Don't know how to handle
+                                  S5P_FIMV_DECODE_FRAME_OTHER_FRAME. */
+                               mfc_debug(2, "Unexpected frame type: %d\n",
+                                               frame_type);
                        }
                        break;
                }