OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "webrtc/base/scoped_ptr.h" | 14 #include "webrtc/base/scoped_ptr.h" |
15 #include "webrtc/common.h" | 15 #include "webrtc/common.h" |
16 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" | 16 #include "webrtc/modules/video_coding/include/mock/mock_video_codec_interface.h" |
17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" | 17 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8.h" |
18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" | 18 #include "webrtc/modules/video_coding/codecs/vp8/include/vp8_common_types.h" |
19 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" | 19 #include "webrtc/modules/video_coding/codecs/vp8/temporal_layers.h" |
20 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" | 20 #include "webrtc/modules/video_coding/include/mock/mock_vcm_callbacks.h" |
21 #include "webrtc/modules/video_coding/include/video_coding.h" | 21 #include "webrtc/modules/video_coding/include/video_coding.h" |
22 #include "webrtc/modules/video_coding/video_coding_impl.h" | 22 #include "webrtc/modules/video_coding/video_coding_impl.h" |
23 #include "webrtc/modules/video_coding/test/test_util.h" | 23 #include "webrtc/modules/video_coding/test/test_util.h" |
24 #include "webrtc/system_wrappers/include/clock.h" | 24 #include "webrtc/system_wrappers/include/clock.h" |
25 #include "webrtc/test/frame_generator.h" | 25 #include "webrtc/test/frame_generator.h" |
26 #include "webrtc/test/testsupport/fileutils.h" | 26 #include "webrtc/test/testsupport/fileutils.h" |
27 #include "webrtc/test/testsupport/gtest_disable.h" | |
28 | 27 |
29 using ::testing::_; | 28 using ::testing::_; |
30 using ::testing::AllOf; | 29 using ::testing::AllOf; |
31 using ::testing::ElementsAre; | 30 using ::testing::ElementsAre; |
32 using ::testing::ElementsAreArray; | 31 using ::testing::ElementsAreArray; |
33 using ::testing::Field; | 32 using ::testing::Field; |
34 using ::testing::NiceMock; | 33 using ::testing::NiceMock; |
35 using ::testing::Pointee; | 34 using ::testing::Pointee; |
36 using ::testing::Return; | 35 using ::testing::Return; |
37 using ::testing::FloatEq; | 36 using ::testing::FloatEq; |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 InsertFrames(framerate, long_simulation_interval); | 416 InsertFrames(framerate, long_simulation_interval); |
418 return packetization_callback_.CalculateVp8StreamInfo(); | 417 return packetization_callback_.CalculateVp8StreamInfo(); |
419 } | 418 } |
420 | 419 |
421 protected: | 420 protected: |
422 VideoCodec codec_; | 421 VideoCodec codec_; |
423 int codec_bitrate_kbps_; | 422 int codec_bitrate_kbps_; |
424 int available_bitrate_kbps_; | 423 int available_bitrate_kbps_; |
425 }; | 424 }; |
426 | 425 |
427 TEST_F(TestVideoSenderWithVp8, | 426 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
428 DISABLED_ON_IOS(DISABLED_ON_ANDROID(FixedTemporalLayersStrategy))) { | 427 TEST_F(TestVideoSenderWithVp8, DISABLED_FixedTemporalLayersStrategy) { |
| 428 #else |
| 429 TEST_F(TestVideoSenderWithVp8, FixedTemporalLayersStrategy) { |
| 430 #endif |
429 const int low_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][0]; | 431 const int low_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][0]; |
430 const int mid_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][1]; | 432 const int mid_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][1]; |
431 const int high_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][2]; | 433 const int high_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][2]; |
432 { | 434 { |
433 Vp8StreamInfo expected = {{7.5, 15.0, 30.0}, {low_b, mid_b, high_b}}; | 435 Vp8StreamInfo expected = {{7.5, 15.0, 30.0}, {low_b, mid_b, high_b}}; |
434 EXPECT_THAT(SimulateWithFramerate(30.0), MatchesVp8StreamInfo(expected)); | 436 EXPECT_THAT(SimulateWithFramerate(30.0), MatchesVp8StreamInfo(expected)); |
435 } | 437 } |
436 { | 438 { |
437 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; | 439 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; |
438 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); | 440 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); |
439 } | 441 } |
440 } | 442 } |
441 | 443 |
442 TEST_F(TestVideoSenderWithVp8, | 444 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
443 DISABLED_ON_IOS(DISABLED_ON_ANDROID(RealTimeTemporalLayersStrategy))) { | 445 TEST_F(TestVideoSenderWithVp8, DISABLED_RealTimeTemporalLayersStrategy) { |
| 446 #else |
| 447 TEST_F(TestVideoSenderWithVp8, RealTimeTemporalLayersStrategy) { |
| 448 #endif |
444 Config extra_options; | 449 Config extra_options; |
445 extra_options.Set<TemporalLayers::Factory>( | 450 extra_options.Set<TemporalLayers::Factory>( |
446 new RealTimeTemporalLayersFactory()); | 451 new RealTimeTemporalLayersFactory()); |
447 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3); | 452 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3); |
448 codec.extra_options = &extra_options; | 453 codec.extra_options = &extra_options; |
449 codec.minBitrate = 10; | 454 codec.minBitrate = 10; |
450 codec.startBitrate = codec_bitrate_kbps_; | 455 codec.startBitrate = codec_bitrate_kbps_; |
451 codec.maxBitrate = codec_bitrate_kbps_; | 456 codec.maxBitrate = codec_bitrate_kbps_; |
452 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200)); | 457 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200)); |
453 | 458 |
(...skipping 19 matching lines...) Expand all Loading... |
473 } | 478 } |
474 { | 479 { |
475 // TODO(andresp): Find out why this fails with framerate = 7.5 | 480 // TODO(andresp): Find out why this fails with framerate = 7.5 |
476 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; | 481 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; |
477 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); | 482 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); |
478 } | 483 } |
479 } | 484 } |
480 } // namespace | 485 } // namespace |
481 } // namespace vcm | 486 } // namespace vcm |
482 } // namespace webrtc | 487 } // namespace webrtc |
OLD | NEW |