diff mbox series

[FFmpeg-devel,3/9] avcodec/cbs: Remove redundant assignment

Message ID DB6PR0101MB221452577EB3D3357B000A818F9F9@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com
State Accepted
Commit e35b8b848c2a23212b09ff54846cf62acd78ca66
Headers show
Series [FFmpeg-devel,1/9] avcodec/error_resilience: Avoid overhead of AVBuffer API | expand


Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt Aug. 4, 2022, 5:36 p.m. UTC
The code just creates new references without allocating
new buffers for the subobjects; therefore the actual data pointer
stays valid and need not be updated.

Also remove an assert that ensured that the calculation
for updating the pointer makes sense.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
 libavcodec/cbs.c | 6 ------
 1 file changed, 6 deletions(-)
diff mbox series


diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c
index f715e463a1..43329a14a4 100644
--- a/libavcodec/cbs.c
+++ b/libavcodec/cbs.c
@@ -955,17 +955,11 @@  static int cbs_clone_internal_refs_unit_content(AVBufferRef **clone_ref,
             goto fail;
-        // src_ptr is required to point somewhere inside src_buf.  If it
-        // doesn't, there is a bug somewhere.
-        av_assert0(*src_ptr >= (*src_buf)->data &&
-                   *src_ptr <  (*src_buf)->data + (*src_buf)->size);
         *copy_buf = av_buffer_ref(*src_buf);
         if (!*copy_buf) {
             err = AVERROR(ENOMEM);
             goto fail;
-        *copy_ptr = (*copy_buf)->data + (*src_ptr - (*src_buf)->data);
     *clone_ref = av_buffer_create(copy, desc->content_size,