[FFmpeg-devel] [PATCH] libavcodec/mpeg12dec.c: append CC data to a53_buf_ref
Scott Theisen
scott.the.elm at gmail.com
Sat Dec 14 05:06:45 EET 2024
On 12/13/24 17:39, Marth64 wrote:
> Hi Scott,
>
> Thanks for sharing this. I had read your original email also
> ([RFC] libavcodec/mpeg12dec.c: CC data from skipped frames)
> and was thinking about the statement. The patch helps
> visualize the issue a bit better.
>
> I need to study this and test it to understand it better.
> Meantime, I will apply locally and play around with it.
>
> If any more seasoned EIA608 experts have any thoughts please share.
The problem is the use of av_buffer_realloc() instead of av_buffer_alloc().
| old_size |
realloc(new_size)
| old_size + (undefined values) | (new_size total bytes) (new_size is
always > old_size)
realloc copies data already in the buffer to the first old_size bytes.
The SCTE-20 code sets the extra space to 0, but the others leave it
undefined.
However, the old_size data is then overwritten, potentially partially, while
the size of the array is still new_size when there are only new_size -
old_size
valid bytes.
I think it is reasonable to concatenate the CC data until a frame can be
exported.
Since I don't know if there is a frame exported when all of the video
frame's data slices
have been skipped (e.g. B frame with open GOP), it seemed easiest to
concatenate
the CC data like the A/53 code does.
Regards,
Scott Theisen
More information about the ffmpeg-devel
mailing list