OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2008 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 constexpr int kRtpHistoryMs = 5000; | 53 constexpr int kRtpHistoryMs = 5000; |
54 | 54 |
55 class FakeVoEWrapper : public cricket::VoEWrapper { | 55 class FakeVoEWrapper : public cricket::VoEWrapper { |
56 public: | 56 public: |
57 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) | 57 explicit FakeVoEWrapper(cricket::FakeWebRtcVoiceEngine* engine) |
58 : cricket::VoEWrapper(engine, // processing | 58 : cricket::VoEWrapper(engine, // processing |
59 engine, // base | 59 engine, // base |
60 engine, // codec | 60 engine, // codec |
61 engine, // hw | 61 engine, // hw |
62 engine, // rtp | |
63 engine) { // volume | 62 engine) { // volume |
64 } | 63 } |
65 }; | 64 }; |
66 } // namespace | 65 } // namespace |
67 | 66 |
68 // Tests that our stub library "works". | 67 // Tests that our stub library "works". |
69 TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { | 68 TEST(WebRtcVoiceEngineTestStubLibrary, StartupShutdown) { |
70 StrictMock<webrtc::test::MockAudioDeviceModule> adm; | 69 StrictMock<webrtc::test::MockAudioDeviceModule> adm; |
71 EXPECT_CALL(adm, AddRef()).WillOnce(Return(0)); | 70 EXPECT_CALL(adm, AddRef()).WillOnce(Return(0)); |
72 EXPECT_CALL(adm, Release()).WillOnce(Return(0)); | 71 EXPECT_CALL(adm, Release()).WillOnce(Return(0)); |
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2501 EXPECT_TRUE(SetupSendStream()); | 2500 EXPECT_TRUE(SetupSendStream()); |
2502 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); | 2501 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); |
2503 EXPECT_TRUE(AddRecvStream(kSsrc2)); | 2502 EXPECT_TRUE(AddRecvStream(kSsrc2)); |
2504 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc); | 2503 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc); |
2505 } | 2504 } |
2506 | 2505 |
2507 // Test that the local SSRC is the same on sending and receiving channels if the | 2506 // Test that the local SSRC is the same on sending and receiving channels if the |
2508 // receive channel is created before the send channel. | 2507 // receive channel is created before the send channel. |
2509 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { | 2508 TEST_F(WebRtcVoiceEngineTestFake, SetSendSsrcAfterCreatingReceiveChannel) { |
2510 EXPECT_TRUE(SetupChannel()); | 2509 EXPECT_TRUE(SetupChannel()); |
2511 EXPECT_TRUE(AddRecvStream(1)); | 2510 EXPECT_TRUE(AddRecvStream(kSsrc2)); |
2512 int receive_channel_num = voe_.GetLastChannel(); | |
2513 EXPECT_TRUE(channel_->AddSendStream( | 2511 EXPECT_TRUE(channel_->AddSendStream( |
2514 cricket::StreamParams::CreateLegacy(1234))); | 2512 cricket::StreamParams::CreateLegacy(kSsrc1))); |
2515 | 2513 EXPECT_TRUE(call_.GetAudioSendStream(kSsrc1)); |
2516 EXPECT_TRUE(call_.GetAudioSendStream(1234)); | 2514 EXPECT_EQ(kSsrc1, GetRecvStreamConfig(kSsrc2).rtp.local_ssrc); |
2517 EXPECT_EQ(1234U, voe_.GetLocalSSRC(receive_channel_num)); | |
2518 } | 2515 } |
2519 | 2516 |
2520 // Test that we can properly receive packets. | 2517 // Test that we can properly receive packets. |
2521 TEST_F(WebRtcVoiceEngineTestFake, Recv) { | 2518 TEST_F(WebRtcVoiceEngineTestFake, Recv) { |
2522 EXPECT_TRUE(SetupChannel()); | 2519 EXPECT_TRUE(SetupChannel()); |
2523 EXPECT_TRUE(AddRecvStream(1)); | 2520 EXPECT_TRUE(AddRecvStream(1)); |
2524 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); | 2521 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
2525 | 2522 |
2526 EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame, | 2523 EXPECT_TRUE(GetRecvStream(1).VerifyLastPacket(kPcmuFrame, |
2527 sizeof(kPcmuFrame))); | 2524 sizeof(kPcmuFrame))); |
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3526 cricket::WebRtcVoiceEngine engine( | 3523 cricket::WebRtcVoiceEngine engine( |
3527 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); | 3524 nullptr, webrtc::CreateBuiltinAudioDecoderFactory()); |
3528 std::unique_ptr<webrtc::Call> call( | 3525 std::unique_ptr<webrtc::Call> call( |
3529 webrtc::Call::Create(webrtc::Call::Config())); | 3526 webrtc::Call::Create(webrtc::Call::Config())); |
3530 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3527 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3531 cricket::AudioOptions(), call.get()); | 3528 cricket::AudioOptions(), call.get()); |
3532 cricket::AudioRecvParameters parameters; | 3529 cricket::AudioRecvParameters parameters; |
3533 parameters.codecs = engine.recv_codecs(); | 3530 parameters.codecs = engine.recv_codecs(); |
3534 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3531 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3535 } | 3532 } |
OLD | NEW |