Index: webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc |
diff --git a/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc b/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc |
index bdf3aba7b00013ae8c20d3e0db6a732652f72659..ab73bcf0dbf75d9bfa92f8b297a8a7237095eccf 100644 |
--- a/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc |
+++ b/webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc |
@@ -363,4 +363,30 @@ TEST(RtpPacketTest, ParseWithoutExtensionManager) { |
EXPECT_EQ(time_offset, kTimeOffset); |
} |
+TEST(RtpPacketTest, ParseDynamicSizeExtension) { |
+ // clang-format off |
+ const uint8_t kPacket[] = { |
+ 0x90, kPayloadType, 0x00, kSeqNum, |
+ 0x65, 0x43, 0x12, 0x78, // kTimestamp. |
+ 0x12, 0x34, 0x56, 0x78, // kSsrc. |
+ 0xbe, 0xde, 0x00, 0x02, // Extensions block of size 2x32bit words. |
+ 0x21, 'r', 'x', // Extension with id = 2, size = (1+1). |
+ 0x12, 'R', 'i', 'd', // Extension with id = 1, size = (2+1). |
+ 0x00}; // Extension padding. |
+ // clang-format on |
+ RtpPacketReceived::ExtensionManager extensions; |
+ extensions.Register<RtpStreamId>(1); |
+ extensions.Register<RepairRtpStreamId>(2); |
+ RtpPacketReceived packet(&extensions); |
+ ASSERT_TRUE(packet.Parse(kPacket, sizeof(kPacket))); |
+ |
+ std::string rid; |
+ EXPECT_TRUE(packet.GetExtension<RtpStreamId>(&rid)); |
+ EXPECT_EQ(rid, "Rid"); |
+ |
+ std::string repair_rid; |
+ EXPECT_TRUE(packet.GetExtension<RepairRtpStreamId>(&repair_rid)); |
+ EXPECT_EQ(repair_rid, "rx"); |
+} |
+ |
} // namespace webrtc |