[mpp_enc_impl]: Add async empty task process

NOTE: Allow MppFrame output with empty MppBuffer.

Change-Id: I4caa1be867d79f68205b276a57ff59a43a102e55
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2022-08-05 10:05:55 +08:00
parent 83ac137ca2
commit 7b380ccab6
2 changed files with 14 additions and 12 deletions

View File

@@ -2563,22 +2563,25 @@ static MPP_RET try_get_async_task(MppEncImpl *enc, EncAsyncWait *wait)
* If there is no input frame just return empty packet task * If there is no input frame just return empty packet task
*/ */
if (!status->frm_pkt_rdy) { if (!status->frm_pkt_rdy) {
async->seq_idx = enc->task_idx++;
async->pts = mpp_frame_get_pts(hal_task->frame);
hal_task->stopwatch = stopwatch;
rc_task->frame = async->task.frame;
enc_dbg_detail("task seq idx %d start\n", seq_idx);
if (check_async_frm_pkt(async)) { if (check_async_frm_pkt(async)) {
mpp_stopwatch_record(stopwatch, "invalid on check frm pkt"); mpp_stopwatch_record(stopwatch, "empty frame on check frm pkt");
reset_hal_enc_task(hal_task); hal_task->valid = 1;
ret = MPP_NOK; hal_task->length = 0;
hal_task->flags.drop_by_fps = 1;
ret = MPP_OK;
goto TASK_DONE; goto TASK_DONE;
} }
status->frm_pkt_rdy = 1; status->frm_pkt_rdy = 1;
hal_task->stopwatch = stopwatch;
enc_dbg_detail("task frame packet ready\n"); enc_dbg_detail("task frame packet ready\n");
async->seq_idx = enc->task_idx++;
async->pts = mpp_frame_get_pts(hal_task->frame);
rc_task->frame = async->task.frame;
enc_dbg_detail("task seq idx %d start\n", seq_idx);
} }
seq_idx = async->seq_idx; seq_idx = async->seq_idx;

View File

@@ -952,9 +952,8 @@ void *enc_test_output(void *arg)
mpp_assert(frm); mpp_assert(frm);
frm_buf = mpp_frame_get_buffer(frm); frm_buf = mpp_frame_get_buffer(frm);
mpp_assert(frm_buf);
{ if (frm_buf) {
AutoMutex autolock(list_buf->mutex()); AutoMutex autolock(list_buf->mutex());
list_buf->add_at_tail(&frm_buf, sizeof(frm_buf)); list_buf->add_at_tail(&frm_buf, sizeof(frm_buf));
list_buf->signal(); list_buf->signal();