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

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: rebase Created 4 years, 4 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 EXPECT_TRUE(packet.Parse(kMinimumPacket, sizeof(kMinimumPacket))); 167 EXPECT_TRUE(packet.Parse(kMinimumPacket, sizeof(kMinimumPacket)));
168 EXPECT_EQ(kPayloadType, packet.PayloadType()); 168 EXPECT_EQ(kPayloadType, packet.PayloadType());
169 EXPECT_EQ(kSeqNum, packet.SequenceNumber()); 169 EXPECT_EQ(kSeqNum, packet.SequenceNumber());
170 EXPECT_EQ(kTimestamp, packet.Timestamp()); 170 EXPECT_EQ(kTimestamp, packet.Timestamp());
171 EXPECT_EQ(kSsrc, packet.Ssrc()); 171 EXPECT_EQ(kSsrc, packet.Ssrc());
172 EXPECT_EQ(0u, packet.padding_size()); 172 EXPECT_EQ(0u, packet.padding_size());
173 EXPECT_EQ(0u, packet.payload_size()); 173 EXPECT_EQ(0u, packet.payload_size());
174 } 174 }
175 175
176 TEST(RtpPacketTest, ParseBuffer) { 176 TEST(RtpPacketTest, ParseBuffer) {
177 rtc::Buffer unparsed(kMinimumPacket); 177 rtc::CopyOnWriteBuffer unparsed(kMinimumPacket);
178 const uint8_t* raw = unparsed.data(); 178 const uint8_t* raw = unparsed.data();
179 179
180 RtpPacketReceived packet; 180 RtpPacketReceived packet;
181 EXPECT_TRUE(packet.Parse(std::move(unparsed))); 181 EXPECT_TRUE(packet.Parse(std::move(unparsed)));
182 EXPECT_EQ(raw, packet.data()); // Expect packet took over the buffer. 182 EXPECT_EQ(raw, packet.data()); // Expect packet take the buffer without copy.
183 EXPECT_EQ(kSeqNum, packet.SequenceNumber()); 183 EXPECT_EQ(kSeqNum, packet.SequenceNumber());
184 EXPECT_EQ(kTimestamp, packet.Timestamp()); 184 EXPECT_EQ(kTimestamp, packet.Timestamp());
185 EXPECT_EQ(kSsrc, packet.Ssrc()); 185 EXPECT_EQ(kSsrc, packet.Ssrc());
186 EXPECT_EQ(0u, packet.padding_size()); 186 EXPECT_EQ(0u, packet.padding_size());
187 EXPECT_EQ(0u, packet.payload_size()); 187 EXPECT_EQ(0u, packet.payload_size());
188 } 188 }
189 189
190 TEST(RtpPacketTest, ParseWithExtension) { 190 TEST(RtpPacketTest, ParseWithExtension) {
191 RtpPacketToSend::ExtensionManager extensions; 191 RtpPacketToSend::ExtensionManager extensions;
192 extensions.Register(kRtpExtensionTransmissionTimeOffset, 192 extensions.Register(kRtpExtensionTransmissionTimeOffset,
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 int32_t time_offset; 273 int32_t time_offset;
274 EXPECT_FALSE(packet.GetExtension<TransmissionOffset>(&time_offset)); 274 EXPECT_FALSE(packet.GetExtension<TransmissionOffset>(&time_offset));
275 packet.IdentifyExtensions(&extensions); 275 packet.IdentifyExtensions(&extensions);
276 EXPECT_TRUE(packet.GetExtension<TransmissionOffset>(&time_offset)); 276 EXPECT_TRUE(packet.GetExtension<TransmissionOffset>(&time_offset));
277 EXPECT_EQ(kTimeOffset, time_offset); 277 EXPECT_EQ(kTimeOffset, time_offset);
278 EXPECT_EQ(0u, packet.payload_size()); 278 EXPECT_EQ(0u, packet.payload_size());
279 EXPECT_EQ(0u, packet.padding_size()); 279 EXPECT_EQ(0u, packet.padding_size());
280 } 280 }
281 281
282 } // namespace webrtc 282 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_packet_to_send.h ('k') | webrtc/modules/rtp_rtcp/source/rtp_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698