diff mbox series

[FFmpeg-devel,2/2] avcodec/hevc/ps: print a more accurate message when parsing an SPS for an unsupported layer

Message ID 20241003175428.1300-2-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel,1/2] avcodec/hevc/ps: print the correct unsupported scalability value found | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer Oct. 3, 2024, 5:54 p.m. UTC
With multilayer001.heic:

Before:
[hevc @ ...] Scalability type 2 not supported
[hevc @ ...] Ignoring unsupported VPS extension
[hevc @ ...] The following bit-depths are currently specified: 8, 9, 10 and 12 bits, chroma_format_idc is 0, depth is 0

After:
[hevc @ ...] Scalability type 2 not supported
[hevc @ ...] Ignoring unsupported VPS extension
[hevc @ ...] SPS 1 references an unsupported VPS extension. Ignoring

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/hevc/ps.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Anton Khirnov Oct. 7, 2024, 8:26 a.m. UTC | #1
Quoting James Almer (2024-10-03 19:54:28)
> With multilayer001.heic:
> 
> Before:
> [hevc @ ...] Scalability type 2 not supported
> [hevc @ ...] Ignoring unsupported VPS extension
> [hevc @ ...] The following bit-depths are currently specified: 8, 9, 10 and 12 bits, chroma_format_idc is 0, depth is 0
> 
> After:
> [hevc @ ...] Scalability type 2 not supported
> [hevc @ ...] Ignoring unsupported VPS extension
> [hevc @ ...] SPS 1 references an unsupported VPS extension. Ignoring
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/hevc/ps.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
> index 3fc14c1e72..993c60144f 100644
> --- a/libavcodec/hevc/ps.c
> +++ b/libavcodec/hevc/ps.c
> @@ -1207,6 +1207,12 @@ int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
>      if (multi_layer_ext) {
>          const RepFormat *rf = &sps->vps->rep_format;
>  
> +        if (sps->vps->nb_layers == 1) {
> +            av_log(avctx, AV_LOG_WARNING, "SPS %d references an unsupported VPS extension. Ignoring\n",
> +                   *sps_id);
> +            return AVERROR_INVALIDDATA;

Should be ENOSYS, the data is not invalid.
diff mbox series

Patch

diff --git a/libavcodec/hevc/ps.c b/libavcodec/hevc/ps.c
index 3fc14c1e72..993c60144f 100644
--- a/libavcodec/hevc/ps.c
+++ b/libavcodec/hevc/ps.c
@@ -1207,6 +1207,12 @@  int ff_hevc_parse_sps(HEVCSPS *sps, GetBitContext *gb, unsigned int *sps_id,
     if (multi_layer_ext) {
         const RepFormat *rf = &sps->vps->rep_format;
 
+        if (sps->vps->nb_layers == 1) {
+            av_log(avctx, AV_LOG_WARNING, "SPS %d references an unsupported VPS extension. Ignoring\n",
+                   *sps_id);
+            return AVERROR_INVALIDDATA;
+        }
+
         if (get_bits1(gb) &&    // update_rep_format_flag
             get_bits(gb, 8)) {  // sps_rep_format_idx
             av_log(avctx, AV_LOG_ERROR, "sps_rep_format_idx!=0\n");