diff mbox series

[FFmpeg-devel,1/3] avcodec/h2645_parse: always return 0 on successful h{264, evc}_parse_nal_header() calls

Message ID 20200812182558.14199-1-jamrial@gmail.com
State Accepted
Commit a4d28ea030b210eefaaf144dcdbae4c330c69c4d
Headers show
Series [FFmpeg-devel,1/3] avcodec/h2645_parse: always return 0 on successful h{264, evc}_parse_nal_header() calls | expand

Checks

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

Commit Message

James Almer Aug. 12, 2020, 6:25 p.m. UTC
HEVC NALs are no longer being skipped based on their nuh_layer_id
value since ad326379c6.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/h2645_parse.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

James Almer Aug. 19, 2020, 2:51 p.m. UTC | #1
On 8/12/2020 3:25 PM, James Almer wrote:
> HEVC NALs are no longer being skipped based on their nuh_layer_id
> value since ad326379c6.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavcodec/h2645_parse.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
> index 2e03871640..a7cdf76e87 100644
> --- a/libavcodec/h2645_parse.c
> +++ b/libavcodec/h2645_parse.c
> @@ -287,7 +287,7 @@ static int get_bit_length(H2645NAL *nal, int skip_trailing_zeros)
>  
>  /**
>   * @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
> - * 0 if the unit should be skipped, 1 otherwise
> + * 0 otherwise
>   */
>  static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
>  {
> @@ -307,7 +307,7 @@ static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
>             "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
>             nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id);
>  
> -    return 1;
> +    return 0;
>  }
>  
>  static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
> @@ -324,7 +324,7 @@ static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
>             "nal_unit_type: %d(%s), nal_ref_idc: %d\n",
>             nal->type, h264_nal_unit_name(nal->type), nal->ref_idc);
>  
> -    return 1;
> +    return 0;
>  }
>  
>  static int find_next_start_code(const uint8_t *buf, const uint8_t *next_avc)
> @@ -504,7 +504,7 @@ int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
>              ret = hevc_parse_nal_header(nal, logctx);
>          else
>              ret = h264_parse_nal_header(nal, logctx);
> -        if (ret <= 0 || nal->size <= 0 || nal->size_bits <= 0) {
> +        if (ret < 0 || nal->size <= 0 || nal->size_bits <= 0) {
>              if (ret < 0) {
>                  av_log(logctx, AV_LOG_WARNING, "Invalid NAL unit %d, skipping.\n",
>                         nal->type);
> 

Will apply the set soon.
diff mbox series

Patch

diff --git a/libavcodec/h2645_parse.c b/libavcodec/h2645_parse.c
index 2e03871640..a7cdf76e87 100644
--- a/libavcodec/h2645_parse.c
+++ b/libavcodec/h2645_parse.c
@@ -287,7 +287,7 @@  static int get_bit_length(H2645NAL *nal, int skip_trailing_zeros)
 
 /**
  * @return AVERROR_INVALIDDATA if the packet is not a valid NAL unit,
- * 0 if the unit should be skipped, 1 otherwise
+ * 0 otherwise
  */
 static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
 {
@@ -307,7 +307,7 @@  static int hevc_parse_nal_header(H2645NAL *nal, void *logctx)
            "nal_unit_type: %d(%s), nuh_layer_id: %d, temporal_id: %d\n",
            nal->type, hevc_nal_unit_name(nal->type), nal->nuh_layer_id, nal->temporal_id);
 
-    return 1;
+    return 0;
 }
 
 static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
@@ -324,7 +324,7 @@  static int h264_parse_nal_header(H2645NAL *nal, void *logctx)
            "nal_unit_type: %d(%s), nal_ref_idc: %d\n",
            nal->type, h264_nal_unit_name(nal->type), nal->ref_idc);
 
-    return 1;
+    return 0;
 }
 
 static int find_next_start_code(const uint8_t *buf, const uint8_t *next_avc)
@@ -504,7 +504,7 @@  int ff_h2645_packet_split(H2645Packet *pkt, const uint8_t *buf, int length,
             ret = hevc_parse_nal_header(nal, logctx);
         else
             ret = h264_parse_nal_header(nal, logctx);
-        if (ret <= 0 || nal->size <= 0 || nal->size_bits <= 0) {
+        if (ret < 0 || nal->size <= 0 || nal->size_bits <= 0) {
             if (ret < 0) {
                 av_log(logctx, AV_LOG_WARNING, "Invalid NAL unit %d, skipping.\n",
                        nal->type);