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

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

Issue 2530363002: Cleanup RtpSender hiding RtpHeaderExtensionLength function. (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 protected: 239 protected:
240 void SetUp() override { 240 void SetUp() override {
241 // TODO(pbos): Set up to use pacer. 241 // TODO(pbos): Set up to use pacer.
242 SetUpRtpSender(false); 242 SetUpRtpSender(false);
243 rtp_sender_video_.reset( 243 rtp_sender_video_.reset(
244 new RTPSenderVideo(&fake_clock_, rtp_sender_.get(), nullptr)); 244 new RTPSenderVideo(&fake_clock_, rtp_sender_.get(), nullptr));
245 } 245 }
246 std::unique_ptr<RTPSenderVideo> rtp_sender_video_; 246 std::unique_ptr<RTPSenderVideo> rtp_sender_video_;
247 }; 247 };
248 248
249 TEST_F(RtpSenderTestWithoutPacer,
250 RegisterRtpTransmissionTimeOffsetHeaderExtension) {
251 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
252 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
253 kRtpExtensionTransmissionTimeOffset,
254 kTransmissionTimeOffsetExtensionId));
255 EXPECT_EQ(kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength,
256 rtp_sender_->RtpHeaderExtensionLength());
257 EXPECT_EQ(0, rtp_sender_->DeregisterRtpHeaderExtension(
258 kRtpExtensionTransmissionTimeOffset));
259 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
260 }
261
262 TEST_F(RtpSenderTestWithoutPacer, RegisterRtpAbsoluteSendTimeHeaderExtension) {
263 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
264 EXPECT_EQ(
265 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
266 kAbsoluteSendTimeExtensionId));
267 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
268 kAbsoluteSendTimeLength),
269 rtp_sender_->RtpHeaderExtensionLength());
270 EXPECT_EQ(0, rtp_sender_->DeregisterRtpHeaderExtension(
271 kRtpExtensionAbsoluteSendTime));
272 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
273 }
274
275 TEST_F(RtpSenderTestWithoutPacer, RegisterRtpAudioLevelHeaderExtension) {
276 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
277 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAudioLevel,
278 kAudioLevelExtensionId));
279 EXPECT_EQ(
280 RtpUtility::Word32Align(kRtpOneByteHeaderLength + kAudioLevelLength),
281 rtp_sender_->RtpHeaderExtensionLength());
282 EXPECT_EQ(0,
283 rtp_sender_->DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel));
284 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
285 }
286
287 TEST_F(RtpSenderTestWithoutPacer, RegisterRtpHeaderExtensions) {
288 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
289 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
290 kRtpExtensionTransmissionTimeOffset,
291 kTransmissionTimeOffsetExtensionId));
292 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
293 kTransmissionTimeOffsetLength),
294 rtp_sender_->RtpHeaderExtensionLength());
295 EXPECT_EQ(
296 0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
297 kAbsoluteSendTimeExtensionId));
298 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
299 kTransmissionTimeOffsetLength +
300 kAbsoluteSendTimeLength),
301 rtp_sender_->RtpHeaderExtensionLength());
302 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(kRtpExtensionAudioLevel,
303 kAudioLevelExtensionId));
304 EXPECT_EQ(RtpUtility::Word32Align(
305 kRtpOneByteHeaderLength + kTransmissionTimeOffsetLength +
306 kAbsoluteSendTimeLength + kAudioLevelLength),
307 rtp_sender_->RtpHeaderExtensionLength());
308 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
309 kRtpExtensionVideoRotation, kVideoRotationExtensionId));
310 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
311 kTransmissionTimeOffsetLength +
312 kAbsoluteSendTimeLength +
313 kAudioLevelLength + kVideoRotationLength),
314 rtp_sender_->RtpHeaderExtensionLength());
315
316 // Deregister starts.
317 EXPECT_EQ(0, rtp_sender_->DeregisterRtpHeaderExtension(
318 kRtpExtensionTransmissionTimeOffset));
319 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
320 kAbsoluteSendTimeLength +
321 kAudioLevelLength + kVideoRotationLength),
322 rtp_sender_->RtpHeaderExtensionLength());
323 EXPECT_EQ(0, rtp_sender_->DeregisterRtpHeaderExtension(
324 kRtpExtensionAbsoluteSendTime));
325 EXPECT_EQ(RtpUtility::Word32Align(kRtpOneByteHeaderLength +
326 kAudioLevelLength + kVideoRotationLength),
327 rtp_sender_->RtpHeaderExtensionLength());
328 EXPECT_EQ(0,
329 rtp_sender_->DeregisterRtpHeaderExtension(kRtpExtensionAudioLevel));
330 EXPECT_EQ(
331 RtpUtility::Word32Align(kRtpOneByteHeaderLength + kVideoRotationLength),
332 rtp_sender_->RtpHeaderExtensionLength());
333 EXPECT_EQ(
334 0, rtp_sender_->DeregisterRtpHeaderExtension(kRtpExtensionVideoRotation));
335 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
336 }
337
338 TEST_F(RtpSenderTestWithoutPacer, RegisterRtpVideoRotationHeaderExtension) {
339 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
340 EXPECT_EQ(0, rtp_sender_->RegisterRtpHeaderExtension(
341 kRtpExtensionVideoRotation, kVideoRotationExtensionId));
342
343 EXPECT_EQ(
344 RtpUtility::Word32Align(kRtpOneByteHeaderLength + kVideoRotationLength),
345 rtp_sender_->RtpHeaderExtensionLength());
346 EXPECT_EQ(
347 0, rtp_sender_->DeregisterRtpHeaderExtension(kRtpExtensionVideoRotation));
348 EXPECT_EQ(0u, rtp_sender_->RtpHeaderExtensionLength());
349 }
350
351 TEST_F(RtpSenderTestWithoutPacer, AllocatePacketSetCsrc) { 249 TEST_F(RtpSenderTestWithoutPacer, AllocatePacketSetCsrc) {
352 // Configure rtp_sender with csrc. 250 // Configure rtp_sender with csrc.
353 std::vector<uint32_t> csrcs; 251 std::vector<uint32_t> csrcs;
354 csrcs.push_back(0x23456789); 252 csrcs.push_back(0x23456789);
355 rtp_sender_->SetCsrcs(csrcs); 253 rtp_sender_->SetCsrcs(csrcs);
356 254
357 auto packet = rtp_sender_->AllocatePacket(); 255 auto packet = rtp_sender_->AllocatePacket();
358 256
359 ASSERT_TRUE(packet); 257 ASSERT_TRUE(packet);
360 EXPECT_EQ(rtp_sender_->SSRC(), packet->Ssrc()); 258 EXPECT_EQ(rtp_sender_->SSRC(), packet->Ssrc());
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1422 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1525 rtp_sender_->SetTransportOverhead(28); 1423 rtp_sender_->SetTransportOverhead(28);
1526 rtp_sender_->SetTransportOverhead(28); 1424 rtp_sender_->SetTransportOverhead(28);
1527 1425
1528 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1); 1426 EXPECT_CALL(mock_overhead_observer, OnOverheadChanged(_)).Times(1);
1529 SendGenericPayload(); 1427 SendGenericPayload();
1530 SendGenericPayload(); 1428 SendGenericPayload();
1531 } 1429 }
1532 1430
1533 } // namespace webrtc 1431 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698