On 6/1/2020 6:49 AM, Anton Khirnov wrote: > Quoting Andreas Rheinhardt (2020-05-29 18:31:57) >> When a slice is encountered, the H.264 parser up until now always >> unreferenced and reset the currently active PPS; immediately >> afterwards, the currently active PPS is set again which includes >> referencing it. Given that it is typical for the active parameter >> sets to change only seldomly, most of the time the new active PPS will >> be the old one. Therefore this commit checks for this and only >> unreferences the PPS if it changed. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@gmail.com> >> --- >> New and much simplified version of [1]. This has been made possible by >> 5e316096fa9ba4493d9dbb48847ad8e0b0e188c3. >> >> [1]: https://ffmpeg.org/pipermail/ffmpeg-devel/2019-August/248374.html >> >> libavcodec/h264_parser.c | 2 ++ >> 1 file changed, 2 insertions(+) > > I've been considering a utility function along the lines of: > > int av_buffer_update(AVBufferRef **dst, AVBufferRef *src) > { > if ((*dst)->buffer == src->buffer) > return 0; > av_buffer_unref(dst); > *dst = av_buffer_ref(src); > return 1; > } > > which would help avoid unnecessary unrefs+refs in such cases. Thoughts?
I'd call it av_buffer_replace() instead, and i think you could reuse the buffer_replace() function already in buffer.c for this. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".