[dec]: fix mpp_packet error usage in test

1. mpp_packet length is the valid data size, fix this in copy_init function
2. in mpp_dec_test setup pos and length only do not touch data and size

Change-Id: Ic1bb15126fa09e7da0869ea79ec85ad2869c3955
Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
Herman Chen
2016-11-29 10:07:52 +08:00
parent 3ddd67009e
commit 5e5f667d68
2 changed files with 27 additions and 15 deletions

View File

@@ -31,7 +31,7 @@
#include "utils.h"
#define MPI_DEC_LOOP_COUNT 4
#define MPI_DEC_STREAM_SIZE (SZ_2K)
#define MPI_DEC_STREAM_SIZE (SZ_4K)
#define MAX_FILE_NAME_LENGTH 256
typedef struct {
@@ -100,9 +100,12 @@ static int decode_simple(MpiDecLoopData *data)
// write data to packet
mpp_packet_write(packet, 0, buf, read_size);
// reset pos
// reset pos and set valid length
mpp_packet_set_pos(packet, buf);
mpp_packet_set_length(packet, read_size);
// setup eos flag
if (pkt_eos)
mpp_packet_set_eos(packet);
do {
// send the packet first if packet is not done
@@ -139,12 +142,18 @@ static int decode_simple(MpiDecLoopData *data)
}
// if last packet is send but last frame is not found continue
if (pkt_eos && pkt_done && !frm_eos)
if (pkt_eos && pkt_done && !frm_eos) {
msleep(10);
continue;
}
if (frm_eos) {
mpp_log("found last frame\n");
break;
}
if (get_frm)
continue;
break;
} while (1);