From cc20dd3efeb842dc17ebcb7cf7d772b46420bb1c Mon Sep 17 00:00:00 2001 From: Yandong Lin Date: Thu, 2 Nov 2023 17:59:46 +0800 Subject: [PATCH] fix[mpeg4_api]: fix drop frame when two stream switch There is a case: In split mode, after sending the last packet of a stream, the user then continues to send packet with extra data flag for the new stream. It will result in the last packet loss. Change-Id: Iba945dbf4229a49fea2040ecc9f76e4ef7209de8 Signed-off-by: Yandong Lin --- mpp/codec/dec/mpg4/mpg4d_api.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mpp/codec/dec/mpg4/mpg4d_api.c b/mpp/codec/dec/mpg4/mpg4d_api.c index 8a382228..2f4de915 100644 --- a/mpp/codec/dec/mpg4/mpg4d_api.c +++ b/mpp/codec/dec/mpg4/mpg4d_api.c @@ -232,6 +232,14 @@ static MPP_RET mpg4d_prepare(void *dec, MppPacket pkt, HalDecTask *task) mpp_packet_set_size(p->task_pkt, p->stream_size); } + if (mpp_packet_get_flag(pkt) & MPP_PACKET_FLAG_EXTRA_DATA) { + if (p->left_length > 0) { + p->left_length = 0; + task->valid = 1; + return MPP_OK; + } + } + if (!p->need_split || (mpp_packet_get_flag(pkt) & MPP_PACKET_FLAG_EXTRA_DATA)) { p->got_eos = eos;