From 1f3e50481d7c8016407dc40c6cbb01f1568484bd Mon Sep 17 00:00:00 2001 From: Shijie Qin Date: Wed, 23 Oct 2019 10:56:20 +0800 Subject: [PATCH] MA-15552 VPU decoder: reset seek_flag and wait_res_change_done in time 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 Reviewed-by: ming_qian (cherry picked from commit 93019dc136f9ad3c294e6b4be73049977895aed4) --- drivers/mxc/vpu_malone/vpu_b0.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/mxc/vpu_malone/vpu_b0.c b/drivers/mxc/vpu_malone/vpu_b0.c index b274192dd26c..13987a53f130 100644 --- a/drivers/mxc/vpu_malone/vpu_b0.c +++ b/drivers/mxc/vpu_malone/vpu_b0.c @@ -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; -- 2.17.1