From 64cf1d5a165f3f4a43767ea2d695a6e60fa6dc47 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Thu, 23 Mar 2023 11:35:26 +0800 Subject: [PATCH] [mpp_dec/mpp_enc]): Fix error on control notify When notify goes with control process the control notify should not clear the other remaining notifies. Signed-off-by: Herman Chen Change-Id: Ie5adbf10047ccbaed8717d008b60e89e08817840 --- mpp/codec/mpp_dec_normal.cpp | 7 +++++-- mpp/codec/mpp_enc_impl.cpp | 14 ++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/mpp/codec/mpp_dec_normal.cpp b/mpp/codec/mpp_dec_normal.cpp index c023a0ab..05a71c4a 100644 --- a/mpp/codec/mpp_dec_normal.cpp +++ b/mpp/codec/mpp_dec_normal.cpp @@ -46,14 +46,17 @@ static MPP_RET check_task_wait(MppDecImpl *dec, DecTask *task) RK_U32 last_wait = dec->parser_wait_flag; RK_U32 curr_wait = task->wait.val; RK_U32 wait_chg = last_wait & (~curr_wait); + RK_U32 keep_notify = 0; do { if (dec->reset_flag) break; // NOTE: User control should always be processed - if (notify & MPP_DEC_CONTROL) + if (notify & MPP_DEC_CONTROL) { + keep_notify = notify & (~MPP_DEC_CONTROL); break; + } // NOTE: When condition is not fulfilled check nofify flag again if (!curr_wait || (curr_wait & notify)) @@ -68,7 +71,7 @@ static MPP_RET check_task_wait(MppDecImpl *dec, DecTask *task) dec->parser_status_flag = task->status.val; dec->parser_wait_flag = task->wait.val; - dec->parser_notify_flag = 0; + dec->parser_notify_flag = keep_notify; if (ret) { dec->parser_wait_count++; diff --git a/mpp/codec/mpp_enc_impl.cpp b/mpp/codec/mpp_enc_impl.cpp index 4efabb8a..5fb514c6 100644 --- a/mpp/codec/mpp_enc_impl.cpp +++ b/mpp/codec/mpp_enc_impl.cpp @@ -197,14 +197,17 @@ static MPP_RET check_enc_task_wait(MppEncImpl *enc, EncAsyncWait *wait) RK_U32 last_wait = enc->status_flag; RK_U32 curr_wait = wait->val; RK_U32 wait_chg = last_wait & (~curr_wait); + RK_U32 keep_notify = 0; do { if (enc->reset_flag) break; // NOTE: User control should always be processed - if (notify & MPP_ENC_CONTROL) + if (notify & MPP_ENC_CONTROL) { + keep_notify = notify & (~MPP_ENC_CONTROL); break; + } // NOTE: When condition is not fulfilled check nofify flag again if (!curr_wait || (curr_wait & notify)) @@ -217,7 +220,7 @@ static MPP_RET check_enc_task_wait(MppEncImpl *enc, EncAsyncWait *wait) last_wait, curr_wait, wait_chg, notify, (ret) ? ("wait") : ("work")); enc->status_flag = wait->val; - enc->notify_flag = 0; + enc->notify_flag = keep_notify; if (ret) { enc->wait_count++; @@ -2823,14 +2826,17 @@ static MPP_RET check_enc_async_wait(MppEncImpl *enc, EncAsyncWait *wait) RK_U32 last_wait = enc->status_flag; RK_U32 curr_wait = wait->val; RK_U32 wait_chg = last_wait & (~curr_wait); + RK_U32 keep_notify = 0; do { if (enc->reset_flag) break; // NOTE: User control should always be processed - if (notify & MPP_ENC_CONTROL) + if (notify & MPP_ENC_CONTROL) { + keep_notify = notify & (~MPP_ENC_CONTROL); break; + } // NOTE: When condition is not fulfilled check nofify flag again if (!curr_wait || (curr_wait & notify)) @@ -2843,7 +2849,7 @@ static MPP_RET check_enc_async_wait(MppEncImpl *enc, EncAsyncWait *wait) last_wait, curr_wait, wait_chg, notify, (ret) ? ("wait") : ("work")); enc->status_flag = wait->val; - enc->notify_flag = 0; + enc->notify_flag = keep_notify; if (ret) { enc->wait_count++;