From 68963e0cba67727195092c173c4155210e4b51ea Mon Sep 17 00:00:00 2001 From: fangxingwen Date: Fri, 20 Jan 2017 16:17:36 +0800 Subject: [PATCH] [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 --- mpp/codec/dec/m2v/m2vd_parser.c | 17 +++++++---------- mpp/codec/dec/m2v/m2vd_parser.h | 1 - 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c index fcb076be..1d1f1403 100755 --- a/mpp/codec/dec/m2v/m2vd_parser.c +++ b/mpp/codec/dec/m2v/m2vd_parser.c @@ -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; diff --git a/mpp/codec/dec/m2v/m2vd_parser.h b/mpp/codec/dec/m2v/m2vd_parser.h index 68f23e9c..8c99aea4 100755 --- a/mpp/codec/dec/m2v/m2vd_parser.h +++ b/mpp/codec/dec/m2v/m2vd_parser.h @@ -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;