From 12b279b52a971811cd4598e8e072a8e3cc68cf52 Mon Sep 17 00:00:00 2001 From: yuanchao0310 Date: Tue, 14 May 2019 15:30:55 +0800 Subject: [PATCH] Fix h264 keyframe parse error (#1405) --- erizo/src/erizo/rtp/RtpH264Parser.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/erizo/src/erizo/rtp/RtpH264Parser.cpp b/erizo/src/erizo/rtp/RtpH264Parser.cpp index 2efaebc489..77ff66d32d 100644 --- a/erizo/src/erizo/rtp/RtpH264Parser.cpp +++ b/erizo/src/erizo/rtp/RtpH264Parser.cpp @@ -103,7 +103,7 @@ int RtpH264Parser::parse_packet_fu_a(RTPPayloadH264* h264, unsigned char* buf, i buf += 2; len -= 2; - if (nal_type == 5) { + if (nal_type == 5 && start_bit == 1) { h264->frameType = kH264IFrame; } @@ -145,6 +145,10 @@ int RtpH264Parser::parse_aggregated_packet(RTPPayloadH264* h264, unsigned char* dst += sizeof(RTPPayloadH264::start_sequence); std::memcpy(dst, src, nal_size); dst += nal_size; + uint8_t nal_type = src[0] & 0x1f; + if (nal_type == 5) { + h264->frameType = kH264IFrame; + } } } else { ELOG_ERROR("NAL size exceeds length: %d %d\n", nal_size, src_len);