diff mbox series

[FFmpeg-devel,4/4] avformat/hlsenc: Fix check for SPS

Message ID 20201020110334.197116-4-andreas.rheinhardt@gmail.com
State Accepted
Commit fe2be5d9ce528b3894e1e04dc5f936772508be6b
Headers show
Series [FFmpeg-devel,1/4] avformat/hlsenc: Fix extradata length check | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 20, 2020, 11:03 a.m. UTC
Check all the six bits, not only the two bits that are set for SPS.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Steven Liu Oct. 20, 2020, 11:21 a.m. UTC | #1
Andreas Rheinhardt <andreas.rheinhardt@gmail.com> 于2020年10月20日周二 下午7:04写道:
>
> Check all the six bits, not only the two bits that are set for SPS.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavformat/hlsenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 4967247bca..cbfd8f7c0d 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -351,7 +351,7 @@ static void write_codec_attr(AVStream *st, VariantStream *vs)
>          /* check the boundary of data which from current position is small than extradata_size */
>          while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) {
>              /* get HEVC SPS NAL and seek to profile_tier_level */
> -            if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x42) == 0x42)) {
> +            if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x7E) == 0x42)) {
>                  uint8_t *rbsp_buf;
>                  int remain_size = 0;
>                  int rbsp_size = 0;
> --
> 2.25.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

LGTM

Thanks
Steven
diff mbox series

Patch

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 4967247bca..cbfd8f7c0d 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -351,7 +351,7 @@  static void write_codec_attr(AVStream *st, VariantStream *vs)
         /* check the boundary of data which from current position is small than extradata_size */
         while (data && (data - st->codecpar->extradata + 19) < st->codecpar->extradata_size) {
             /* get HEVC SPS NAL and seek to profile_tier_level */
-            if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x42) == 0x42)) {
+            if (!(data[0] | data[1] | data[2]) && data[3] == 1 && ((data[4] & 0x7E) == 0x42)) {
                 uint8_t *rbsp_buf;
                 int remain_size = 0;
                 int rbsp_size = 0;