Signed-off-by: James Almer <jamr...@gmail.com> --- libavcodec/av1_parser.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/libavcodec/av1_parser.c b/libavcodec/av1_parser.c index 77906d0c91..b9a96ad59a 100644 --- a/libavcodec/av1_parser.c +++ b/libavcodec/av1_parser.c @@ -50,6 +50,11 @@ static const enum AVPixelFormat pix_fmts_rgb[3] = { AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12, }; +static void dummy_free(void *opaque, uint8_t *data) +{ + av_assert0(opaque == data); +} + static int av1_parser_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, const uint8_t **out_data, int *out_size, @@ -60,6 +65,7 @@ static int av1_parser_parse(AVCodecParserContext *ctx, const CodedBitstreamAV1Context *av1 = s->cbc->priv_data; const AV1RawSequenceHeader *seq; const AV1RawColorConfig *color; + AVBufferRef *ref = NULL; int ret; *out_data = data; @@ -69,6 +75,11 @@ static int av1_parser_parse(AVCodecParserContext *ctx, ctx->pict_type = AV_PICTURE_TYPE_NONE; ctx->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; + ref = av_buffer_create((uint8_t *)data, size, dummy_free, + (void *)data, AV_BUFFER_FLAG_READONLY); + if (!ref) + return size; + s->cbc->log_ctx = avctx; if (avctx->extradata_size && !s->parsed_extradata) { @@ -171,6 +182,8 @@ static int av1_parser_parse(AVCodecParserContext *ctx, end: ff_cbs_fragment_reset(td); + av_assert1(av_buffer_get_ref_count(ref) == 1); + av_buffer_unref(&ref); s->cbc->log_ctx = NULL; -- 2.49.0 _______________________________________________ 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".