diff --git a/src/h265rtpdepacketizer.cpp b/src/h265rtpdepacketizer.cpp index 58c74d929..4e9837473 100644 --- a/src/h265rtpdepacketizer.cpp +++ b/src/h265rtpdepacketizer.cpp @@ -31,6 +31,17 @@ message_vector H265RtpDepacketizer::buildFrames(message_vector::iterator begin, auto pkt = it->get(); auto pktParsed = reinterpret_cast(pkt->data()); auto rtpHeaderSize = pktParsed->getSize() + pktParsed->getExtensionHeaderSize(); + auto rtpPaddingSize = 0; + + if (pktParsed->padding()) { + rtpPaddingSize = std::to_integer(pkt->at(pkt->size() - 1)); + } + + if (pkt->size() == rtpHeaderSize + rtpPaddingSize) { + PLOG_VERBOSE << "H.265 RTP packet has empty payload"; + continue; + } + auto nalUnitHeader = H265NalUnitHeader{std::to_integer(pkt->at(rtpHeaderSize)), std::to_integer(pkt->at(rtpHeaderSize + 1))};