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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 FakeAudioSource fake_source_; | 487 FakeAudioSource fake_source_; |
488 private: | 488 private: |
489 webrtc::test::ScopedFieldTrials override_field_trials_; | 489 webrtc::test::ScopedFieldTrials override_field_trials_; |
490 }; | 490 }; |
491 | 491 |
492 // Tests that we can create and destroy a channel. | 492 // Tests that we can create and destroy a channel. |
493 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { | 493 TEST_F(WebRtcVoiceEngineTestFake, CreateChannel) { |
494 EXPECT_TRUE(SetupChannel()); | 494 EXPECT_TRUE(SetupChannel()); |
495 } | 495 } |
496 | 496 |
| 497 // Test that we can add a send stream and that it has the correct defaults. |
| 498 TEST_F(WebRtcVoiceEngineTestFake, CreateSendStream) { |
| 499 EXPECT_TRUE(SetupChannel()); |
| 500 EXPECT_TRUE( |
| 501 channel_->AddSendStream(cricket::StreamParams::CreateLegacy(kSsrc1))); |
| 502 const webrtc::AudioSendStream::Config& config = GetSendStreamConfig(kSsrc1); |
| 503 EXPECT_EQ(kSsrc1, config.rtp.ssrc); |
| 504 EXPECT_EQ("", config.rtp.c_name); |
| 505 EXPECT_EQ(0u, config.rtp.extensions.size()); |
| 506 EXPECT_EQ(static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_), |
| 507 config.send_transport); |
| 508 } |
| 509 |
| 510 // Test that we can add a receive stream and that it has the correct defaults. |
| 511 TEST_F(WebRtcVoiceEngineTestFake, CreateRecvStream) { |
| 512 EXPECT_TRUE(SetupChannel()); |
| 513 EXPECT_TRUE( |
| 514 channel_->AddRecvStream(cricket::StreamParams::CreateLegacy(kSsrc1))); |
| 515 const webrtc::AudioReceiveStream::Config& config = |
| 516 GetRecvStreamConfig(kSsrc1); |
| 517 EXPECT_EQ(kSsrc1, config.rtp.remote_ssrc); |
| 518 EXPECT_EQ(0xFA17FA17, config.rtp.local_ssrc); |
| 519 EXPECT_FALSE(config.rtp.transport_cc); |
| 520 EXPECT_EQ(0u, config.rtp.extensions.size()); |
| 521 EXPECT_EQ(static_cast<cricket::WebRtcVoiceMediaChannel*>(channel_), |
| 522 config.rtcp_send_transport); |
| 523 EXPECT_EQ("", config.sync_group); |
| 524 } |
| 525 |
497 // Tests that the list of supported codecs is created properly and ordered | 526 // Tests that the list of supported codecs is created properly and ordered |
498 // correctly (such that opus appears first). | 527 // correctly (such that opus appears first). |
499 TEST_F(WebRtcVoiceEngineTestFake, CodecOrder) { | 528 TEST_F(WebRtcVoiceEngineTestFake, CodecOrder) { |
500 const std::vector<cricket::AudioCodec>& codecs = engine_->codecs(); | 529 const std::vector<cricket::AudioCodec>& codecs = engine_->codecs(); |
501 ASSERT_FALSE(codecs.empty()); | 530 ASSERT_FALSE(codecs.empty()); |
502 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str()); | 531 EXPECT_STRCASEEQ("opus", codecs[0].name.c_str()); |
503 EXPECT_EQ(48000, codecs[0].clockrate); | 532 EXPECT_EQ(48000, codecs[0].clockrate); |
504 EXPECT_EQ(2, codecs[0].channels); | 533 EXPECT_EQ(2, codecs[0].channels); |
505 EXPECT_EQ(64000, codecs[0].bitrate); | 534 EXPECT_EQ(64000, codecs[0].bitrate); |
506 } | 535 } |
(...skipping 3109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3616 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { | 3645 TEST(WebRtcVoiceEngineTest, SetRecvCodecs) { |
3617 cricket::WebRtcVoiceEngine engine(nullptr); | 3646 cricket::WebRtcVoiceEngine engine(nullptr); |
3618 std::unique_ptr<webrtc::Call> call( | 3647 std::unique_ptr<webrtc::Call> call( |
3619 webrtc::Call::Create(webrtc::Call::Config())); | 3648 webrtc::Call::Create(webrtc::Call::Config())); |
3620 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3649 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3621 cricket::AudioOptions(), call.get()); | 3650 cricket::AudioOptions(), call.get()); |
3622 cricket::AudioRecvParameters parameters; | 3651 cricket::AudioRecvParameters parameters; |
3623 parameters.codecs = engine.codecs(); | 3652 parameters.codecs = engine.codecs(); |
3624 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3653 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3625 } | 3654 } |
OLD | NEW |