OLD | NEW |
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 |
11 #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h" | 11 #include "webrtc/modules/rtp_rtcp/test/testAPI/test_api.h" |
| 12 #include "webrtc/test/null_transport.h" |
12 | 13 |
13 #include <algorithm> | 14 #include <algorithm> |
14 #include <vector> | 15 #include <vector> |
15 | 16 |
16 using namespace webrtc; | 17 using namespace webrtc; |
17 | 18 |
18 namespace webrtc { | 19 namespace webrtc { |
19 void LoopBackTransport::SetSendModule(RtpRtcp* rtp_rtcp_module, | 20 void LoopBackTransport::SetSendModule(RtpRtcp* rtp_rtcp_module, |
20 RTPPayloadRegistry* payload_registry, | 21 RTPPayloadRegistry* payload_registry, |
21 RtpReceiver* receiver, | 22 RtpReceiver* receiver, |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 test_ssrc_ = 3456; | 84 test_ssrc_ = 3456; |
84 test_timestamp_ = 4567; | 85 test_timestamp_ = 4567; |
85 test_sequence_number_ = 2345; | 86 test_sequence_number_ = 2345; |
86 } | 87 } |
87 ~RtpRtcpAPITest() {} | 88 ~RtpRtcpAPITest() {} |
88 | 89 |
89 void SetUp() override { | 90 void SetUp() override { |
90 RtpRtcp::Configuration configuration; | 91 RtpRtcp::Configuration configuration; |
91 configuration.audio = true; | 92 configuration.audio = true; |
92 configuration.clock = &fake_clock_; | 93 configuration.clock = &fake_clock_; |
| 94 configuration.outgoing_transport = &null_transport_; |
93 module_.reset(RtpRtcp::CreateRtpRtcp(configuration)); | 95 module_.reset(RtpRtcp::CreateRtpRtcp(configuration)); |
94 rtp_payload_registry_.reset(new RTPPayloadRegistry( | 96 rtp_payload_registry_.reset(new RTPPayloadRegistry( |
95 RTPPayloadStrategy::CreateStrategy(true))); | 97 RTPPayloadStrategy::CreateStrategy(true))); |
96 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver( | 98 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver( |
97 &fake_clock_, NULL, NULL, NULL, rtp_payload_registry_.get())); | 99 &fake_clock_, NULL, NULL, NULL, rtp_payload_registry_.get())); |
98 } | 100 } |
99 | 101 |
100 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; | 102 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; |
101 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; | 103 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; |
102 rtc::scoped_ptr<RtpRtcp> module_; | 104 rtc::scoped_ptr<RtpRtcp> module_; |
103 uint32_t test_ssrc_; | 105 uint32_t test_ssrc_; |
104 uint32_t test_timestamp_; | 106 uint32_t test_timestamp_; |
105 uint16_t test_sequence_number_; | 107 uint16_t test_sequence_number_; |
106 std::vector<uint32_t> test_csrcs_; | 108 std::vector<uint32_t> test_csrcs_; |
107 SimulatedClock fake_clock_; | 109 SimulatedClock fake_clock_; |
| 110 test::NullTransport null_transport_; |
108 }; | 111 }; |
109 | 112 |
110 TEST_F(RtpRtcpAPITest, Basic) { | 113 TEST_F(RtpRtcpAPITest, Basic) { |
111 module_->SetSequenceNumber(test_sequence_number_); | 114 module_->SetSequenceNumber(test_sequence_number_); |
112 EXPECT_EQ(test_sequence_number_, module_->SequenceNumber()); | 115 EXPECT_EQ(test_sequence_number_, module_->SequenceNumber()); |
113 | 116 |
114 module_->SetStartTimestamp(test_timestamp_); | 117 module_->SetStartTimestamp(test_timestamp_); |
115 EXPECT_EQ(test_timestamp_, module_->StartTimestamp()); | 118 EXPECT_EQ(test_timestamp_, module_->StartTimestamp()); |
116 | 119 |
117 EXPECT_FALSE(module_->Sending()); | 120 EXPECT_FALSE(module_->Sending()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 RTPHeader rtx_header; | 178 RTPHeader rtx_header; |
176 rtx_header.ssrc = kRtxSsrc; | 179 rtx_header.ssrc = kRtxSsrc; |
177 rtx_header.payloadType = kRtxPayloadType; | 180 rtx_header.payloadType = kRtxPayloadType; |
178 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 181 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
179 rtx_header.ssrc = 0; | 182 rtx_header.ssrc = 0; |
180 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); | 183 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); |
181 rtx_header.ssrc = kRtxSsrc; | 184 rtx_header.ssrc = kRtxSsrc; |
182 rtx_header.payloadType = 0; | 185 rtx_header.payloadType = 0; |
183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 186 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
184 } | 187 } |
OLD | NEW |