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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 RtpRtcpAudioTest() : fake_clock(123456) { | 79 RtpRtcpAudioTest() : fake_clock(123456) { |
80 test_CSRC[0] = 1234; | 80 test_CSRC[0] = 1234; |
81 test_CSRC[2] = 2345; | 81 test_CSRC[2] = 2345; |
82 test_ssrc = 3456; | 82 test_ssrc = 3456; |
83 test_timestamp = 4567; | 83 test_timestamp = 4567; |
84 test_sequence_number = 2345; | 84 test_sequence_number = 2345; |
85 } | 85 } |
86 ~RtpRtcpAudioTest() {} | 86 ~RtpRtcpAudioTest() {} |
87 | 87 |
88 void SetUp() override { | 88 void SetUp() override { |
89 audioFeedback = new NullRtpAudioFeedback(); | |
90 data_receiver1 = new VerifyingAudioReceiver(); | 89 data_receiver1 = new VerifyingAudioReceiver(); |
91 data_receiver2 = new VerifyingAudioReceiver(); | 90 data_receiver2 = new VerifyingAudioReceiver(); |
92 rtp_callback = new RTPCallback(); | 91 rtp_callback = new RTPCallback(); |
93 transport1 = new LoopBackTransport(); | 92 transport1 = new LoopBackTransport(); |
94 transport2 = new LoopBackTransport(); | 93 transport2 = new LoopBackTransport(); |
95 | 94 |
96 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); | 95 receive_statistics1_.reset(ReceiveStatistics::Create(&fake_clock)); |
97 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); | 96 receive_statistics2_.reset(ReceiveStatistics::Create(&fake_clock)); |
98 | 97 |
99 rtp_payload_registry1_.reset(new RTPPayloadRegistry( | 98 rtp_payload_registry1_.reset(new RTPPayloadRegistry( |
100 RTPPayloadStrategy::CreateStrategy(true))); | 99 RTPPayloadStrategy::CreateStrategy(true))); |
101 rtp_payload_registry2_.reset(new RTPPayloadRegistry( | 100 rtp_payload_registry2_.reset(new RTPPayloadRegistry( |
102 RTPPayloadStrategy::CreateStrategy(true))); | 101 RTPPayloadStrategy::CreateStrategy(true))); |
103 | 102 |
104 RtpRtcp::Configuration configuration; | 103 RtpRtcp::Configuration configuration; |
105 configuration.audio = true; | 104 configuration.audio = true; |
106 configuration.clock = &fake_clock; | 105 configuration.clock = &fake_clock; |
107 configuration.receive_statistics = receive_statistics1_.get(); | 106 configuration.receive_statistics = receive_statistics1_.get(); |
108 configuration.outgoing_transport = transport1; | 107 configuration.outgoing_transport = transport1; |
109 | 108 |
110 module1 = RtpRtcp::CreateRtpRtcp(configuration); | 109 module1 = RtpRtcp::CreateRtpRtcp(configuration); |
111 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( | 110 rtp_receiver1_.reset(RtpReceiver::CreateAudioReceiver( |
112 &fake_clock, audioFeedback, data_receiver1, NULL, | 111 &fake_clock, data_receiver1, NULL, rtp_payload_registry1_.get())); |
113 rtp_payload_registry1_.get())); | |
114 | 112 |
115 configuration.receive_statistics = receive_statistics2_.get(); | 113 configuration.receive_statistics = receive_statistics2_.get(); |
116 configuration.outgoing_transport = transport2; | 114 configuration.outgoing_transport = transport2; |
117 | 115 |
118 module2 = RtpRtcp::CreateRtpRtcp(configuration); | 116 module2 = RtpRtcp::CreateRtpRtcp(configuration); |
119 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( | 117 rtp_receiver2_.reset(RtpReceiver::CreateAudioReceiver( |
120 &fake_clock, audioFeedback, data_receiver2, NULL, | 118 &fake_clock, data_receiver2, NULL, rtp_payload_registry2_.get())); |
121 rtp_payload_registry2_.get())); | |
122 | 119 |
123 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), | 120 transport1->SetSendModule(module2, rtp_payload_registry2_.get(), |
124 rtp_receiver2_.get(), receive_statistics2_.get()); | 121 rtp_receiver2_.get(), receive_statistics2_.get()); |
125 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), | 122 transport2->SetSendModule(module1, rtp_payload_registry1_.get(), |
126 rtp_receiver1_.get(), receive_statistics1_.get()); | 123 rtp_receiver1_.get(), receive_statistics1_.get()); |
127 } | 124 } |
128 | 125 |
129 void TearDown() override { | 126 void TearDown() override { |
130 delete module1; | 127 delete module1; |
131 delete module2; | 128 delete module2; |
132 delete transport1; | 129 delete transport1; |
133 delete transport2; | 130 delete transport2; |
134 delete audioFeedback; | |
135 delete data_receiver1; | 131 delete data_receiver1; |
136 delete data_receiver2; | 132 delete data_receiver2; |
137 delete rtp_callback; | 133 delete rtp_callback; |
138 } | 134 } |
139 | 135 |
140 RtpRtcp* module1; | 136 RtpRtcp* module1; |
141 RtpRtcp* module2; | 137 RtpRtcp* module2; |
142 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; | 138 rtc::scoped_ptr<ReceiveStatistics> receive_statistics1_; |
143 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; | 139 rtc::scoped_ptr<ReceiveStatistics> receive_statistics2_; |
144 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; | 140 rtc::scoped_ptr<RtpReceiver> rtp_receiver1_; |
145 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; | 141 rtc::scoped_ptr<RtpReceiver> rtp_receiver2_; |
146 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; | 142 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry1_; |
147 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; | 143 rtc::scoped_ptr<RTPPayloadRegistry> rtp_payload_registry2_; |
148 VerifyingAudioReceiver* data_receiver1; | 144 VerifyingAudioReceiver* data_receiver1; |
149 VerifyingAudioReceiver* data_receiver2; | 145 VerifyingAudioReceiver* data_receiver2; |
150 LoopBackTransport* transport1; | 146 LoopBackTransport* transport1; |
151 LoopBackTransport* transport2; | 147 LoopBackTransport* transport2; |
152 NullRtpAudioFeedback* audioFeedback; | |
153 RTPCallback* rtp_callback; | 148 RTPCallback* rtp_callback; |
154 uint32_t test_ssrc; | 149 uint32_t test_ssrc; |
155 uint32_t test_timestamp; | 150 uint32_t test_timestamp; |
156 uint16_t test_sequence_number; | 151 uint16_t test_sequence_number; |
157 uint32_t test_CSRC[webrtc::kRtpCsrcSize]; | 152 uint32_t test_CSRC[webrtc::kRtpCsrcSize]; |
158 SimulatedClock fake_clock; | 153 SimulatedClock fake_clock; |
159 }; | 154 }; |
160 | 155 |
161 TEST_F(RtpRtcpAudioTest, Basic) { | 156 TEST_F(RtpRtcpAudioTest, Basic) { |
162 module1->SetSSRC(test_ssrc); | 157 module1->SetSSRC(test_ssrc); |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 for (; timeStamp <= 740 * 160; timeStamp += 160) { | 338 for (; timeStamp <= 740 * 160; timeStamp += 160) { |
344 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, | 339 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, |
345 timeStamp, -1, test, 4)); | 340 timeStamp, -1, test, 4)); |
346 fake_clock.AdvanceTimeMilliseconds(20); | 341 fake_clock.AdvanceTimeMilliseconds(20); |
347 module1->Process(); | 342 module1->Process(); |
348 } | 343 } |
349 } | 344 } |
350 | 345 |
351 } // namespace | 346 } // namespace |
352 } // namespace webrtc | 347 } // namespace webrtc |
OLD | NEW |