Fix RtpVideoLayersAllocationExtension::Write of invalid allocation
This patch is a follow up to https://webrtc-review.googlesource.com/c/src/+/212743 which broke downstream fuzzer :( prior to https://webrtc-review.googlesource.com/c/src/+/212743, RtpVideoLayersAllocationExtension::AllocationIsValid returns false if rtp_stream_index > max(layer.rtp_stream_index) After https://webrtc-review.googlesource.com/c/src/+/212743, 0 spatial layers is supported, so the AllocationIsValid is updated to allow any value if not layers are present. Bug: webrtc:12000 Change-Id: Ib3e64ecb621f795b9126442c50969f5178c85a37 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/212901 Commit-Queue: Jonas Oreland <jonaso@webrtc.org> Reviewed-by: Danil Chapovalov <danilchap@webrtc.org> Cr-Commit-Position: refs/heads/master@{#33551}
This commit is contained in:

committed by
Commit Bot

parent
73cf80a932
commit
90c3981773
@ -117,7 +117,8 @@ bool AllocationIsValid(const VideoLayersAllocation& allocation) {
|
||||
}
|
||||
}
|
||||
if (allocation.rtp_stream_index < 0 ||
|
||||
allocation.rtp_stream_index > max_rtp_stream_idx) {
|
||||
(!allocation.active_spatial_layers.empty() &&
|
||||
allocation.rtp_stream_index > max_rtp_stream_idx)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -239,5 +239,15 @@ TEST(RtpVideoLayersAllocationExtension,
|
||||
EXPECT_EQ(written_allocation, parsed_allocation);
|
||||
}
|
||||
|
||||
TEST(RtpVideoLayersAllocationExtension,
|
||||
WriteEmptyAllocationCanHaveAnyRtpStreamIndex) {
|
||||
VideoLayersAllocation written_allocation;
|
||||
written_allocation.rtp_stream_index = 1;
|
||||
rtc::Buffer buffer(
|
||||
RtpVideoLayersAllocationExtension::ValueSize(written_allocation));
|
||||
EXPECT_TRUE(
|
||||
RtpVideoLayersAllocationExtension::Write(buffer, written_allocation));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user