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

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

Issue 2089773002: Add EncodedImageCallback::OnEncodedImage(). (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: . Created 4 years, 4 months 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 164
165 // Test detection at the end of a DTMF tone. 165 // Test detection at the end of a DTMF tone.
166 // EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true)); 166 // EXPECT_EQ(0, module2->SetTelephoneEventForwardToDecoder(true));
167 167
168 EXPECT_EQ(0, module1->SetSendingStatus(true)); 168 EXPECT_EQ(0, module1->SetSendingStatus(true));
169 169
170 // Start basic RTP test. 170 // Start basic RTP test.
171 171
172 // Send an empty RTP packet. 172 // Send an empty RTP packet.
173 // Should fail since we have not registered the payload type. 173 // Should fail since we have not registered the payload type.
174 EXPECT_EQ(-1, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 174 EXPECT_FALSE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1,
175 96, 0, -1, NULL, 0)); 175 nullptr, 0, nullptr, nullptr,
176 nullptr));
176 177
177 CodecInst voice_codec; 178 CodecInst voice_codec;
178 memset(&voice_codec, 0, sizeof(voice_codec)); 179 memset(&voice_codec, 0, sizeof(voice_codec));
179 voice_codec.pltype = 96; 180 voice_codec.pltype = 96;
180 voice_codec.plfreq = 8000; 181 voice_codec.plfreq = 8000;
181 memcpy(voice_codec.plname, "PCMU", 5); 182 memcpy(voice_codec.plname, "PCMU", 5);
182 183
183 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); 184 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
184 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( 185 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
185 voice_codec.plname, 186 voice_codec.plname,
186 voice_codec.pltype, 187 voice_codec.pltype,
187 voice_codec.plfreq, 188 voice_codec.plfreq,
188 voice_codec.channels, 189 voice_codec.channels,
189 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); 190 (voice_codec.rate < 0) ? 0 : voice_codec.rate));
190 EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec)); 191 EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec));
191 voice_codec.rate = test_rate; 192 voice_codec.rate = test_rate;
192 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( 193 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
193 voice_codec.plname, 194 voice_codec.plname,
194 voice_codec.pltype, 195 voice_codec.pltype,
195 voice_codec.plfreq, 196 voice_codec.plfreq,
196 voice_codec.channels, 197 voice_codec.channels,
197 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); 198 (voice_codec.rate < 0) ? 0 : voice_codec.rate));
198 199
199 const uint8_t test[5] = "test"; 200 const uint8_t test[5] = "test";
200 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 201 EXPECT_EQ(true,
201 0, -1, test, 4)); 202 module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1,
203 test, 4, nullptr, nullptr, nullptr));
202 204
203 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC()); 205 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
204 uint32_t timestamp; 206 uint32_t timestamp;
205 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp)); 207 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp));
206 EXPECT_EQ(test_timestamp, timestamp); 208 EXPECT_EQ(test_timestamp, timestamp);
207 } 209 }
208 210
209 TEST_F(RtpRtcpAudioTest, RED) { 211 TEST_F(RtpRtcpAudioTest, RED) {
210 CodecInst voice_codec; 212 CodecInst voice_codec;
211 memset(&voice_codec, 0, sizeof(voice_codec)); 213 memset(&voice_codec, 0, sizeof(voice_codec));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 fragmentation.fragmentationOffset[1] = 4; 266 fragmentation.fragmentationOffset[1] = 4;
265 fragmentation.fragmentationTimeDiff = new uint16_t[2]; 267 fragmentation.fragmentationTimeDiff = new uint16_t[2];
266 fragmentation.fragmentationTimeDiff[0] = 0; 268 fragmentation.fragmentationTimeDiff[0] = 0;
267 fragmentation.fragmentationTimeDiff[1] = 0; 269 fragmentation.fragmentationTimeDiff[1] = 0;
268 fragmentation.fragmentationPlType = new uint8_t[2]; 270 fragmentation.fragmentationPlType = new uint8_t[2];
269 fragmentation.fragmentationPlType[0] = 96; 271 fragmentation.fragmentationPlType[0] = 96;
270 fragmentation.fragmentationPlType[1] = 96; 272 fragmentation.fragmentationPlType[1] = 96;
271 273
272 const uint8_t test[5] = "test"; 274 const uint8_t test[5] = "test";
273 // Send a RTP packet. 275 // Send a RTP packet.
274 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 276 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 160, -1,
275 96, 160, -1, test, 4, 277 test, 4, &fragmentation, nullptr,
276 &fragmentation)); 278 nullptr));
277 279
278 EXPECT_EQ(0, module1->SetSendREDPayloadType(-1)); 280 EXPECT_EQ(0, module1->SetSendREDPayloadType(-1));
279 EXPECT_EQ(-1, module1->SendREDPayloadType(&red)); 281 EXPECT_EQ(-1, module1->SendREDPayloadType(&red));
280 } 282 }
281 283
282 TEST_F(RtpRtcpAudioTest, DTMF) { 284 TEST_F(RtpRtcpAudioTest, DTMF) {
283 CodecInst voice_codec; 285 CodecInst voice_codec;
284 memset(&voice_codec, 0, sizeof(voice_codec)); 286 memset(&voice_codec, 0, sizeof(voice_codec));
285 voice_codec.pltype = 96; 287 voice_codec.pltype = 96;
286 voice_codec.plfreq = 8000; 288 voice_codec.plfreq = 8000;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 for (int i = 0; i < 16; i++) { 328 for (int i = 0; i < 16; i++) {
327 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10)); 329 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10));
328 } 330 }
329 timeStamp += 160; // Prepare for next packet. 331 timeStamp += 160; // Prepare for next packet.
330 332
331 const uint8_t test[9] = "test"; 333 const uint8_t test[9] = "test";
332 334
333 // Send RTP packets for 16 tones a 160 ms 100ms 335 // Send RTP packets for 16 tones a 160 ms 100ms
334 // pause between = 2560ms + 1600ms = 4160ms 336 // pause between = 2560ms + 1600ms = 4160ms
335 for (; timeStamp <= 250 * 160; timeStamp += 160) { 337 for (; timeStamp <= 250 * 160; timeStamp += 160) {
336 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 338 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
337 timeStamp, -1, test, 4)); 339 timeStamp, -1, test, 4, nullptr,
340 nullptr, nullptr));
338 fake_clock.AdvanceTimeMilliseconds(20); 341 fake_clock.AdvanceTimeMilliseconds(20);
339 module1->Process(); 342 module1->Process();
340 } 343 }
341 EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10)); 344 EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10));
342 345
343 for (; timeStamp <= 740 * 160; timeStamp += 160) { 346 for (; timeStamp <= 740 * 160; timeStamp += 160) {
344 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 347 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
345 timeStamp, -1, test, 4)); 348 timeStamp, -1, test, 4, nullptr,
349 nullptr, nullptr));
346 fake_clock.AdvanceTimeMilliseconds(20); 350 fake_clock.AdvanceTimeMilliseconds(20);
347 module1->Process(); 351 module1->Process();
348 } 352 }
349 } 353 }
350 354
351 } // namespace 355 } // namespace
352 } // namespace webrtc 356 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/rtp_rtcp/source/rtp_sender_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