shithub: h264bsd

Download patch

ref: adb27023e44aa64b868881e0b9e11bbb6ea4cae9
parent: 1ec17cfca314dfd1a9206a98ca3dce39c5a50797
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Sep 15 11:45:49 EDT 2020

use werrstr in nal unit parser

--- a/src/basetype.h
+++ b/src/basetype.h
@@ -22,12 +22,13 @@
 #ifdef __plan9__
 #ifndef __PLAN9_H__
 #define __PLAN9_H__
-#define _ERROR_PRINT
 #include <u.h>
 #include <libc.h>
 typedef unsigned long size_t;
 typedef uintptr uintptr_t;
 #endif
+#else
+#define werrstr(...)
 #endif
 
 #ifdef __arm
--- a/src/h264bsd_nal_unit.c
+++ b/src/h264bsd_nal_unit.c
@@ -81,7 +81,7 @@
 
     /* forbidden_zero_bit (not checked to be zero, errors ignored) */
     tmp = h264bsdGetBits(pStrmData, 1);
-    /* Assuming that NAL unit starts from byte boundary �> don't have to check
+    /* Assuming that NAL unit starts from byte boundary �> don't have to check
      * following 7 bits for END_OF_STREAM */
     if (tmp == END_OF_STREAM)
         return(HANTRO_NOK);
@@ -95,6 +95,7 @@
     /* data partitioning NAL units not supported */
     if ( (tmp == 2) || (tmp == 3) || (tmp == 4) )
     {
+        werrstr("data partitioning NAL units not supported");
         return(HANTRO_NOK);
     }
 
@@ -102,6 +103,7 @@
     if ( ( (tmp == NAL_SEQ_PARAM_SET) || (tmp == NAL_PIC_PARAM_SET) ||
            (tmp == NAL_CODED_SLICE_IDR) ) && (pNalUnit->nalRefIdc == 0) )
     {
+        werrstr("zero nal_ref_idc: NAL %d", tmp);
         return(HANTRO_NOK);
     }
     /* nal_ref_idc shall be zero for these nal_unit_types */
@@ -109,6 +111,7 @@
                 (tmp == NAL_END_OF_SEQUENCE) || (tmp == NAL_END_OF_STREAM) ||
                 (tmp == NAL_FILLER_DATA) ) && (pNalUnit->nalRefIdc != 0) )
     {
+        werrstr("non-zero nal_ref_idc: NAL %d", tmp);
         return(HANTRO_NOK);
     }