diff --git a/src/rtp/rtpdec_h264.c b/src/rtp/rtpdec_h264.c index 6a0f85c13..6a46bb0b1 100644 --- a/src/rtp/rtpdec_h264.c +++ b/src/rtp/rtpdec_h264.c @@ -356,6 +356,8 @@ get_nalu_name(int type) return "H264 SEI"; case NAL_SPS: return "H264 SPS"; + case NAL_AUD: + return "H264 AUD"; case NAL_HEVC_VPS: return "HEVC VPS"; default: diff --git a/src/rtp/rtpdec_h264.h b/src/rtp/rtpdec_h264.h index e66faacca..206643ac1 100644 --- a/src/rtp/rtpdec_h264.h +++ b/src/rtp/rtpdec_h264.h @@ -54,6 +54,7 @@ enum { NAL_IDR = 5, NAL_SEI = 6, NAL_SPS = 7, + NAL_AUD = 9, NAL_MAX = 23, // HEVC NAL_HEVC_VPS = 32, diff --git a/src/video_decompress/libavcodec.c b/src/video_decompress/libavcodec.c index 27497a3bd..6fb5eed4a 100644 --- a/src/video_decompress/libavcodec.c +++ b/src/video_decompress/libavcodec.c @@ -806,16 +806,22 @@ static _Bool check_first_sps_vps(struct state_libavcodec_decompress *s, unsigned s->sps_vps_found = 1; return 1; } - const unsigned char *first_nal = rtpenc_h264_get_next_nal(src, src_len, NULL); - if (!first_nal) { - return 0; - } + int nalu_type = 0; - if (s->desc.color_spec == H264) { - nalu_type = NALU_HDR_GET_TYPE(first_nal[0]); - } else { - nalu_type = first_nal[0] >> 1; - } + const unsigned char *nal = src; + do { + nal = + rtpenc_h264_get_next_nal(nal, src_len - (nal - src), NULL); + if (!nal) { + return 0; + } + if (s->desc.color_spec == H264) { + nalu_type = NALU_HDR_GET_TYPE(nal[0]); + } else { + nalu_type = nal[0] >> 1; + } + debug_msg("Received %s NALU.", get_nalu_name(nalu_type)); + } while (nalu_type == NAL_AUD); switch (nalu_type) { case NAL_SPS: