Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 336 EXPECT_FALSE(capturer.GetApplyRotation()); | 336 EXPECT_FALSE(capturer.GetApplyRotation()); |
| 337 | 337 |
| 338 // Verify removing header extension turns on applying rotation. | 338 // Verify removing header extension turns on applying rotation. |
| 339 parameters.extensions.clear(); | 339 parameters.extensions.clear(); |
| 340 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 340 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 341 EXPECT_TRUE(capturer.GetApplyRotation()); | 341 EXPECT_TRUE(capturer.GetApplyRotation()); |
| 342 } | 342 } |
| 343 | 343 |
| 344 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { | 344 TEST_F(WebRtcVideoEngine2Test, SetSendFailsBeforeSettingCodecs) { |
| 345 engine_.Init(); | 345 engine_.Init(); |
| 346 rtc::scoped_ptr<VideoMediaChannel> channel( | 346 rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel( |
| 347 engine_.CreateChannel(call_.get(), cricket::VideoOptions())); | 347 call_.get(), MediaChannelOptions(), VideoOptions())); |
| 348 | 348 |
| 349 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); | 349 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
| 350 | 350 |
| 351 EXPECT_FALSE(channel->SetSend(true)) | 351 EXPECT_FALSE(channel->SetSend(true)) |
| 352 << "Channel should not start without codecs."; | 352 << "Channel should not start without codecs."; |
| 353 EXPECT_TRUE(channel->SetSend(false)) | 353 EXPECT_TRUE(channel->SetSend(false)) |
| 354 << "Channel should be stoppable even without set codecs."; | 354 << "Channel should be stoppable even without set codecs."; |
| 355 } | 355 } |
| 356 | 356 |
| 357 TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) { | 357 TEST_F(WebRtcVideoEngine2Test, GetStatsWithoutSendCodecsSetDoesNotCrash) { |
| 358 engine_.Init(); | 358 engine_.Init(); |
| 359 rtc::scoped_ptr<VideoMediaChannel> channel( | 359 rtc::scoped_ptr<VideoMediaChannel> channel(engine_.CreateChannel( |
| 360 engine_.CreateChannel(call_.get(), cricket::VideoOptions())); | 360 call_.get(), MediaChannelOptions(), VideoOptions())); |
| 361 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); | 361 EXPECT_TRUE(channel->AddSendStream(StreamParams::CreateLegacy(123))); |
| 362 VideoMediaInfo info; | 362 VideoMediaInfo info; |
| 363 channel->GetStats(&info); | 363 channel->GetStats(&info); |
| 364 } | 364 } |
| 365 | 365 |
| 366 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { | 366 TEST_F(WebRtcVideoEngine2Test, UseExternalFactoryForVp8WhenSupported) { |
| 367 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 367 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 368 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); | 368 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| 369 cricket::VideoSendParameters parameters; | 369 cricket::VideoSendParameters parameters; |
| 370 parameters.codecs.push_back(kVp8Codec); | 370 parameters.codecs.push_back(kVp8Codec); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 529 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); | 529 EXPECT_TRUE(channel->RemoveSendStream(kSsrc)); |
| 530 } | 530 } |
| 531 | 531 |
| 532 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( | 532 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalEncoderFactory( |
| 533 cricket::WebRtcVideoEncoderFactory* encoder_factory, | 533 cricket::WebRtcVideoEncoderFactory* encoder_factory, |
| 534 const std::vector<VideoCodec>& codecs) { | 534 const std::vector<VideoCodec>& codecs) { |
| 535 engine_.SetExternalEncoderFactory(encoder_factory); | 535 engine_.SetExternalEncoderFactory(encoder_factory); |
| 536 engine_.Init(); | 536 engine_.Init(); |
| 537 | 537 |
| 538 VideoMediaChannel* channel = | 538 VideoMediaChannel* channel = |
| 539 engine_.CreateChannel(call_.get(), cricket::VideoOptions()); | 539 engine_.CreateChannel(call_.get(), MediaChannelOptions(), VideoOptions()); |
| 540 cricket::VideoSendParameters parameters; | 540 cricket::VideoSendParameters parameters; |
| 541 parameters.codecs = codecs; | 541 parameters.codecs = codecs; |
| 542 EXPECT_TRUE(channel->SetSendParameters(parameters)); | 542 EXPECT_TRUE(channel->SetSendParameters(parameters)); |
| 543 | 543 |
| 544 return channel; | 544 return channel; |
| 545 } | 545 } |
| 546 | 546 |
| 547 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalDecoderFactory( | 547 VideoMediaChannel* WebRtcVideoEngine2Test::SetUpForExternalDecoderFactory( |
| 548 cricket::WebRtcVideoDecoderFactory* decoder_factory, | 548 cricket::WebRtcVideoDecoderFactory* decoder_factory, |
| 549 const std::vector<VideoCodec>& codecs) { | 549 const std::vector<VideoCodec>& codecs) { |
| 550 engine_.SetExternalDecoderFactory(decoder_factory); | 550 engine_.SetExternalDecoderFactory(decoder_factory); |
| 551 engine_.Init(); | 551 engine_.Init(); |
| 552 | 552 |
| 553 VideoMediaChannel* channel = | 553 VideoMediaChannel* channel = |
| 554 engine_.CreateChannel(call_.get(), cricket::VideoOptions()); | 554 engine_.CreateChannel(call_.get(), MediaChannelOptions(), VideoOptions()); |
| 555 cricket::VideoRecvParameters parameters; | 555 cricket::VideoRecvParameters parameters; |
| 556 parameters.codecs = codecs; | 556 parameters.codecs = codecs; |
| 557 EXPECT_TRUE(channel->SetRecvParameters(parameters)); | 557 EXPECT_TRUE(channel->SetRecvParameters(parameters)); |
| 558 | 558 |
| 559 return channel; | 559 return channel; |
| 560 } | 560 } |
| 561 | 561 |
| 562 TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { | 562 TEST_F(WebRtcVideoEngine2Test, UsesSimulcastAdapterForVp8Factories) { |
| 563 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; | 563 cricket::FakeWebRtcVideoEncoderFactory encoder_factory; |
| 564 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); | 564 encoder_factory.AddSupportedVideoCodecType(webrtc::kVideoCodecVP8, "VP8"); |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 888 } | 888 } |
| 889 | 889 |
| 890 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { | 890 class WebRtcVideoChannel2Test : public WebRtcVideoEngine2Test { |
| 891 public: | 891 public: |
| 892 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} | 892 WebRtcVideoChannel2Test() : WebRtcVideoChannel2Test("") {} |
| 893 explicit WebRtcVideoChannel2Test(const char* field_trials) | 893 explicit WebRtcVideoChannel2Test(const char* field_trials) |
| 894 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} | 894 : WebRtcVideoEngine2Test(field_trials), last_ssrc_(0) {} |
| 895 void SetUp() override { | 895 void SetUp() override { |
| 896 fake_call_.reset(new FakeCall(webrtc::Call::Config())); | 896 fake_call_.reset(new FakeCall(webrtc::Call::Config())); |
| 897 engine_.Init(); | 897 engine_.Init(); |
| 898 channel_.reset( | 898 channel_.reset(engine_.CreateChannel( |
| 899 engine_.CreateChannel(fake_call_.get(), cricket::VideoOptions())); | 899 fake_call_.get(), MediaChannelOptions(), VideoOptions())); |
| 900 last_ssrc_ = 123; | 900 last_ssrc_ = 123; |
| 901 send_parameters_.codecs = engine_.codecs(); | 901 send_parameters_.codecs = engine_.codecs(); |
| 902 recv_parameters_.codecs = engine_.codecs(); | 902 recv_parameters_.codecs = engine_.codecs(); |
| 903 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); | 903 ASSERT_TRUE(channel_->SetSendParameters(send_parameters_)); |
| 904 } | 904 } |
| 905 | 905 |
| 906 protected: | 906 protected: |
| 907 FakeVideoSendStream* AddSendStream() { | 907 FakeVideoSendStream* AddSendStream() { |
| 908 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); | 908 return AddSendStream(StreamParams::CreateLegacy(++last_ssrc_)); |
| 909 } | 909 } |
| (...skipping 1461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2371 EXPECT_TRUE(channel_->SetSend(true)); | 2371 EXPECT_TRUE(channel_->SetSend(true)); |
| 2372 FakeVideoSendStream* new_stream = AddSendStream(); | 2372 FakeVideoSendStream* new_stream = AddSendStream(); |
| 2373 EXPECT_TRUE(new_stream->IsSending()) | 2373 EXPECT_TRUE(new_stream->IsSending()) |
| 2374 << "Send stream created after SetSend(true) not sending initially."; | 2374 << "Send stream created after SetSend(true) not sending initially."; |
| 2375 } | 2375 } |
| 2376 | 2376 |
| 2377 // This test verifies DSCP settings are properly applied on video media channel. | 2377 // This test verifies DSCP settings are properly applied on video media channel. |
| 2378 TEST_F(WebRtcVideoChannel2Test, TestSetDscpOptions) { | 2378 TEST_F(WebRtcVideoChannel2Test, TestSetDscpOptions) { |
| 2379 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( | 2379 rtc::scoped_ptr<cricket::FakeNetworkInterface> network_interface( |
| 2380 new cricket::FakeNetworkInterface); | 2380 new cricket::FakeNetworkInterface); |
| 2381 channel_->SetInterface(network_interface.get()); | 2381 MediaChannelOptions options; |
| 2382 cricket::VideoSendParameters parameters = send_parameters_; | 2382 rtc::scoped_ptr<VideoMediaChannel> channel; |
| 2383 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2383 |
| 2384 EXPECT_EQ(rtc::DSCP_NO_CHANGE, network_interface->dscp()); | 2384 channel.reset(engine_.CreateChannel(call_.get(), options, VideoOptions())); |
| 2385 parameters.options.dscp = rtc::Optional<bool>(true); | 2385 channel->SetInterface(network_interface.get()); |
| 2386 EXPECT_TRUE(channel_->SetSendParameters(parameters)); | 2386 // Current implementation always sets the DiffServCodePoint. |
|
pbos-webrtc
2016/02/01 14:44:38
// Default value when DSCP is disabled should be D
nisse-webrtc
2016/02/02 11:32:50
Done.
| |
| 2387 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); | |
| 2388 | |
| 2389 options.enable_dscp = true; | |
| 2390 channel.reset(engine_.CreateChannel(call_.get(), options, VideoOptions())); | |
| 2391 channel->SetInterface(network_interface.get()); | |
| 2387 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); | 2392 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); |
| 2388 // Verify previous value is not modified if dscp option is not set. | 2393 |
| 2389 cricket::VideoSendParameters parameters1 = send_parameters_; | 2394 // Verify that setting the option to false resets the |
| 2390 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); | 2395 // DiffServCodePoint. |
| 2391 EXPECT_EQ(rtc::DSCP_AF41, network_interface->dscp()); | 2396 options.enable_dscp = false; |
| 2392 parameters1.options.dscp = rtc::Optional<bool>(false); | 2397 channel.reset(engine_.CreateChannel(call_.get(), options, VideoOptions())); |
| 2393 EXPECT_TRUE(channel_->SetSendParameters(parameters1)); | 2398 channel->SetInterface(network_interface.get()); |
| 2394 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); | 2399 EXPECT_EQ(rtc::DSCP_DEFAULT, network_interface->dscp()); |
| 2395 channel_->SetInterface(NULL); | |
| 2396 } | 2400 } |
| 2397 | 2401 |
| 2398 // This test verifies that the RTCP reduced size mode is properly applied to | 2402 // This test verifies that the RTCP reduced size mode is properly applied to |
| 2399 // send video streams. | 2403 // send video streams. |
| 2400 TEST_F(WebRtcVideoChannel2Test, TestSetSendRtcpReducedSize) { | 2404 TEST_F(WebRtcVideoChannel2Test, TestSetSendRtcpReducedSize) { |
| 2401 // Create stream, expecting that default mode is "compound". | 2405 // Create stream, expecting that default mode is "compound". |
| 2402 FakeVideoSendStream* stream1 = AddSendStream(); | 2406 FakeVideoSendStream* stream1 = AddSendStream(); |
| 2403 EXPECT_EQ(webrtc::RtcpMode::kCompound, stream1->GetConfig().rtp.rtcp_mode); | 2407 EXPECT_EQ(webrtc::RtcpMode::kCompound, stream1->GetConfig().rtp.rtcp_mode); |
| 2404 | 2408 |
| 2405 // Now enable reduced size mode. | 2409 // Now enable reduced size mode. |
| (...skipping 787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3193 // TODO(pbos): Implement. | 3197 // TODO(pbos): Implement. |
| 3194 FAIL() << "Not implemented."; | 3198 FAIL() << "Not implemented."; |
| 3195 } | 3199 } |
| 3196 | 3200 |
| 3197 class WebRtcVideoChannel2SimulcastTest : public testing::Test { | 3201 class WebRtcVideoChannel2SimulcastTest : public testing::Test { |
| 3198 public: | 3202 public: |
| 3199 WebRtcVideoChannel2SimulcastTest() : fake_call_(webrtc::Call::Config()) {} | 3203 WebRtcVideoChannel2SimulcastTest() : fake_call_(webrtc::Call::Config()) {} |
| 3200 | 3204 |
| 3201 void SetUp() override { | 3205 void SetUp() override { |
| 3202 engine_.Init(); | 3206 engine_.Init(); |
| 3203 channel_.reset(engine_.CreateChannel(&fake_call_, VideoOptions())); | 3207 channel_.reset(engine_.CreateChannel(&fake_call_, MediaChannelOptions(), |
| 3208 VideoOptions())); | |
| 3204 last_ssrc_ = 123; | 3209 last_ssrc_ = 123; |
| 3205 } | 3210 } |
| 3206 | 3211 |
| 3207 protected: | 3212 protected: |
| 3208 void VerifySimulcastSettings(const VideoCodec& codec, | 3213 void VerifySimulcastSettings(const VideoCodec& codec, |
| 3209 size_t num_configured_streams, | 3214 size_t num_configured_streams, |
| 3210 size_t expected_num_streams) { | 3215 size_t expected_num_streams) { |
| 3211 cricket::VideoSendParameters parameters; | 3216 cricket::VideoSendParameters parameters; |
| 3212 parameters.codecs.push_back(codec); | 3217 parameters.codecs.push_back(codec); |
| 3213 ASSERT_TRUE(channel_->SetSendParameters(parameters)); | 3218 ASSERT_TRUE(channel_->SetSendParameters(parameters)); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3412 // reapplied when disabling screencasting. | 3417 // reapplied when disabling screencasting. |
| 3413 TEST_F(WebRtcVideoChannel2SimulcastTest, | 3418 TEST_F(WebRtcVideoChannel2SimulcastTest, |
| 3414 DISABLED_TwoTemporalLayerScreencastSettings) { | 3419 DISABLED_TwoTemporalLayerScreencastSettings) { |
| 3415 // TODO(pbos): Implement. | 3420 // TODO(pbos): Implement. |
| 3416 FAIL() << "Not implemented."; | 3421 FAIL() << "Not implemented."; |
| 3417 } | 3422 } |
| 3418 | 3423 |
| 3419 } // namespace cricket | 3424 } // namespace cricket |
| 3420 | 3425 |
| 3421 #endif // HAVE_WEBRTC_VIDEO | 3426 #endif // HAVE_WEBRTC_VIDEO |
| OLD | NEW |