Scott Theisen:
> If the last four bytes form a valid start code, the loop would run another
> time.
> Since (start == buf_end), start_code is invalidated so the loop terminates.
>
> However, calling avpriv_find_start_code() with p == end, it will immediately
> return due to the zero size buffer. Thus the history is not needed.
> ---
> libavcodec/cbs_mpeg2.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c
> index f2efedde5d..bf95fb7546 100644
> --- a/libavcodec/cbs_mpeg2.c
> +++ b/libavcodec/cbs_mpeg2.c
> @@ -168,8 +168,9 @@ static int cbs_mpeg2_split_fragment(CodedBitstreamContext
> *ctx,
> // the next unit will be treated as the last unit.
> start_code = 0;
> }
> -
> - end = avpriv_find_start_code(start, buf_end, &start_code, 0);
> + else {
> + end = avpriv_find_start_code(start, buf_end, &start_code, 1);
> + }
> start--;
> // decrement so start points to the byte containing the
> start_code_identifier
> // (may be the last byte of fragment->data); end points to the byte
end is now uninitialized in case of a unit consisting solely of a
Sequence End.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".