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

Side by Side Diff: webrtc/modules/rtp_rtcp/test/testAPI/test_api_audio.cc

Issue 2523843002: Send audio and video codecs to RTPPayloadRegistry (Closed)
Patch Set: Change strcpy to strncpy Created 4 years 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
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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 rtp_payload_registry2_.get())); 127 rtp_payload_registry2_.get()));
128 128
129 transport1.SetSendModule(module2.get(), rtp_payload_registry2_.get(), 129 transport1.SetSendModule(module2.get(), rtp_payload_registry2_.get(),
130 rtp_receiver2_.get(), receive_statistics2_.get()); 130 rtp_receiver2_.get(), receive_statistics2_.get());
131 transport2.SetSendModule(module1.get(), rtp_payload_registry1_.get(), 131 transport2.SetSendModule(module1.get(), rtp_payload_registry1_.get(),
132 rtp_receiver1_.get(), receive_statistics1_.get()); 132 rtp_receiver1_.get(), receive_statistics1_.get());
133 } 133 }
134 134
135 void RegisterPayload(const CodecInst& codec) { 135 void RegisterPayload(const CodecInst& codec) {
136 EXPECT_EQ(0, module1->RegisterSendPayload(codec)); 136 EXPECT_EQ(0, module1->RegisterSendPayload(codec));
137 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( 137 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(codec));
138 codec.plname,
139 codec.pltype,
140 codec.plfreq,
141 codec.channels,
142 codec.rate));
143 EXPECT_EQ(0, module2->RegisterSendPayload(codec)); 138 EXPECT_EQ(0, module2->RegisterSendPayload(codec));
144 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( 139 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(codec));
145 codec.plname,
146 codec.pltype,
147 codec.plfreq,
148 codec.channels,
149 codec.rate));
150 } 140 }
151 141
152 VerifyingAudioReceiver data_receiver1; 142 VerifyingAudioReceiver data_receiver1;
153 VerifyingAudioReceiver data_receiver2; 143 VerifyingAudioReceiver data_receiver2;
154 RTPCallback rtp_callback; 144 RTPCallback rtp_callback;
155 std::unique_ptr<ReceiveStatistics> receive_statistics1_; 145 std::unique_ptr<ReceiveStatistics> receive_statistics1_;
156 std::unique_ptr<ReceiveStatistics> receive_statistics2_; 146 std::unique_ptr<ReceiveStatistics> receive_statistics2_;
157 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry1_; 147 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry1_;
158 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry2_; 148 std::unique_ptr<RTPPayloadRegistry> rtp_payload_registry2_;
159 std::unique_ptr<RtpReceiver> rtp_receiver1_; 149 std::unique_ptr<RtpReceiver> rtp_receiver1_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 module1->SetSSRC(test_ssrc); 205 module1->SetSSRC(test_ssrc);
216 module1->SetStartTimestamp(test_timestamp); 206 module1->SetStartTimestamp(test_timestamp);
217 EXPECT_EQ(0, module1->SetSendingStatus(true)); 207 EXPECT_EQ(0, module1->SetSendingStatus(true));
218 208
219 // Prepare for DTMF. 209 // Prepare for DTMF.
220 voice_codec.pltype = kDtmfPayloadType; 210 voice_codec.pltype = kDtmfPayloadType;
221 voice_codec.plfreq = 8000; 211 voice_codec.plfreq = 8000;
222 memcpy(voice_codec.plname, "telephone-event", 16); 212 memcpy(voice_codec.plname, "telephone-event", 16);
223 213
224 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); 214 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
225 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( 215 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(voice_codec));
226 voice_codec.plname,
227 voice_codec.pltype,
228 voice_codec.plfreq,
229 voice_codec.channels,
230 voice_codec.rate));
231 216
232 // Start DTMF test. 217 // Start DTMF test.
233 int timeStamp = 160; 218 int timeStamp = 160;
234 219
235 // Send a DTMF tone using RFC 2833 (4733). 220 // Send a DTMF tone using RFC 2833 (4733).
236 for (int i = 0; i < 16; i++) { 221 for (int i = 0; i < 16; i++) {
237 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10)); 222 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10));
238 } 223 }
239 timeStamp += 160; // Prepare for next packet. 224 timeStamp += 160; // Prepare for next packet.
240 225
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 nullptr, nullptr, nullptr)); 283 nullptr, nullptr, nullptr));
299 284
300 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC()); 285 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
301 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp)); 286 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp));
302 EXPECT_EQ(test_timestamp + in_timestamp, timestamp); 287 EXPECT_EQ(test_timestamp + in_timestamp, timestamp);
303 in_timestamp += 10; 288 in_timestamp += 10;
304 } 289 }
305 } 290 }
306 291
307 } // namespace webrtc 292 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_receiver_video.cc ('k') | webrtc/modules/rtp_rtcp/test/testAPI/test_api_rtcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698