diff mbox series

[FFmpeg-devel,2/3] avcodec/extract_extradata: Remove always-true check

Message ID 20200907131706.29060-2-andreas.rheinhardt@gmail.com
State Accepted
Commit 520d9a8de229c90d82a5eafd59c28ac21b66781c
Headers show
Series [FFmpeg-devel,1/3] avcodec/extract_extradata: Consolidate zeroing extradata padding | expand

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 7, 2020, 1:17 p.m. UTC
If a sequence header has already been found, it is certain that the next
startcode (being disjoint from the sequence header startcode) can begin
at index four at the earliest.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/extract_extradata_bsf.c | 2 --
 1 file changed, 2 deletions(-)

Comments

Andreas Rheinhardt Sept. 10, 2020, 10:41 a.m. UTC | #1
Andreas Rheinhardt:
> If a sequence header has already been found, it is certain that the next
> startcode (being disjoint from the sequence header startcode) can begin
> at index four at the earliest.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/extract_extradata_bsf.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
> index 6e80076522..38517bdcf3 100644
> --- a/libavcodec/extract_extradata_bsf.c
> +++ b/libavcodec/extract_extradata_bsf.c
> @@ -275,7 +275,6 @@ static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt,
>          if (state == 0x1B3)
>              found = 1;
>          else if (found && state != 0x1B5 && state < 0x200 && state >= 0x100) {
> -            if (i > 3) {
>                  *size = i - 3;
>                  *data = av_malloc(*size + AV_INPUT_BUFFER_PADDING_SIZE);
>                  if (!*data)
> @@ -287,7 +286,6 @@ static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt,
>                      pkt->data += *size;
>                      pkt->size -= *size;
>                  }
> -            }
>              break;
>          }
>      }
> 

Will apply the last two patches of this patchset tomorrow unless there
are objections.

- Andreas
diff mbox series

Patch

diff --git a/libavcodec/extract_extradata_bsf.c b/libavcodec/extract_extradata_bsf.c
index 6e80076522..38517bdcf3 100644
--- a/libavcodec/extract_extradata_bsf.c
+++ b/libavcodec/extract_extradata_bsf.c
@@ -275,7 +275,6 @@  static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt,
         if (state == 0x1B3)
             found = 1;
         else if (found && state != 0x1B5 && state < 0x200 && state >= 0x100) {
-            if (i > 3) {
                 *size = i - 3;
                 *data = av_malloc(*size + AV_INPUT_BUFFER_PADDING_SIZE);
                 if (!*data)
@@ -287,7 +286,6 @@  static int extract_extradata_mpeg12(AVBSFContext *ctx, AVPacket *pkt,
                     pkt->data += *size;
                     pkt->size -= *size;
                 }
-            }
             break;
         }
     }