Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple NAL units handling in H264RtpDepacketizer #1167

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/h264rtpdepacketizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ message_vector H264RtpDepacketizer::buildFrames(message_vector::iterator begin,
message_vector out = {};
auto accessUnit = binary{};
auto frameInfo = std::make_shared<FrameInfo>(payloadType, timestamp);
auto nFrags = 0;

for (auto it = begin; it != end; ++it) {
auto pkt = it->get();
Expand All @@ -67,7 +66,10 @@ message_vector H264RtpDepacketizer::buildFrames(message_vector::iterator begin,
auto nalUnitFragmentHeader = NalUnitFragmentHeader{
std::to_integer<uint8_t>(pkt->at(rtpHeaderSize + sizeof(NalUnitHeader)))};

if (nFrags++ == 0) {
// RFC 6184: When set to one, the Start bit indicates the start of a fragmented NAL
// unit. When the following FU payload is not the start of a fragmented NAL unit
// payload, the Start bit is set to zero.
if (nalUnitFragmentHeader.isStart() || accessUnit.empty()) {
addSeparator(accessUnit);
accessUnit.emplace_back(
byte(nalUnitHeader.idc() | nalUnitFragmentHeader.unitType()));
Expand Down
Loading