diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-26 21:04:53 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2022-01-29 19:30:25 +0100 |
commit | 24a654c6c96310b1b408a6d053ad52de41640e5e (patch) | |
tree | 5415daceddbcfe3f2623a18c23ae3f9fdede5d19 /libavcodec/mpeg12enc.c | |
parent | 5a04c6a2697568c2b7233a0a9f4f20aa8a2a1706 (diff) | |
download | ffmpeg-24a654c6c96310b1b408a6d053ad52de41640e5e.tar.gz |
avcodec/mpegvideo: Use offset instead of pointer for vbv_delay
An offset has the advantage of not needing to be updated
when the buffer is reallocated. Furthermore, the way the pointer
is currently updated is undefined behaviour in case the pointer
is not already set (i.e. when not encoding MPEG-1/2), because
it calculates the nonsense NULL - s->pb.buf.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/mpeg12enc.c')
-rw-r--r-- | libavcodec/mpeg12enc.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c index ecb90d1a41..9c0be69ded 100644 --- a/libavcodec/mpeg12enc.c +++ b/libavcodec/mpeg12enc.c @@ -465,7 +465,7 @@ void ff_mpeg1_encode_picture_header(MpegEncContext *s, int picture_number) (s->picture_number - mpeg12->gop_picture_number) & 0x3ff); put_bits(&s->pb, 3, s->pict_type); - s->vbv_delay_ptr = s->pb.buf + put_bytes_count(&s->pb, 0); + s->vbv_delay_pos = put_bytes_count(&s->pb, 0); put_bits(&s->pb, 16, 0xFFFF); /* vbv_delay */ // RAL: Forward f_code also needed for B-frames |