OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 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 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 int num_added_tracks_ = 0; | 627 int num_added_tracks_ = 0; |
628 std::string last_added_track_label_; | 628 std::string last_added_track_label_; |
629 | 629 |
630 private: | 630 private: |
631 rtc::scoped_refptr<MediaStreamInterface> last_added_stream_; | 631 rtc::scoped_refptr<MediaStreamInterface> last_added_stream_; |
632 rtc::scoped_refptr<MediaStreamInterface> last_removed_stream_; | 632 rtc::scoped_refptr<MediaStreamInterface> last_removed_stream_; |
633 }; | 633 }; |
634 | 634 |
635 } // namespace | 635 } // namespace |
636 | 636 |
637 // The PeerConnectionMediaConfig tests below verify that configuration | 637 // The PeerConnectionMediaConfig tests below verify that configuration and |
638 // and constraints are propagated into the MediaConfig passed to | 638 // constraints are propagated into the PeerConnection's MediaConfig. These |
639 // CreateMediaController. These settings are intended for MediaChannel | 639 // settings are intended for MediaChannel constructors, but that is not |
640 // constructors, but that is not exercised by these unittest. | 640 // exercised by these unittest. |
641 class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { | 641 class PeerConnectionFactoryForTest : public webrtc::PeerConnectionFactory { |
642 public: | 642 public: |
643 PeerConnectionFactoryForTest() | 643 PeerConnectionFactoryForTest() |
644 : webrtc::PeerConnectionFactory( | 644 : webrtc::PeerConnectionFactory( |
645 webrtc::CreateBuiltinAudioEncoderFactory(), | 645 webrtc::CreateBuiltinAudioEncoderFactory(), |
646 webrtc::CreateBuiltinAudioDecoderFactory()) {} | 646 webrtc::CreateBuiltinAudioDecoderFactory()) {} |
647 | 647 |
648 cricket::TransportController* CreateTransportController( | 648 cricket::TransportController* CreateTransportController( |
649 cricket::PortAllocator* port_allocator, | 649 cricket::PortAllocator* port_allocator, |
650 bool redetermine_role_on_ice_restart) override { | 650 bool redetermine_role_on_ice_restart) override { |
(...skipping 2675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3326 const cricket::MediaConfig& media_config = | 3326 const cricket::MediaConfig& media_config = |
3327 TestCreatePeerConnection(config, &constraints); | 3327 TestCreatePeerConnection(config, &constraints); |
3328 | 3328 |
3329 EXPECT_FALSE(media_config.enable_dscp); | 3329 EXPECT_FALSE(media_config.enable_dscp); |
3330 EXPECT_TRUE(media_config.video.enable_cpu_overuse_detection); | 3330 EXPECT_TRUE(media_config.video.enable_cpu_overuse_detection); |
3331 EXPECT_FALSE(media_config.video.disable_prerenderer_smoothing); | 3331 EXPECT_FALSE(media_config.video.disable_prerenderer_smoothing); |
3332 EXPECT_FALSE(media_config.video.suspend_below_min_bitrate); | 3332 EXPECT_FALSE(media_config.video.suspend_below_min_bitrate); |
3333 } | 3333 } |
3334 | 3334 |
3335 // This test verifies the DSCP constraint is recognized and passed to | 3335 // This test verifies the DSCP constraint is recognized and passed to |
3336 // the CreateMediaController call. | 3336 // the PeerConnection. |
3337 TEST_F(PeerConnectionMediaConfigTest, TestDscpConstraintTrue) { | 3337 TEST_F(PeerConnectionMediaConfigTest, TestDscpConstraintTrue) { |
3338 PeerConnectionInterface::RTCConfiguration config; | 3338 PeerConnectionInterface::RTCConfiguration config; |
3339 FakeConstraints constraints; | 3339 FakeConstraints constraints; |
3340 | 3340 |
3341 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDscp, true); | 3341 constraints.AddOptional(webrtc::MediaConstraintsInterface::kEnableDscp, true); |
3342 const cricket::MediaConfig& media_config = | 3342 const cricket::MediaConfig& media_config = |
3343 TestCreatePeerConnection(config, &constraints); | 3343 TestCreatePeerConnection(config, &constraints); |
3344 | 3344 |
3345 EXPECT_TRUE(media_config.enable_dscp); | 3345 EXPECT_TRUE(media_config.enable_dscp); |
3346 } | 3346 } |
3347 | 3347 |
3348 // This test verifies the cpu overuse detection constraint is | 3348 // This test verifies the cpu overuse detection constraint is |
3349 // recognized and passed to the CreateMediaController call. | 3349 // recognized and passed to the PeerConnection. |
3350 TEST_F(PeerConnectionMediaConfigTest, TestCpuOveruseConstraintFalse) { | 3350 TEST_F(PeerConnectionMediaConfigTest, TestCpuOveruseConstraintFalse) { |
3351 PeerConnectionInterface::RTCConfiguration config; | 3351 PeerConnectionInterface::RTCConfiguration config; |
3352 FakeConstraints constraints; | 3352 FakeConstraints constraints; |
3353 | 3353 |
3354 constraints.AddOptional( | 3354 constraints.AddOptional( |
3355 webrtc::MediaConstraintsInterface::kCpuOveruseDetection, false); | 3355 webrtc::MediaConstraintsInterface::kCpuOveruseDetection, false); |
3356 const cricket::MediaConfig media_config = | 3356 const cricket::MediaConfig media_config = |
3357 TestCreatePeerConnection(config, &constraints); | 3357 TestCreatePeerConnection(config, &constraints); |
3358 | 3358 |
3359 EXPECT_FALSE(media_config.video.enable_cpu_overuse_detection); | 3359 EXPECT_FALSE(media_config.video.enable_cpu_overuse_detection); |
3360 } | 3360 } |
3361 | 3361 |
3362 // This test verifies that the disable_prerenderer_smoothing flag is | 3362 // This test verifies that the disable_prerenderer_smoothing flag is |
3363 // propagated from RTCConfiguration to the CreateMediaController call. | 3363 // propagated from RTCConfiguration to the PeerConnection. |
3364 TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) { | 3364 TEST_F(PeerConnectionMediaConfigTest, TestDisablePrerendererSmoothingTrue) { |
3365 PeerConnectionInterface::RTCConfiguration config; | 3365 PeerConnectionInterface::RTCConfiguration config; |
3366 FakeConstraints constraints; | 3366 FakeConstraints constraints; |
3367 | 3367 |
3368 config.set_prerenderer_smoothing(false); | 3368 config.set_prerenderer_smoothing(false); |
3369 const cricket::MediaConfig& media_config = | 3369 const cricket::MediaConfig& media_config = |
3370 TestCreatePeerConnection(config, &constraints); | 3370 TestCreatePeerConnection(config, &constraints); |
3371 | 3371 |
3372 EXPECT_TRUE(media_config.video.disable_prerenderer_smoothing); | 3372 EXPECT_TRUE(media_config.video.disable_prerenderer_smoothing); |
3373 } | 3373 } |
3374 | 3374 |
3375 // This test verifies the suspend below min bitrate constraint is | 3375 // This test verifies the suspend below min bitrate constraint is |
3376 // recognized and passed to the CreateMediaController call. | 3376 // recognized and passed to the PeerConnection. |
3377 TEST_F(PeerConnectionMediaConfigTest, | 3377 TEST_F(PeerConnectionMediaConfigTest, |
3378 TestSuspendBelowMinBitrateConstraintTrue) { | 3378 TestSuspendBelowMinBitrateConstraintTrue) { |
3379 PeerConnectionInterface::RTCConfiguration config; | 3379 PeerConnectionInterface::RTCConfiguration config; |
3380 FakeConstraints constraints; | 3380 FakeConstraints constraints; |
3381 | 3381 |
3382 constraints.AddOptional( | 3382 constraints.AddOptional( |
3383 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, | 3383 webrtc::MediaConstraintsInterface::kEnableVideoSuspendBelowMinBitrate, |
3384 true); | 3384 true); |
3385 const cricket::MediaConfig media_config = | 3385 const cricket::MediaConfig media_config = |
3386 TestCreatePeerConnection(config, &constraints); | 3386 TestCreatePeerConnection(config, &constraints); |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3582 EXPECT_NE(a, f); | 3582 EXPECT_NE(a, f); |
3583 | 3583 |
3584 PeerConnectionInterface::RTCConfiguration g; | 3584 PeerConnectionInterface::RTCConfiguration g; |
3585 g.disable_ipv6 = true; | 3585 g.disable_ipv6 = true; |
3586 EXPECT_NE(a, g); | 3586 EXPECT_NE(a, g); |
3587 | 3587 |
3588 PeerConnectionInterface::RTCConfiguration h( | 3588 PeerConnectionInterface::RTCConfiguration h( |
3589 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 3589 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
3590 EXPECT_NE(a, h); | 3590 EXPECT_NE(a, h); |
3591 } | 3591 } |
OLD | NEW |