OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 class PacketRouterTest : public ::testing::Test { | 31 class PacketRouterTest : public ::testing::Test { |
32 public: | 32 public: |
33 PacketRouterTest() : packet_router_(new PacketRouter()) {} | 33 PacketRouterTest() : packet_router_(new PacketRouter()) {} |
34 protected: | 34 protected: |
35 static const int kProbeMinProbes = 5; | 35 static const int kProbeMinProbes = 5; |
36 static const int kProbeMinBytes = 1000; | 36 static const int kProbeMinBytes = 1000; |
37 const std::unique_ptr<PacketRouter> packet_router_; | 37 const std::unique_ptr<PacketRouter> packet_router_; |
38 }; | 38 }; |
39 | 39 |
40 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_TimeToSendPacket) { | |
41 PacketRouter packet_router; | |
42 | |
43 constexpr uint16_t ssrc = 1234; | |
44 constexpr uint16_t sequence_number = 17; | |
45 constexpr uint64_t timestamp = 7890; | |
46 constexpr bool retransmission = false; | |
47 const PacedPacketInfo paced_info(1, kProbeMinProbes, kProbeMinBytes); | |
48 | |
49 // TODO(eladalon): TimeToSendPacket() returning true when nothing was | |
danilchap
2017/07/31 08:49:46
either phrase TODO in a from of what and when shou
eladalon
2017/07/31 08:59:10
What - still under discussion.
When - next CL (men
danilchap
2017/07/31 12:27:34
Acknowledged.
| |
50 // sent, because no modules were registered, is sub-optimal. | |
51 // This will be fixed in an upcoming CL. | |
danilchap
2017/07/31 08:49:46
this line of comment doesn't describe code, so pro
eladalon
2017/07/31 08:59:10
This is still part of the TODO.
| |
52 EXPECT_TRUE(packet_router.TimeToSendPacket(ssrc, sequence_number, timestamp, | |
53 retransmission, paced_info)); | |
54 } | |
55 | |
56 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_TimeToSendPadding) { | |
57 PacketRouter packet_router; | |
58 | |
59 constexpr size_t bytes = 300; | |
60 const PacedPacketInfo paced_info(1, kProbeMinProbes, kProbeMinBytes); | |
61 | |
62 EXPECT_EQ(packet_router.TimeToSendPadding(bytes, paced_info), 0u); | |
63 } | |
64 | |
65 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_OnReceiveBitrateChanged) { | |
66 PacketRouter packet_router; | |
67 | |
68 const std::vector<uint32_t> ssrcs = {1, 2, 3}; | |
69 constexpr uint32_t bitrate_bps = 10000; | |
70 | |
71 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_bps); | |
72 } | |
73 | |
74 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_SendRemb) { | |
75 PacketRouter packet_router; | |
76 | |
77 const std::vector<uint32_t> ssrcs = {1, 2, 3}; | |
78 constexpr uint32_t bitrate_bps = 10000; | |
79 | |
80 EXPECT_FALSE(packet_router.SendRemb(bitrate_bps, ssrcs)); | |
81 } | |
82 | |
83 TEST_F(PacketRouterTest, Sanity_NoModuleRegistered_SendTransportFeedback) { | |
84 PacketRouter packet_router; | |
85 | |
86 rtcp::TransportFeedback feedback; | |
87 | |
88 EXPECT_FALSE(packet_router_->SendTransportFeedback(&feedback)); | |
danilchap
2017/07/31 08:49:46
may be packet_router instead of packet_router_
(i.
eladalon
2017/07/31 08:59:10
Actually, let me use the one from the fixture. We
| |
89 } | |
90 | |
40 TEST_F(PacketRouterTest, TimeToSendPacket) { | 91 TEST_F(PacketRouterTest, TimeToSendPacket) { |
41 NiceMock<MockRtpRtcp> rtp_1; | 92 NiceMock<MockRtpRtcp> rtp_1; |
42 NiceMock<MockRtpRtcp> rtp_2; | 93 NiceMock<MockRtpRtcp> rtp_2; |
43 packet_router_->AddSendRtpModule(&rtp_1); | 94 packet_router_->AddSendRtpModule(&rtp_1); |
44 packet_router_->AddSendRtpModule(&rtp_2); | 95 packet_router_->AddSendRtpModule(&rtp_2); |
45 | 96 |
46 const uint16_t kSsrc1 = 1234; | 97 const uint16_t kSsrc1 = 1234; |
47 uint16_t sequence_number = 17; | 98 uint16_t sequence_number = 17; |
48 uint64_t timestamp = 7890; | 99 uint64_t timestamp = 7890; |
49 bool retransmission = false; | 100 bool retransmission = false; |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 | 521 |
471 // Lower the estimate to trigger a new packet REMB packet. | 522 // Lower the estimate to trigger a new packet REMB packet. |
472 EXPECT_CALL(rtp, SetREMBData(bitrate_estimate - 100, ssrcs)).Times(1); | 523 EXPECT_CALL(rtp, SetREMBData(bitrate_estimate - 100, ssrcs)).Times(1); |
473 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate - 100); | 524 packet_router.OnReceiveBitrateChanged(ssrcs, bitrate_estimate - 100); |
474 | 525 |
475 EXPECT_CALL(rtp, SetREMBStatus(false)).Times(1); | 526 EXPECT_CALL(rtp, SetREMBStatus(false)).Times(1); |
476 packet_router.RemoveReceiveRtpModule(&rtp); | 527 packet_router.RemoveReceiveRtpModule(&rtp); |
477 } | 528 } |
478 | 529 |
479 } // namespace webrtc | 530 } // namespace webrtc |
OLD | NEW |