MA-15552 VPU decoder: reset seek_flag and wait_res_change_done in time
authorShijie Qin <shijie.qin@nxp.com>
Wed, 23 Oct 2019 02:56:20 +0000 (10:56 +0800)
committerShijie Qin <shijie.qin@nxp.com>
Thu, 24 Oct 2019 11:00:06 +0000 (19:00 +0800)
Reset seek_flag and wait_res_change_done when receive
VID_API_EVENT_STOPPED event.

This also can fix an Andorid case indirectly:
Seek in the beginning, but has not do capture port streamoff/on
when receive res changed event, then will cause seek_flag status
incorrect.
If abort before receive seq_hdr_found evnt will call stop cmd to
fw, then will reset seek_flag and wait_res_change_done.

Signed-off-by: Shijie Qin <shijie.qin@nxp.com>
Reviewed-by: ming_qian <ming.qian@nxp.com>
(cherry picked from commit 93019dc136f9ad3c294e6b4be73049977895aed4)

drivers/mxc/vpu_malone/vpu_b0.c

index b274192..13987a5 100644 (file)
@@ -3380,7 +3380,7 @@ static bool verify_decoded_frames(struct vpu_ctx *ctx)
 
        if (buffer_info->stream_pic_input_count != buffer_info->stream_pic_parsed_count) {
                vpu_dbg(LVL_WARN,
-                       "warning: ctx[%d] decoded frames not correct, input_count: %d, decoded count: %d\n",
+                       "ctx[%d] amount inconsistent between input(%d) and output(%d)\n",
                        ctx->str_index, buffer_info->stream_pic_input_count,
                        buffer_info->stream_pic_parsed_count);
                return false;
@@ -4148,6 +4148,15 @@ static void vpu_api_event_handler(struct vpu_ctx *ctx, u_int32 uStrIdx, u_int32
                ctx->firmware_stopped = true;
                ctx->frame_decoded = false;
                ctx->wait_rst_done = false;
+               /* This also can fix an Andorid case indirectly:
+                * seek in the beginning, but has not do capture port
+                * streamoff/on when receive res changed event, then will cause
+                * seek_flag status incorrect.
+                * If abort before receive seq_hdr_found evnt will call stop cmd
+                * to fw, then will reset seek_flag and wait_res_change_done.
+                */
+               ctx->wait_res_change_done = false;
+               ctx->seek_flag = false;
                ctx->res_change_occu_count = 0;
                ctx->res_change_send_count = 0;
                ctx->res_change_done_count = 0;