mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-06 01:26:49 +08:00
[mpi]: Add poll interface to mpi
1. Add poll with timeout. Support three mode: block/non-block/timeout. 2. Change control MPP_SET_INPUT_BLOCK and MPP_SET_OUTPUT_BLOCK. 3. Remove msleep in most mpp interface. Change-Id: I39d9a261b6f1da66c6cb944abd71d1e7f4928d2d Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -821,25 +821,25 @@ static MPP_RET mpi_rc_codec(MpiRcTestCtx *ctx)
|
||||
|
||||
mpp_packet_init_with_buffer(&packet, pkt_buf_out);
|
||||
|
||||
do {
|
||||
ret = enc_mpi->dequeue(enc_ctx, MPP_PORT_INPUT, &enc_task);
|
||||
if (ret) {
|
||||
mpp_err("mpp task input dequeue failed\n");
|
||||
goto MPP_TEST_OUT;
|
||||
}
|
||||
if (enc_task == NULL) {
|
||||
mpp_log("mpi dequeue from MPP_PORT_INPUT fail, task equal with NULL!");
|
||||
msleep(3);
|
||||
} else {
|
||||
MppFrame tmp_frm = NULL;
|
||||
ret = enc_mpi->poll(enc_ctx, MPP_PORT_INPUT, MPP_POLL_BLOCK);
|
||||
if (ret) {
|
||||
mpp_err("mpp input poll failed\n");
|
||||
goto MPP_TEST_OUT;
|
||||
}
|
||||
|
||||
mpp_task_meta_get_frame(enc_task, KEY_INPUT_FRAME, &tmp_frm);
|
||||
if (tmp_frm)
|
||||
mpp_assert(tmp_frm == frame_in);
|
||||
ret = enc_mpi->dequeue(enc_ctx, MPP_PORT_INPUT, &enc_task);
|
||||
if (ret) {
|
||||
mpp_err("mpp task input dequeue failed\n");
|
||||
goto MPP_TEST_OUT;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
} while (1);
|
||||
mpp_assert(enc_task);
|
||||
{
|
||||
MppFrame tmp_frm = NULL;
|
||||
mpp_task_meta_get_frame(enc_task, KEY_INPUT_FRAME, &tmp_frm);
|
||||
if (tmp_frm)
|
||||
mpp_assert(tmp_frm == frame_in);
|
||||
}
|
||||
|
||||
mpp_task_meta_set_frame (enc_task, KEY_INPUT_FRAME, frame_in);
|
||||
mpp_task_meta_set_packet(enc_task, KEY_OUTPUT_PACKET, packet);
|
||||
|
Reference in New Issue
Block a user