[m2vd]: fix gop header error

1. mpeg2 maybe not contain GOP header, so cannot judge err
   stream by Gop header flag.
2. extra data may contain seq header, but not decode start
   of this seq header, so we take the way of discard id.

Change-Id: I6f9516716b0553e34e9d89dfbdb343143d00366a
Signed-off-by: fangxingwen <fxw@rock-chips.com>
This commit is contained in:
fangxingwen
2017-01-20 16:17:36 +08:00
parent dfaf926fef
commit 68963e0cba
2 changed files with 7 additions and 11 deletions

View File

@@ -20,6 +20,7 @@
#include "m2vd_parser.h"
#include "m2vd_codec.h"
#include "mpp_packet_impl.h"
#include "mpp_frame.h"
#include "mpp_env.h"
@@ -183,7 +184,6 @@ static MPP_RET m2vd_parser_init_ctx(M2VDParserContext *ctx, ParserCfg *cfg)
ctx->maxFrame_inGOP = 0;
ctx->preframe_period = 0;
ctx->mHeaderDecFlag = 0;
ctx->mHeaderGopFlag = 0;
ctx->max_stream_size = M2VD_BUF_SIZE_BITMEM;
ctx->ref_frame_cnt = 0;
@@ -420,14 +420,19 @@ MPP_RET m2vd_parser_prepare(void *ctx, MppPacket pkt, HalDecTask *task)
buf = pos = mpp_packet_get_pos(pkt);
p->pts = mpp_packet_get_pts(pkt);
len_in = (RK_U32)mpp_packet_get_length(pkt);
if(mpp_packet_get_flag(pkt) & MPP_PACKET_FLAG_EXTRA_DATA) {
pos += len_in;
mpp_packet_set_pos(pkt, pos);
return ret;
}
//MppPacketImpl *packet = (MppPacketImpl *)pkt;
//uint32_t stream_count = 0;
FUN_T("FUN_I");
task->valid = 0;
len_in = (RK_U32)mpp_packet_get_length(pkt),
p->eos = mpp_packet_get_eos(pkt);
// mpp_log("len_in = %d",len_in);
if (len_in > p->max_stream_size) {
@@ -999,9 +1004,6 @@ MPP_RET m2vd_decode_head(M2VDParserContext *ctx)
break;
case GROUP_START_CODE:
ret = m2vd_decode_gop_header(ctx);
if (!ret) {
ctx->mHeaderGopFlag = 1;
}
break;
case PICTURE_START_CODE:
ret = m2vd_decode_pic_header(ctx);
@@ -1353,11 +1355,6 @@ MPP_RET m2vd_parser_parse(void *ctx, HalDecTask *in_task)
goto __FAILED;
}
if (!p->mHeaderGopFlag) {
mpp_log("[m2v]: !mHeaderGopFlag");
goto __FAILED;
}
p->mb_width = (p->seq_head.decode_width + 15) >> 4;
p->mb_height = (p->seq_head.decode_height + 15) >> 4;

View File

@@ -268,7 +268,6 @@ typedef struct M2VDParserContext_t {
long long top_first_cnt;
long long bottom_first_cnt;
RK_S32 mHeaderDecFlag;
RK_S32 mHeaderGopFlag;
M2VDFrameHead Framehead[3];
M2VDFrameHead *frame_ref0;
M2VDFrameHead *frame_ref1;