Skip to content

Commit

Permalink
Merge pull request #1140 from sile/fix-h264-depacketizer
Browse files Browse the repository at this point in the history
Fix `H264RtpDepacketizer` to handle empty payload RTP packet
  • Loading branch information
paullouisageneau authored Apr 12, 2024
2 parents 5064b0b + c5c80b8 commit d69d52e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/h264rtpdepacketizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,17 @@ message_vector H264RtpDepacketizer::buildFrames(message_vector::iterator begin,
auto pktParsed = reinterpret_cast<const rtc::RtpHeader *>(pkt->data());
auto headerSize =
sizeof(rtc::RtpHeader) + pktParsed->csrcCount() + pktParsed->getExtensionHeaderSize();
auto paddingSize = 0;

if (pktParsed->padding()) {
paddingSize = std::to_integer<uint8_t>(pkt->at(pkt->size() - 1));
}

if (pkt->size() == headerSize + paddingSize) {
PLOG_VERBOSE << "H.264 RTP packet has empty payload";
continue;
}

auto nalUnitHeader = NalUnitHeader{std::to_integer<uint8_t>(pkt->at(headerSize))};

if (fua_buffer.size() != 0 || nalUnitHeader.unitType() == naluTypeFUA) {
Expand Down

0 comments on commit d69d52e

Please sign in to comment.