@@ -78,8 +78,8 @@ static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
7878 * @retval H.264 or RTP NAL type
7979 */
8080static uint8_t process_h264_nal (uint8_t nal , struct video_frame * frame , uint8_t * data , int data_len ) {
81- uint8_t type = H264_NALU_HDR_GET_TYPE (nal );
82- uint8_t nri = H264_NALU_HDR_GET_NRI (nal );
81+ uint8_t type = H264_NALU_HDR_GET_TYPE (& nal );
82+ uint8_t nri = H264_NALU_HDR_GET_NRI (& nal );
8383 log_msg (LOG_LEVEL_DEBUG2 , "NAL type %s (%d; nri: %d)\n" ,
8484 get_h264_nalu_name (type ), (int ) type , (int ) nri );
8585
@@ -99,10 +99,14 @@ static uint8_t process_h264_nal(uint8_t nal, struct video_frame *frame, uint8_t
9999 return type ;
100100}
101101
102- static uint8_t process_hevc_nal (uint8_t nal , struct video_frame * frame , uint8_t * data , int data_len ) {
102+ static uint8_t process_hevc_nal (const uint8_t nal [2 ], struct video_frame * frame , uint8_t * data , int data_len ) {
103+ unsigned char forbidden = nal [0 ] >> 7 ;
104+ assert (forbidden == 0 );
103105 enum hevc_nal_type type = HEVC_NALU_HDR_GET_TYPE (nal );
104- log_msg (LOG_LEVEL_DEBUG2 , "HEVC NAL type %s (%d)\n" ,
105- get_hevc_nalu_name (type ), (int ) type );
106+ unsigned layer_id = HEVC_NALU_HDR_GET_LAYER_ID (nal );
107+ unsigned tid = HEVC_NALU_HDR_GET_TID (nal );
108+ log_msg (LOG_LEVEL_DEBUG2 , "HEVC NAL type %s (%d; layerID: %u, TID: %u)\n" ,
109+ get_hevc_nalu_name (type ), (int ) type , layer_id , tid );
106110
107111 if (type == NAL_HEVC_SPS ) {
108112 width_height_from_hevc_sps ((int * ) & frame -> tiles [0 ].width ,
@@ -129,7 +133,7 @@ decode_h264_nal_unit(struct video_frame *frame, int *total_length, int pass,
129133 int fu_length = 0 ;
130134 uint8_t nal = data [0 ];
131135 uint8_t type = pass == 0 ? process_h264_nal (nal , frame , data , data_len )
132- : H264_NALU_HDR_GET_TYPE (nal );
136+ : H264_NALU_HDR_GET_TYPE (& nal );
133137 if (type >= NAL_H264_MIN && type <= NAL_H264_MAX ) {
134138 type = H264_NAL ;
135139 }
@@ -161,8 +165,8 @@ decode_h264_nal_unit(struct video_frame *frame, int *total_length, int pass,
161165
162166 log_msg (LOG_LEVEL_DEBUG2 ,
163167 "STAP-A subpacket NAL type %d (nri: %d)\n" ,
164- (int ) H264_NALU_HDR_GET_TYPE (data [ 0 ] ),
165- (int ) H264_NALU_HDR_GET_NRI (nal ));
168+ (int ) H264_NALU_HDR_GET_TYPE (data ),
169+ (int ) H264_NALU_HDR_GET_NRI (& nal ));
166170
167171 if (nal_size <= data_len ) {
168172 if (pass == 0 ) {
@@ -211,7 +215,7 @@ decode_h264_nal_unit(struct video_frame *frame, int *total_length, int pass,
211215 uint8_t fu_header = * data ;
212216 uint8_t start_bit = fu_header >> 7 ;
213217 uint8_t end_bit = (fu_header & 0x40 ) >> 6 ;
214- uint8_t nal_type = H264_NALU_HDR_GET_TYPE (fu_header );
218+ uint8_t nal_type = H264_NALU_HDR_GET_TYPE (& fu_header );
215219 uint8_t reconstructed_nal ;
216220
217221 // Reconstruct this packet's true nal; only the data follows.
@@ -263,8 +267,10 @@ static bool
263267decode_hevc_nal_unit (struct video_frame * frame , int * total_length , int pass ,
264268 unsigned char * * dst , uint8_t * data , int data_len )
265269{
266- uint8_t nal = data [0 ];
267- uint8_t type = pass == 0 ? process_hevc_nal (nal , frame , data , data_len ) : HEVC_NALU_HDR_GET_TYPE (nal );
270+ uint8_t nal [2 ] = { data [0 ], data [1 ] };
271+ enum hevc_nal_type type = pass == 0
272+ ? process_hevc_nal (nal , frame , data , data_len )
273+ : HEVC_NALU_HDR_GET_TYPE (& nal );
268274
269275 if (type <= NAL_HEVC_MAX ) {
270276 if (pass == 0 ) {
0 commit comments