0025-FFmpeg-fix-pts-incorrect.patch 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. Description: Fix omx decoder fill frames pts incorrect
  2. If there is no pts value from pkt, decoder should fill the pts field
  3. according to the pkt's duration.
  4. .
  5. ffmpeg (7:5.1.2-1.1) UNRELEASED; urgency=medium
  6. .
  7. * libavcodec/omxdec: Optimize copy for omxdec plugins.
  8. Author: Som Qin <som.qin@starfivetech.com>
  9. ---
  10. The information above should follow the Patch Tagging Guidelines, please
  11. checkout https://dep.debian.net/deps/dep3/ to learn about the format. Here
  12. are templates for supplementary fields that you might want to add:
  13. Origin: (upstream|backport|vendor|other), (<patch-url>|commit:<commit-id>)
  14. Bug: <upstream-bugtracker-url>
  15. Bug-Debian: https://bugs.debian.org/<bugnumber>
  16. Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
  17. Forwarded: (no|not-needed|<patch-forwarded-url>)
  18. Applied-Upstream: <version>, (<commit-url>|commit:<commid-id>)
  19. Reviewed-By: <name and email of someone who approved/reviewed the patch>
  20. Last-Update: 2023-04-23
  21. --- ffmpeg-5.1.2.orig/libavcodec/omxdec.c
  22. +++ ffmpeg-5.1.2/libavcodec/omxdec.c
  23. @@ -1217,7 +1217,15 @@ static int omx_decode_frame(AVCodecConte
  24. pkt->size, pkt->pts, pkt->dts, pkt->duration);
  25. av_log(avctx, AV_LOG_VERBOSE, "avctx->pts_correction_last_pts: %ld avctx->pts_correction_last_dts: %ld\n",
  26. avctx->pts_correction_last_pts, avctx->pts_correction_last_dts);
  27. - OMXDecodeQueuePush(&s->decode_pts_queue, pkt->dts);
  28. + if (pkt->dts != AV_NOPTS_VALUE) {
  29. + OMXDecodeQueuePush(&s->decode_pts_queue, pkt->dts);
  30. + } else {
  31. + if (OMXDecodeQueueEmpty(&s->decode_pts_queue)) {
  32. + OMXDecodeQueuePush(&s->decode_pts_queue, 0);
  33. + } else {
  34. + OMXDecodeQueuePush(&s->decode_pts_queue, s->decode_pts_queue.tail->val + pkt->duration);
  35. + }
  36. + }
  37. if (pkt->size) {
  38. //VPU init and fill buffer slow, so empty buf sleep to send before get vpu fill buf.