NetEq: Handle nested RED packets

This CL makes NetEq handle nested RED packets without crashing. Nested
RED packets mean that the block PT (see
https://tools.ietf.org/html/rfc2198.html#section-3) in the RED packet
is also set to the RED PT. This implies a nested RED packet, which is
not supported. Instead, all payloads in a RED packet that have the RED
PT will be discarded.

Bug: chromium:851662
Change-Id: I86ec257e60fb8076e3574ac5a4a1ca50196f6b34
Reviewed-on: https://webrtc-review.googlesource.com/86824
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Ivo Creusen <ivoc@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23825}
This commit is contained in:
Henrik Lundin
2018-07-03 13:07:30 +02:00
committed by Commit Bot
parent ec20710250
commit defa7a8049
5 changed files with 37 additions and 10 deletions

View File

@ -319,6 +319,30 @@ TEST(RedPayloadSplitter, CheckRedPayloads) {
EXPECT_TRUE(packet_list.empty());
}
// This test creates a RED packet where the payloads also have the payload type
// for RED. That is, some kind of weird nested RED packet. This is not supported
// and the splitter should discard all packets.
TEST(RedPayloadSplitter, CheckRedPayloadsRecursiveRed) {
PacketList packet_list;
for (uint8_t i = 0; i <= 3; ++i) {
// Create packet with RED payload type, payload length 10 bytes, all 0.
packet_list.push_back(CreatePacket(kRedPayloadType, 10, 0));
}
// Use a real DecoderDatabase object here instead of a mock, since it is
// easier to just register the payload types and let the actual implementation
// do its job.
DecoderDatabase decoder_database(
new rtc::RefCountedObject<MockAudioDecoderFactory>, absl::nullopt);
decoder_database.RegisterPayload(kRedPayloadType, NetEqDecoder::kDecoderRED,
"red");
RedPayloadSplitter splitter;
splitter.CheckRedPayloads(&packet_list, decoder_database);
EXPECT_TRUE(packet_list.empty()); // Should have dropped all packets.
}
// Packet A is split into A1, A2 and A3. But the length parameter is off, so
// the last payloads should be discarded.
TEST(RedPayloadSplitter, WrongPayloadLength) {