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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 EXPECT_CALL(*mock_delay_manager_, | 344 EXPECT_CALL(*mock_delay_manager_, |
345 LastDecoderType(NetEqDecoder::kDecoderPCMu)) | 345 LastDecoderType(NetEqDecoder::kDecoderPCMu)) |
346 .Times(1); | 346 .Times(1); |
347 EXPECT_CALL(*mock_delay_manager_, last_pack_cng_or_dtmf()) | 347 EXPECT_CALL(*mock_delay_manager_, last_pack_cng_or_dtmf()) |
348 .WillOnce(Return(0)); | 348 .WillOnce(Return(0)); |
349 EXPECT_CALL(*mock_delay_manager_, SetPacketAudioLength(30)) | 349 EXPECT_CALL(*mock_delay_manager_, SetPacketAudioLength(30)) |
350 .WillOnce(Return(0)); | 350 .WillOnce(Return(0)); |
351 } | 351 } |
352 | 352 |
353 // Expectations for payload splitter. | 353 // Expectations for payload splitter. |
| 354 EXPECT_CALL(*mock_payload_splitter_, SplitFec(_, _)) |
| 355 .Times(2) |
| 356 .WillRepeatedly(Return(PayloadSplitter::kOK)); |
354 EXPECT_CALL(*mock_payload_splitter_, SplitAudio(_, _)) | 357 EXPECT_CALL(*mock_payload_splitter_, SplitAudio(_, _)) |
355 .Times(2) | 358 .Times(2) |
356 .WillRepeatedly(Return(PayloadSplitter::kOK)); | 359 .WillRepeatedly(Return(PayloadSplitter::kOK)); |
357 | 360 |
358 // Insert first packet. | 361 // Insert first packet. |
359 neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime); | 362 neteq_->InsertPacket(rtp_header, payload, kFirstReceiveTime); |
360 | 363 |
361 // Insert second packet. | 364 // Insert second packet. |
362 rtp_header.header.timestamp += 160; | 365 rtp_header.header.timestamp += 160; |
363 rtp_header.header.sequenceNumber += 1; | 366 rtp_header.header.sequenceNumber += 1; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 rtp_header.header.sequenceNumber = 0x1234; | 512 rtp_header.header.sequenceNumber = 0x1234; |
510 rtp_header.header.timestamp = 0x12345678; | 513 rtp_header.header.timestamp = 0x12345678; |
511 rtp_header.header.ssrc = 0x87654321; | 514 rtp_header.header.ssrc = 0x87654321; |
512 | 515 |
513 // Create a mock decoder object. | 516 // Create a mock decoder object. |
514 MockAudioDecoder mock_decoder; | 517 MockAudioDecoder mock_decoder; |
515 EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return()); | 518 EXPECT_CALL(mock_decoder, Reset()).WillRepeatedly(Return()); |
516 EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1)); | 519 EXPECT_CALL(mock_decoder, Channels()).WillRepeatedly(Return(1)); |
517 EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _)) | 520 EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _)) |
518 .WillRepeatedly(Return(0)); | 521 .WillRepeatedly(Return(0)); |
| 522 EXPECT_CALL(mock_decoder, PacketDuration(_, kPayloadLengthBytes)) |
| 523 .WillRepeatedly(Return(kPayloadLengthSamples)); |
519 int16_t dummy_output[kPayloadLengthSamples] = {0}; | 524 int16_t dummy_output[kPayloadLengthSamples] = {0}; |
520 // The below expectation will make the mock decoder write | 525 // The below expectation will make the mock decoder write |
521 // |kPayloadLengthSamples| zeros to the output array, and mark it as speech. | 526 // |kPayloadLengthSamples| zeros to the output array, and mark it as speech. |
522 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(0), kPayloadLengthBytes, | 527 EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(0), kPayloadLengthBytes, |
523 kSampleRateHz, _, _)) | 528 kSampleRateHz, _, _)) |
524 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, | 529 .WillOnce(DoAll(SetArrayArgument<3>(dummy_output, |
525 dummy_output + kPayloadLengthSamples), | 530 dummy_output + kPayloadLengthSamples), |
526 SetArgPointee<4>(AudioDecoder::kSpeech), | 531 SetArgPointee<4>(AudioDecoder::kSpeech), |
527 Return(kPayloadLengthSamples))); | 532 Return(kPayloadLengthSamples))); |
528 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( | 533 EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder( |
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1197 UseNoMocks(); | 1202 UseNoMocks(); |
1198 CreateInstance(); | 1203 CreateInstance(); |
1199 ASSERT_TRUE(tick_timer_); | 1204 ASSERT_TRUE(tick_timer_); |
1200 EXPECT_EQ(0u, tick_timer_->ticks()); | 1205 EXPECT_EQ(0u, tick_timer_->ticks()); |
1201 AudioFrame output; | 1206 AudioFrame output; |
1202 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output)); | 1207 EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output)); |
1203 EXPECT_EQ(1u, tick_timer_->ticks()); | 1208 EXPECT_EQ(1u, tick_timer_->ticks()); |
1204 } | 1209 } |
1205 | 1210 |
1206 }// namespace webrtc | 1211 }// namespace webrtc |
OLD | NEW |