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

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

Issue 1311453002: Use RtcpPacket to send APP in RtcpSender (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Addressed comments Created 5 years, 3 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
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 EXPECT_EQ(1, parser()->app()->num_packets()); 382 EXPECT_EQ(1, parser()->app()->num_packets());
383 EXPECT_EQ(kSubType, parser()->app()->SubType()); 383 EXPECT_EQ(kSubType, parser()->app()->SubType());
384 EXPECT_EQ(name, parser()->app()->Name()); 384 EXPECT_EQ(name, parser()->app()->Name());
385 EXPECT_EQ(1, parser()->app_item()->num_packets()); 385 EXPECT_EQ(1, parser()->app_item()->num_packets());
386 EXPECT_EQ(kDataLength, parser()->app_item()->DataLength()); 386 EXPECT_EQ(kDataLength, parser()->app_item()->DataLength());
387 EXPECT_EQ(0, strncmp(reinterpret_cast<const char*>(kData), 387 EXPECT_EQ(0, strncmp(reinterpret_cast<const char*>(kData),
388 reinterpret_cast<const char*>(parser()->app_item()->Data()), 388 reinterpret_cast<const char*>(parser()->app_item()->Data()),
389 parser()->app_item()->DataLength())); 389 parser()->app_item()->DataLength()));
390 } 390 }
391 391
392 TEST_F(RtcpSenderTest, SendEmptyApp) {
393 const uint8_t kSubType = 30;
394 const uint32_t kName = 0x6E616D65;
395
396 EXPECT_EQ(
397 0, rtcp_sender_->SetApplicationSpecificData(kSubType, kName, nullptr, 0));
398
399 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound);
400 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpApp));
401 EXPECT_EQ(1, parser()->app()->num_packets());
402 EXPECT_EQ(kSubType, parser()->app()->SubType());
403 EXPECT_EQ(kName, parser()->app()->Name());
404 EXPECT_EQ(0, parser()->app_item()->num_packets());
405 }
406
392 TEST_F(RtcpSenderTest, SetInvalidApplicationSpecificData) { 407 TEST_F(RtcpSenderTest, SetInvalidApplicationSpecificData) {
393 const uint8_t kData[] = {'t', 'e', 's', 't', 'd', 'a', 't'}; 408 const uint8_t kData[] = {'t', 'e', 's', 't', 'd', 'a', 't'};
394 const uint16_t kInvalidDataLength = sizeof(kData) / sizeof(kData[0]); 409 const uint16_t kInvalidDataLength = sizeof(kData) / sizeof(kData[0]);
395 EXPECT_EQ(-1, rtcp_sender_->SetApplicationSpecificData( 410 EXPECT_EQ(-1, rtcp_sender_->SetApplicationSpecificData(
396 0, 0, kData, kInvalidDataLength)); // Should by multiple of 4. 411 0, 0, kData, kInvalidDataLength)); // Should by multiple of 4.
397 } 412 }
398 413
399 TEST_F(RtcpSenderTest, SendFirNonRepeat) { 414 TEST_F(RtcpSenderTest, SendFirNonRepeat) {
400 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound); 415 rtcp_sender_->SetRTCPStatus(kRtcpNonCompound);
401 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpFir)); 416 EXPECT_EQ(0, rtcp_sender_->SendRTCP(feedback_state(), kRtcpFir));
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 rtcp_sender_->SetREMBData(kBitrate, ssrcs); 756 rtcp_sender_->SetREMBData(kBitrate, ssrcs);
742 std::set<RTCPPacketType> packet_types; 757 std::set<RTCPPacketType> packet_types;
743 packet_types.insert(kRtcpRemb); 758 packet_types.insert(kRtcpRemb);
744 packet_types.insert(kRtcpPli); 759 packet_types.insert(kRtcpPli);
745 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types)); 760 EXPECT_EQ(0, rtcp_sender_->SendCompoundRTCP(feedback_state(), packet_types));
746 EXPECT_EQ(1, parser()->remb_item()->num_packets()); 761 EXPECT_EQ(1, parser()->remb_item()->num_packets());
747 EXPECT_EQ(1, parser()->pli()->num_packets()); 762 EXPECT_EQ(1, parser()->pli()->num_packets());
748 } 763 }
749 764
750 } // namespace webrtc 765 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtcp_sender.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698