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

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

Issue 1945773002: RtpPacketHistory rewritten to use RtpPacket class. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 7 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 EXPECT_TRUE(packet.Parse(kMinimumPacket, sizeof(kMinimumPacket))); 155 EXPECT_TRUE(packet.Parse(kMinimumPacket, sizeof(kMinimumPacket)));
156 EXPECT_EQ(kPayloadType, packet.PayloadType()); 156 EXPECT_EQ(kPayloadType, packet.PayloadType());
157 EXPECT_EQ(kSeqNum, packet.SequenceNumber()); 157 EXPECT_EQ(kSeqNum, packet.SequenceNumber());
158 EXPECT_EQ(kTimestamp, packet.Timestamp()); 158 EXPECT_EQ(kTimestamp, packet.Timestamp());
159 EXPECT_EQ(kSsrc, packet.Ssrc()); 159 EXPECT_EQ(kSsrc, packet.Ssrc());
160 EXPECT_EQ(0u, packet.padding_size()); 160 EXPECT_EQ(0u, packet.padding_size());
161 EXPECT_EQ(0u, packet.payload_size()); 161 EXPECT_EQ(0u, packet.payload_size());
162 } 162 }
163 163
164 TEST(RtpPacketTest, ParseBuffer) { 164 TEST(RtpPacketTest, ParseBuffer) {
165 rtc::Buffer unparsed(kMinimumPacket); 165 rtc::CopyOnWriteBuffer unparsed(kMinimumPacket);
166 const uint8_t* raw = unparsed.data(); 166 const uint8_t* raw = unparsed.data();
167 167
168 RtpPacketReceived packet; 168 RtpPacketReceived packet;
169 EXPECT_TRUE(packet.Parse(std::move(unparsed))); 169 EXPECT_TRUE(packet.Parse(std::move(unparsed)));
170 EXPECT_EQ(raw, packet.data()); // Expect packet took over the buffer. 170 EXPECT_EQ(raw, packet.data()); // Expect packet take the buffer without copy.
171 EXPECT_EQ(kSeqNum, packet.SequenceNumber()); 171 EXPECT_EQ(kSeqNum, packet.SequenceNumber());
172 EXPECT_EQ(kTimestamp, packet.Timestamp()); 172 EXPECT_EQ(kTimestamp, packet.Timestamp());
173 EXPECT_EQ(kSsrc, packet.Ssrc()); 173 EXPECT_EQ(kSsrc, packet.Ssrc());
174 EXPECT_EQ(0u, packet.padding_size()); 174 EXPECT_EQ(0u, packet.padding_size());
175 EXPECT_EQ(0u, packet.payload_size()); 175 EXPECT_EQ(0u, packet.payload_size());
176 } 176 }
177 177
178 TEST(RtpPacketTest, ParseWithExtension) { 178 TEST(RtpPacketTest, ParseWithExtension) {
179 RtpPacketToSend::ExtensionManager extensions; 179 RtpPacketToSend::ExtensionManager extensions;
180 extensions.Register(kRtpExtensionTransmissionTimeOffset, 180 extensions.Register(kRtpExtensionTransmissionTimeOffset,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 int32_t time_offset; 243 int32_t time_offset;
244 EXPECT_FALSE(packet.GetExtension<TransmissionOffset>(&time_offset)); 244 EXPECT_FALSE(packet.GetExtension<TransmissionOffset>(&time_offset));
245 packet.IdentifyExtensions(&extensions); 245 packet.IdentifyExtensions(&extensions);
246 EXPECT_TRUE(packet.GetExtension<TransmissionOffset>(&time_offset)); 246 EXPECT_TRUE(packet.GetExtension<TransmissionOffset>(&time_offset));
247 EXPECT_EQ(kTimeOffset, time_offset); 247 EXPECT_EQ(kTimeOffset, time_offset);
248 EXPECT_EQ(0u, packet.payload_size()); 248 EXPECT_EQ(0u, packet.payload_size());
249 EXPECT_EQ(0u, packet.padding_size()); 249 EXPECT_EQ(0u, packet.padding_size());
250 } 250 }
251 251
252 } // namespace webrtc 252 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698