[FFmpeg-devel] [PATCH RFC 0/6] MP4 editlist and HEVC decoder

Zhao Zhili quinkblack at foxmail.com
Tue Mar 18 15:07:55 EET 2025



> On Mar 18, 2025, at 20:58, Zhao Zhili <quinkblack-at-foxmail.com at ffmpeg.org> wrote:
> 
> From: Zhao Zhili <zhilizhao at tencent.com>
> 
> Fix #11510
> 
> #11510 revealed multiple issues related to mp4 demuxer, hevc decoder
> and videotoolbox.
> 
> 1. mp4 demuxer output packets have rewind due to editlist,
> 
> POC		 POC
> 916 -----------> 944
> 
> then rewind back to
> 
> 916 -----------> 944 942
> 
> 2. Both POC 916 and POC 944 are CRA nalu, so no flush on output.
> 
> 3. When decoding POC the second time, POC still inside DPB buffer.

I mean when decoding POC 944 the second time, POC 944 still inside
DPB buffer.

> 
> Patch 1/6 fix videotoolbox which shouldn't reset when confronted with
>    ReferenceMissingErr
> 
> Patch 2/6 is trial.
> 
> Patch 3/6 allow duplicated POC in DPB buffer. I'm not quite sure the
> side effect.
> 
> Patch 4 to 6 add a flag to indicate the start of a new sequence, so
> the decoder can flush on output. I know it looks suspicious, please
> comment.
> 
> There are more general stream rewind issues to be resolved.
> 
> Zhao Zhili (6):
>  avcodec/vt: Don't restart decoder when confronted with
>    ReferenceMissingErr
>  avformat/mov: generalize sgpd_sync index lookup
>  avcodec/hevc: Don't drop packet with duplicate POC
>  avcodec/packet: Add AV_PKT_FLAG_NEW_SEQUENCE flag
>  avformat/mov: Notify new sequence at the start of editlist
>  avcodec/hevc: Check AV_PKT_FLAG_NEW_SEQUENCE and flush pictures out
> 
> libavcodec/hevc/hevcdec.c |  3 +++
> libavcodec/hevc/refs.c    |  4 ++--
> libavcodec/packet.h       | 10 ++++++++++
> libavcodec/videotoolbox.c | 10 ++++++----
> libavformat/avformat.h    |  2 ++
> libavformat/mov.c         | 21 ++++++++++++++-------
> 6 files changed, 37 insertions(+), 13 deletions(-)
> 
> -- 
> 2.46.0
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list