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 3141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3152 // Try setting the default sink while the default stream exists. | 3152 // Try setting the default sink while the default stream exists. |
3153 channel_->SetRawAudioSink(0, std::move(fake_sink_2)); | 3153 channel_->SetRawAudioSink(0, std::move(fake_sink_2)); |
3154 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); | 3154 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); |
3155 | 3155 |
3156 // If we remove and add a default stream, it should get the same sink. | 3156 // If we remove and add a default stream, it should get the same sink. |
3157 EXPECT_TRUE(channel_->RemoveRecvStream(0x01)); | 3157 EXPECT_TRUE(channel_->RemoveRecvStream(0x01)); |
3158 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); | 3158 DeliverPacket(kPcmuFrame, sizeof(kPcmuFrame)); |
3159 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); | 3159 EXPECT_NE(nullptr, GetRecvStream(0x01).sink()); |
3160 } | 3160 } |
3161 | 3161 |
| 3162 // Test that, just like the video channel, the voice channel communicates the |
| 3163 // network state to the call. |
| 3164 TEST_F(WebRtcVoiceEngineTestFake, OnReadyToSendSignalsNetworkState) { |
| 3165 EXPECT_TRUE(SetupEngine()); |
| 3166 |
| 3167 EXPECT_EQ(webrtc::kNetworkUp, |
| 3168 call_.GetNetworkState(webrtc::MediaType::AUDIO)); |
| 3169 EXPECT_EQ(webrtc::kNetworkUp, |
| 3170 call_.GetNetworkState(webrtc::MediaType::VIDEO)); |
| 3171 |
| 3172 channel_->OnReadyToSend(false); |
| 3173 EXPECT_EQ(webrtc::kNetworkDown, |
| 3174 call_.GetNetworkState(webrtc::MediaType::AUDIO)); |
| 3175 EXPECT_EQ(webrtc::kNetworkUp, |
| 3176 call_.GetNetworkState(webrtc::MediaType::VIDEO)); |
| 3177 |
| 3178 channel_->OnReadyToSend(true); |
| 3179 EXPECT_EQ(webrtc::kNetworkUp, |
| 3180 call_.GetNetworkState(webrtc::MediaType::AUDIO)); |
| 3181 EXPECT_EQ(webrtc::kNetworkUp, |
| 3182 call_.GetNetworkState(webrtc::MediaType::VIDEO)); |
| 3183 } |
| 3184 |
3162 // Tests that the library initializes and shuts down properly. | 3185 // Tests that the library initializes and shuts down properly. |
3163 TEST(WebRtcVoiceEngineTest, StartupShutdown) { | 3186 TEST(WebRtcVoiceEngineTest, StartupShutdown) { |
3164 cricket::WebRtcVoiceEngine engine; | 3187 cricket::WebRtcVoiceEngine engine; |
3165 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3188 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3166 std::unique_ptr<webrtc::Call> call( | 3189 std::unique_ptr<webrtc::Call> call( |
3167 webrtc::Call::Create(webrtc::Call::Config())); | 3190 webrtc::Call::Create(webrtc::Call::Config())); |
3168 cricket::VoiceMediaChannel* channel = engine.CreateChannel( | 3191 cricket::VoiceMediaChannel* channel = engine.CreateChannel( |
3169 call.get(), cricket::MediaConfig(), cricket::AudioOptions()); | 3192 call.get(), cricket::MediaConfig(), cricket::AudioOptions()); |
3170 EXPECT_TRUE(channel != nullptr); | 3193 EXPECT_TRUE(channel != nullptr); |
3171 delete channel; | 3194 delete channel; |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3292 cricket::WebRtcVoiceEngine engine; | 3315 cricket::WebRtcVoiceEngine engine; |
3293 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); | 3316 EXPECT_TRUE(engine.Init(rtc::Thread::Current())); |
3294 std::unique_ptr<webrtc::Call> call( | 3317 std::unique_ptr<webrtc::Call> call( |
3295 webrtc::Call::Create(webrtc::Call::Config())); | 3318 webrtc::Call::Create(webrtc::Call::Config())); |
3296 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), | 3319 cricket::WebRtcVoiceMediaChannel channel(&engine, cricket::MediaConfig(), |
3297 cricket::AudioOptions(), call.get()); | 3320 cricket::AudioOptions(), call.get()); |
3298 cricket::AudioRecvParameters parameters; | 3321 cricket::AudioRecvParameters parameters; |
3299 parameters.codecs = engine.codecs(); | 3322 parameters.codecs = engine.codecs(); |
3300 EXPECT_TRUE(channel.SetRecvParameters(parameters)); | 3323 EXPECT_TRUE(channel.SetRecvParameters(parameters)); |
3301 } | 3324 } |
OLD | NEW |