Reject XR TargetBitrate items with unsupported layer indices

Specifically, reject any bitrate allocated for a layer not representable
by the BitrateAllocation struct.

BUG=chromium:671312

Review-Url: https://codereview.webrtc.org/2549233005
Cr-Commit-Position: refs/heads/master@{#15447}
This commit is contained in:
sprang
2016-12-06 06:08:53 -08:00
committed by Commit bot
parent 99cc10ff40
commit 6d314c7a88
3 changed files with 34 additions and 8 deletions

View File

@ -1297,4 +1297,21 @@ TEST_F(RtcpReceiverTest, ReceivesTargetBitrate) {
InjectRtcpPacket(xr);
}
TEST_F(RtcpReceiverTest, HandlesIncorrectTargetBitrate) {
BitrateAllocation expected_allocation;
expected_allocation.SetBitrate(0, 0, 10000);
rtcp::TargetBitrate bitrate;
bitrate.AddTargetBitrate(0, 0, expected_allocation.GetBitrate(0, 0) / 1000);
bitrate.AddTargetBitrate(0, kMaxTemporalStreams, 20000);
bitrate.AddTargetBitrate(kMaxSpatialLayers, 0, 40000);
rtcp::ExtendedReports xr;
xr.SetTargetBitrate(bitrate);
EXPECT_CALL(bitrate_allocation_observer_,
OnBitrateAllocationUpdated(expected_allocation));
InjectRtcpPacket(xr);
}
} // namespace webrtc