Skip to content

Commit

Permalink
H265RtpDepacketizer: Handle empty RTP packet payloads
Browse files Browse the repository at this point in the history
Similar to the fix for the H.264 RTP depacketizer in https://github.com/
paullouisageneau/pull/1140.
  • Loading branch information
edmonds committed Apr 17, 2024
1 parent be93555 commit 014ce5b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/h265rtpdepacketizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ message_vector H265RtpDepacketizer::buildFrames(message_vector::iterator begin,
auto pkt = it->get();
auto pktParsed = reinterpret_cast<const rtc::RtpHeader *>(pkt->data());
auto rtpHeaderSize = pktParsed->getSize() + pktParsed->getExtensionHeaderSize();
auto rtpPaddingSize = 0;

if (pktParsed->padding()) {
rtpPaddingSize = std::to_integer<uint8_t>(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<uint8_t>(pkt->at(rtpHeaderSize)),
std::to_integer<uint8_t>(pkt->at(rtpHeaderSize + 1))};
Expand Down

0 comments on commit 014ce5b

Please sign in to comment.