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

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

Issue 2206743002: Revert of 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_FALSE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1, 174 EXPECT_EQ(-1, module1->SendOutgoingData(webrtc::kAudioFrameSpeech,
175 nullptr, 0, nullptr, nullptr, 175 96, 0, -1, NULL, 0));
176 nullptr));
177 176
178 CodecInst voice_codec; 177 CodecInst voice_codec;
179 memset(&voice_codec, 0, sizeof(voice_codec)); 178 memset(&voice_codec, 0, sizeof(voice_codec));
180 voice_codec.pltype = 96; 179 voice_codec.pltype = 96;
181 voice_codec.plfreq = 8000; 180 voice_codec.plfreq = 8000;
182 memcpy(voice_codec.plname, "PCMU", 5); 181 memcpy(voice_codec.plname, "PCMU", 5);
183 182
184 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec)); 183 EXPECT_EQ(0, module1->RegisterSendPayload(voice_codec));
185 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload( 184 EXPECT_EQ(0, rtp_receiver1_->RegisterReceivePayload(
186 voice_codec.plname, 185 voice_codec.plname,
187 voice_codec.pltype, 186 voice_codec.pltype,
188 voice_codec.plfreq, 187 voice_codec.plfreq,
189 voice_codec.channels, 188 voice_codec.channels,
190 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); 189 (voice_codec.rate < 0) ? 0 : voice_codec.rate));
191 EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec)); 190 EXPECT_EQ(0, module2->RegisterSendPayload(voice_codec));
192 voice_codec.rate = test_rate; 191 voice_codec.rate = test_rate;
193 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload( 192 EXPECT_EQ(0, rtp_receiver2_->RegisterReceivePayload(
194 voice_codec.plname, 193 voice_codec.plname,
195 voice_codec.pltype, 194 voice_codec.pltype,
196 voice_codec.plfreq, 195 voice_codec.plfreq,
197 voice_codec.channels, 196 voice_codec.channels,
198 (voice_codec.rate < 0) ? 0 : voice_codec.rate)); 197 (voice_codec.rate < 0) ? 0 : voice_codec.rate));
199 198
200 const uint8_t test[5] = "test"; 199 const uint8_t test[5] = "test";
201 EXPECT_EQ(true, 200 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
202 module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 0, -1, 201 0, -1, test, 4));
203 test, 4, nullptr, nullptr, nullptr));
204 202
205 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC()); 203 EXPECT_EQ(test_ssrc, rtp_receiver2_->SSRC());
206 uint32_t timestamp; 204 uint32_t timestamp;
207 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp)); 205 EXPECT_TRUE(rtp_receiver2_->Timestamp(&timestamp));
208 EXPECT_EQ(test_timestamp, timestamp); 206 EXPECT_EQ(test_timestamp, timestamp);
209 } 207 }
210 208
211 TEST_F(RtpRtcpAudioTest, RED) { 209 TEST_F(RtpRtcpAudioTest, RED) {
212 CodecInst voice_codec; 210 CodecInst voice_codec;
213 memset(&voice_codec, 0, sizeof(voice_codec)); 211 memset(&voice_codec, 0, sizeof(voice_codec));
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 fragmentation.fragmentationOffset[1] = 4; 264 fragmentation.fragmentationOffset[1] = 4;
267 fragmentation.fragmentationTimeDiff = new uint16_t[2]; 265 fragmentation.fragmentationTimeDiff = new uint16_t[2];
268 fragmentation.fragmentationTimeDiff[0] = 0; 266 fragmentation.fragmentationTimeDiff[0] = 0;
269 fragmentation.fragmentationTimeDiff[1] = 0; 267 fragmentation.fragmentationTimeDiff[1] = 0;
270 fragmentation.fragmentationPlType = new uint8_t[2]; 268 fragmentation.fragmentationPlType = new uint8_t[2];
271 fragmentation.fragmentationPlType[0] = 96; 269 fragmentation.fragmentationPlType[0] = 96;
272 fragmentation.fragmentationPlType[1] = 96; 270 fragmentation.fragmentationPlType[1] = 96;
273 271
274 const uint8_t test[5] = "test"; 272 const uint8_t test[5] = "test";
275 // Send a RTP packet. 273 // Send a RTP packet.
276 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 160, -1, 274 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech,
277 test, 4, &fragmentation, nullptr, 275 96, 160, -1, test, 4,
278 nullptr)); 276 &fragmentation));
279 277
280 EXPECT_EQ(0, module1->SetSendREDPayloadType(-1)); 278 EXPECT_EQ(0, module1->SetSendREDPayloadType(-1));
281 EXPECT_EQ(-1, module1->SendREDPayloadType(&red)); 279 EXPECT_EQ(-1, module1->SendREDPayloadType(&red));
282 } 280 }
283 281
284 TEST_F(RtpRtcpAudioTest, DTMF) { 282 TEST_F(RtpRtcpAudioTest, DTMF) {
285 CodecInst voice_codec; 283 CodecInst voice_codec;
286 memset(&voice_codec, 0, sizeof(voice_codec)); 284 memset(&voice_codec, 0, sizeof(voice_codec));
287 voice_codec.pltype = 96; 285 voice_codec.pltype = 96;
288 voice_codec.plfreq = 8000; 286 voice_codec.plfreq = 8000;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 for (int i = 0; i < 16; i++) { 326 for (int i = 0; i < 16; i++) {
329 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10)); 327 EXPECT_EQ(0, module1->SendTelephoneEventOutband(i, timeStamp, 10));
330 } 328 }
331 timeStamp += 160; // Prepare for next packet. 329 timeStamp += 160; // Prepare for next packet.
332 330
333 const uint8_t test[9] = "test"; 331 const uint8_t test[9] = "test";
334 332
335 // Send RTP packets for 16 tones a 160 ms 100ms 333 // Send RTP packets for 16 tones a 160 ms 100ms
336 // pause between = 2560ms + 1600ms = 4160ms 334 // pause between = 2560ms + 1600ms = 4160ms
337 for (; timeStamp <= 250 * 160; timeStamp += 160) { 335 for (; timeStamp <= 250 * 160; timeStamp += 160) {
338 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 336 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
339 timeStamp, -1, test, 4, nullptr, 337 timeStamp, -1, test, 4));
340 nullptr, nullptr));
341 fake_clock.AdvanceTimeMilliseconds(20); 338 fake_clock.AdvanceTimeMilliseconds(20);
342 module1->Process(); 339 module1->Process();
343 } 340 }
344 EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10)); 341 EXPECT_EQ(0, module1->SendTelephoneEventOutband(32, 9000, 10));
345 342
346 for (; timeStamp <= 740 * 160; timeStamp += 160) { 343 for (; timeStamp <= 740 * 160; timeStamp += 160) {
347 EXPECT_TRUE(module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96, 344 EXPECT_EQ(0, module1->SendOutgoingData(webrtc::kAudioFrameSpeech, 96,
348 timeStamp, -1, test, 4, nullptr, 345 timeStamp, -1, test, 4));
349 nullptr, nullptr));
350 fake_clock.AdvanceTimeMilliseconds(20); 346 fake_clock.AdvanceTimeMilliseconds(20);
351 module1->Process(); 347 module1->Process();
352 } 348 }
353 } 349 }
354 350
355 } // namespace 351 } // namespace
356 } // namespace webrtc 352 } // 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