[FFmpeg-devel] [PATCH 4/5] avcodec/h264dec: use the RefStruct API for h264db

Anton Khirnov anton at khirnov.net
Fri Oct 25 11:17:50 EEST 2024


Quoting James Almer (2024-10-25 04:26:12)
> And ensure the buffer is synced between threads.
> 
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
>  libavcodec/h264_picture.c | 2 +-
>  libavcodec/h264_slice.c   | 2 ++
>  libavcodec/h264dec.c      | 2 +-
>  3 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/libavcodec/h264_picture.c b/libavcodec/h264_picture.c
> index 371a794ec2..d07c3a0af8 100644
> --- a/libavcodec/h264_picture.c
> +++ b/libavcodec/h264_picture.c
> @@ -215,7 +215,7 @@ int ff_h264_field_end(H264Context *h, H264SliceContext *sl, int in_setup)
>          err = AVERROR_INVALIDDATA;
>          if (sd) { // a decoding error may have happened before the side data could be allocated
>              if (!h->h274db) {
> -                h->h274db = av_mallocz(sizeof(*h->h274db));
> +                h->h274db = ff_refstruct_allocz(sizeof(*h->h274db));

Doesn't this happen after ff_thread_finish_setup()?

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list