h264: skip empty NAL units, do not reject them

BUG=webrtc:380291923

Change-Id: If05268bde2ac0c600dcef479c88ca54dce708dcb
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/368893
Reviewed-by: Danil Chapovalov <danilchap@webrtc.org>
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Commit-Queue: Philipp Hancke <phancke@meta.com>
Cr-Commit-Position: refs/heads/main@{#43451}
This commit is contained in:
Philipp Hancke 2024-11-25 10:14:35 -08:00 committed by WebRTC LUCI CQ
parent a08189b948
commit b7cb8fe75a
2 changed files with 12 additions and 2 deletions

View File

@ -101,8 +101,8 @@ std::optional<VideoRtpDepacketizer::ParsedRtpPayload> ProcessStapAOrSingleNalu(
nal_unit.subview(H264::kNaluTypeSize);
if (nalu_data.empty()) {
RTC_LOG(LS_ERROR) << "Empty NAL unit found.";
return std::nullopt;
RTC_LOG(LS_WARNING) << "Skipping empty NAL unit.";
continue;
}
switch (nalu.type) {

View File

@ -542,5 +542,15 @@ TEST(VideoRtpDepacketizerH264Test, SeiSetsFirstPacketInFrame) {
EXPECT_TRUE(parsed->video_header.is_first_packet_in_frame);
}
TEST(VideoRtpDepacketizerH264Test, EmptyNaluPayload) {
const uint8_t kPayload[] = {
0x10, // End of sequence.
};
VideoRtpDepacketizerH264 depacketizer;
std::optional<VideoRtpDepacketizer::ParsedRtpPayload> parsed =
depacketizer.Parse(rtc::CopyOnWriteBuffer(kPayload));
ASSERT_TRUE(parsed);
}
} // namespace
} // namespace webrtc