From 82b9f0ade9fd6d29e1ddbb0c6cc8d0d969698c83 Mon Sep 17 00:00:00 2001 From: Rimon Xu Date: Thu, 9 Feb 2023 16:35:22 +0800 Subject: [PATCH] [m2vd_parser]: fix wrong frame period cause PTS predict error When the frame period changes, it will be recorded in the last frame period first, but this value is an error value, which cannot be updated back to the correct frame period later, so the correct frame period should be restored at this time. Signed-off-by: Rimon Xu Change-Id: I4b910efb0145b665ff664a552517ffa0ff920ba5 --- mpp/codec/dec/m2v/m2vd_parser.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mpp/codec/dec/m2v/m2vd_parser.c b/mpp/codec/dec/m2v/m2vd_parser.c index 563ef13b..51ccaba3 100644 --- a/mpp/codec/dec/m2v/m2vd_parser.c +++ b/mpp/codec/dec/m2v/m2vd_parser.c @@ -1177,10 +1177,14 @@ static MPP_RET m2vd_alloc_frame(M2VDParserContext *ctx) tmp_frame_period = (tmp_frame_period * 256) / ctx->GroupFrameCnt; if ((tmp_frame_period > 4200) && (tmp_frame_period < 11200) && (fabs(ctx->frame_period - tmp_frame_period) > 128)) { - if (fabs(ctx->preframe_period - tmp_frame_period) > 128) + if (fabs(ctx->preframe_period - tmp_frame_period) > 128) { ctx->preframe_period = tmp_frame_period; - else + } else { ctx->frame_period = tmp_frame_period; + ctx->preframe_period = 0; + } + } else { + ctx->preframe_period = 0; } }