Description: Fix omx decoder fill frames pts incorrect If there is no pts value from pkt, decoder should fill the pts field according to the pkt's duration. . ffmpeg (7:5.1.2-1.1) UNRELEASED; urgency=medium . * libavcodec/omxdec: Optimize copy for omxdec plugins. Author: Som Qin --- The information above should follow the Patch Tagging Guidelines, please checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here are templates for supplementary fields that you might want to add: Origin: (upstream|backport|vendor|other), (|commit:) Bug: Bug-Debian: https://bugs.debian.org/ Bug-Ubuntu: https://launchpad.net/bugs/ Forwarded: (no|not-needed|) Applied-Upstream: , (|commit:) Reviewed-By: Last-Update: 2023-04-23 --- ffmpeg-5.1.2.orig/libavcodec/omxdec.c +++ ffmpeg-5.1.2/libavcodec/omxdec.c @@ -1217,7 +1217,15 @@ static int omx_decode_frame(AVCodecConte pkt->size, pkt->pts, pkt->dts, pkt->duration); av_log(avctx, AV_LOG_VERBOSE, "avctx->pts_correction_last_pts: %ld avctx->pts_correction_last_dts: %ld\n", avctx->pts_correction_last_pts, avctx->pts_correction_last_dts); - OMXDecodeQueuePush(&s->decode_pts_queue, pkt->dts); + if (pkt->dts != AV_NOPTS_VALUE) { + OMXDecodeQueuePush(&s->decode_pts_queue, pkt->dts); + } else { + if (OMXDecodeQueueEmpty(&s->decode_pts_queue)) { + OMXDecodeQueuePush(&s->decode_pts_queue, 0); + } else { + OMXDecodeQueuePush(&s->decode_pts_queue, s->decode_pts_queue.tail->val + pkt->duration); + } + } if (pkt->size) { //VPU init and fill buffer slow, so empty buf sleep to send before get vpu fill buf.