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 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 test_ssrc_ = 3456; | 83 test_ssrc_ = 3456; |
84 test_timestamp_ = 4567; | 84 test_timestamp_ = 4567; |
85 test_sequence_number_ = 2345; | 85 test_sequence_number_ = 2345; |
86 } | 86 } |
87 ~RtpRtcpAPITest() {} | 87 ~RtpRtcpAPITest() {} |
88 | 88 |
89 void SetUp() override { | 89 void SetUp() override { |
90 RtpRtcp::Configuration configuration; | 90 RtpRtcp::Configuration configuration; |
91 configuration.audio = true; | 91 configuration.audio = true; |
92 configuration.clock = &fake_clock_; | 92 configuration.clock = &fake_clock_; |
| 93 configuration.outgoing_transport = &null_transport_; |
93 module_.reset(RtpRtcp::CreateRtpRtcp(configuration)); | 94 module_.reset(RtpRtcp::CreateRtpRtcp(configuration)); |
94 rtp_payload_registry_.reset(new RTPPayloadRegistry( | 95 rtp_payload_registry_.reset(new RTPPayloadRegistry( |
95 RTPPayloadStrategy::CreateStrategy(true))); | 96 RTPPayloadStrategy::CreateStrategy(true))); |
96 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver( | 97 rtp_receiver_.reset(RtpReceiver::CreateAudioReceiver( |
97 &fake_clock_, NULL, NULL, NULL, rtp_payload_registry_.get())); | 98 &fake_clock_, NULL, NULL, NULL, rtp_payload_registry_.get())); |
98 } | 99 } |
99 | 100 |
100 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; | 101 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry_; |
101 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; | 102 rtc::scoped_ptr<RtpReceiver> rtp_receiver_; |
102 rtc::scoped_ptr<RtpRtcp> module_; | 103 rtc::scoped_ptr<RtpRtcp> module_; |
103 uint32_t test_ssrc_; | 104 uint32_t test_ssrc_; |
104 uint32_t test_timestamp_; | 105 uint32_t test_timestamp_; |
105 uint16_t test_sequence_number_; | 106 uint16_t test_sequence_number_; |
106 std::vector<uint32_t> test_csrcs_; | 107 std::vector<uint32_t> test_csrcs_; |
107 SimulatedClock fake_clock_; | 108 SimulatedClock fake_clock_; |
| 109 class NullTransport : public Transport { |
| 110 public: |
| 111 NullTransport() {} |
| 112 virtual ~NullTransport() {} |
| 113 |
| 114 int SendPacket(const void* data, size_t len) override { return 0; } |
| 115 int SendRTCPPacket(const void* data, size_t len) override { return 0; } |
| 116 } null_transport_; |
108 }; | 117 }; |
109 | 118 |
110 TEST_F(RtpRtcpAPITest, Basic) { | 119 TEST_F(RtpRtcpAPITest, Basic) { |
111 module_->SetSequenceNumber(test_sequence_number_); | 120 module_->SetSequenceNumber(test_sequence_number_); |
112 EXPECT_EQ(test_sequence_number_, module_->SequenceNumber()); | 121 EXPECT_EQ(test_sequence_number_, module_->SequenceNumber()); |
113 | 122 |
114 module_->SetStartTimestamp(test_timestamp_); | 123 module_->SetStartTimestamp(test_timestamp_); |
115 EXPECT_EQ(test_timestamp_, module_->StartTimestamp()); | 124 EXPECT_EQ(test_timestamp_, module_->StartTimestamp()); |
116 | 125 |
117 EXPECT_FALSE(module_->Sending()); | 126 EXPECT_FALSE(module_->Sending()); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 RTPHeader rtx_header; | 184 RTPHeader rtx_header; |
176 rtx_header.ssrc = kRtxSsrc; | 185 rtx_header.ssrc = kRtxSsrc; |
177 rtx_header.payloadType = kRtxPayloadType; | 186 rtx_header.payloadType = kRtxPayloadType; |
178 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 187 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
179 rtx_header.ssrc = 0; | 188 rtx_header.ssrc = 0; |
180 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); | 189 EXPECT_FALSE(rtp_payload_registry_->IsRtx(rtx_header)); |
181 rtx_header.ssrc = kRtxSsrc; | 190 rtx_header.ssrc = kRtxSsrc; |
182 rtx_header.payloadType = 0; | 191 rtx_header.payloadType = 0; |
183 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); | 192 EXPECT_TRUE(rtp_payload_registry_->IsRtx(rtx_header)); |
184 } | 193 } |
OLD | NEW |