Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: webrtc/modules/rtp_rtcp/source/rtp_packet_unittest.cc

Issue 2805023002: Add read support of RtpStreamId/RepairedRtpStreamId header extensions. (Closed)
Patch Set: . Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h" 10 #include "webrtc/modules/rtp_rtcp/source/rtp_packet_received.h"
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 EXPECT_TRUE(packet.HasRawExtension(kTransmissionOffsetExtensionId)); 356 EXPECT_TRUE(packet.HasRawExtension(kTransmissionOffsetExtensionId));
357 357
358 int32_t time_offset = 0; 358 int32_t time_offset = 0;
359 auto raw_extension = packet.GetRawExtension(kTransmissionOffsetExtensionId); 359 auto raw_extension = packet.GetRawExtension(kTransmissionOffsetExtensionId);
360 EXPECT_EQ(raw_extension.size(), TransmissionOffset::kValueSizeBytes); 360 EXPECT_EQ(raw_extension.size(), TransmissionOffset::kValueSizeBytes);
361 EXPECT_TRUE(TransmissionOffset::Parse(raw_extension, &time_offset)); 361 EXPECT_TRUE(TransmissionOffset::Parse(raw_extension, &time_offset));
362 362
363 EXPECT_EQ(time_offset, kTimeOffset); 363 EXPECT_EQ(time_offset, kTimeOffset);
364 } 364 }
365 365
366 TEST(RtpPacketTest, ParseDynamicSizeExtension) {
367 // clang-format off
368 const uint8_t kPacket[] = {
369 0x90, kPayloadType, 0x00, kSeqNum,
370 0x65, 0x43, 0x12, 0x78, // kTimestamp.
371 0x12, 0x34, 0x56, 0x78, // kSsrc.
372 0xbe, 0xde, 0x00, 0x02, // Extensions block of size 2x32bit words.
373 0x21, 'r', 'x', // Extension with id = 2, size = (1+1).
374 0x12, 'R', 'i', 'd', // Extension with id = 1, size = (2+1).
375 0x00}; // Extension padding.
376 // clang-format on
377 RtpPacketReceived::ExtensionManager extensions;
378 extensions.Register<RtpStreamId>(1);
379 extensions.Register<RepairRtpStreamId>(2);
380 RtpPacketReceived packet(&extensions);
381 ASSERT_TRUE(packet.Parse(kPacket, sizeof(kPacket)));
382
383 std::string rid;
384 EXPECT_TRUE(packet.GetExtension<RtpStreamId>(&rid));
385 EXPECT_EQ(rid, "Rid");
386
387 std::string repair_rid;
388 EXPECT_TRUE(packet.GetExtension<RepairRtpStreamId>(&repair_rid));
389 EXPECT_EQ(repair_rid, "rx");
390 }
391
366 } // namespace webrtc 392 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698