[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 <rimon.xu@rock-chips.com>
Change-Id: I4b910efb0145b665ff664a552517ffa0ff920ba5
This commit is contained in:
Rimon Xu
2023-02-09 16:35:22 +08:00
committed by Herman Chen
parent c145c84632
commit 82b9f0ade9

View File

@@ -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;
}
}