[vpu]: Fix encoder's improper operation with eos

When encoder receives an empty frame with eos flag set, encoder will
encode an unreasonable extra frame.

Change-Id: I3bd1a2c84780f1b6212171117b67319b2f613b9f
Signed-off-by: Johnson Ding <johnson.ding@rock-chips.com>
This commit is contained in:
Johnson Ding
2019-04-04 09:05:43 +08:00
parent 869ff44980
commit 90b2a3838c
2 changed files with 21 additions and 10 deletions

View File

@@ -364,7 +364,7 @@ MPP_RET test_mpp_run(MpiEncTestData *p)
if (p->fp_input) {
ret = read_yuv_image(buf, p->fp_input, p->width, p->height,
p->hor_stride, p->ver_stride, p->fmt);
if (ret == MPP_NOK || feof(p->fp_input)) {
if (ret == MPP_NOK || feof(p->fp_input)) {
mpp_log("found last frame. feof %d\n", feof(p->fp_input));
p->frm_eos = 1;
} else if (ret == MPP_ERR_VALUE)
@@ -387,9 +387,13 @@ MPP_RET test_mpp_run(MpiEncTestData *p)
mpp_frame_set_hor_stride(frame, p->hor_stride);
mpp_frame_set_ver_stride(frame, p->ver_stride);
mpp_frame_set_fmt(frame, p->fmt);
mpp_frame_set_buffer(frame, p->frm_buf);
mpp_frame_set_eos(frame, p->frm_eos);
if (p->fp_input && feof(p->fp_input))
mpp_frame_set_buffer(frame, NULL);
else
mpp_frame_set_buffer(frame, p->frm_buf);
ret = mpi->encode_put_frame(ctx, frame);
if (ret) {
mpp_err("mpp encode put frame failed\n");