diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2019-07-29 21:56:52 +0200 |
---|---|---|
committer | Mark Thompson <sw@jkqxz.net> | 2019-07-29 22:25:10 +0100 |
commit | 4e7e30bbe0fbe54d44cadc398d4071905d3063e8 (patch) | |
tree | 073254c7f8ff4a86c0293e4bd5efc7eb58df1b63 /libavcodec/cbs_vp9.c | |
parent | 5ffb8e879389fb0642654e3233cfeca1f9841e52 (diff) | |
download | ffmpeg-4e7e30bbe0fbe54d44cadc398d4071905d3063e8.tar.gz |
cbs: Don't set AVBuffer's opaque
cbs is currently inconsistent regarding the opaque field that can be
used as a special argument to av_buffer_create in order to be used
during freeing the buffer: ff_cbs_alloc_unit_content and all the free
functions used name this parameter as if it should contain a pointer to
the unit whose content is about to be created; but both
ff_cbs_alloc_unit_content as well as ff_cbs_h264_add_sei_message
actually use a pointer to the CodedBitstreamContext as opaque. It should
actually be neither, because it is unneeded (as is evidenced by the fact
that none of the free functions use this pointer at all) and because it
ties the unit's content to the lifetime of other objects, although a
refcounted buffer is supposed to have its own lifetime that only ends
when its reference count reaches zero. This problem manifests itself in
the pointer becoming dangling.
The pointer to the unit can become dangling if another unit is added to
the fragment later as happens in the bitstream filters; in this case,
the pointer can point to the wrong unit (if the fragment's unit array
needn't be relocated) or it can point to where the array was earlier.
It can also become dangling if the unit's content is meant to survive
the resetting of the fragment it was originally read with. This applies
to the extradata of H.264 and HEVC.
The pointer to the context can become dangling if the context is closed
before the content is freed. Although this doesn't seem to happen right
now, it could happen, in particular if one uses different
CodedBitstreamContexts for in- and output.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/cbs_vp9.c')
-rw-r--r-- | libavcodec/cbs_vp9.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index 7102bb87d3..bd172100fc 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -474,7 +474,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, return 0; } -static void cbs_vp9_free_frame(void *unit, uint8_t *content) +static void cbs_vp9_free_frame(void *opaque, uint8_t *content) { VP9RawFrame *frame = (VP9RawFrame*)content; av_buffer_unref(&frame->data_ref); |