| 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 #define MAYBE_FixedTemporalLayersStrategy DISABLED_FixedTemporalLayersStrategy |
| 428 #else |
| 429 #define MAYBE_FixedTemporalLayersStrategy FixedTemporalLayersStrategy |
| 430 #endif |
| 431 TEST_F(TestVideoSenderWithVp8, MAYBE_FixedTemporalLayersStrategy) { |
| 429 const int low_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][0]; | 432 const int low_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][0]; |
| 430 const int mid_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][1]; | 433 const int mid_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][1]; |
| 431 const int high_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][2]; | 434 const int high_b = codec_bitrate_kbps_ * kVp8LayerRateAlloction[2][2]; |
| 432 { | 435 { |
| 433 Vp8StreamInfo expected = {{7.5, 15.0, 30.0}, {low_b, mid_b, high_b}}; | 436 Vp8StreamInfo expected = {{7.5, 15.0, 30.0}, {low_b, mid_b, high_b}}; |
| 434 EXPECT_THAT(SimulateWithFramerate(30.0), MatchesVp8StreamInfo(expected)); | 437 EXPECT_THAT(SimulateWithFramerate(30.0), MatchesVp8StreamInfo(expected)); |
| 435 } | 438 } |
| 436 { | 439 { |
| 437 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; | 440 Vp8StreamInfo expected = {{3.75, 7.5, 15.0}, {low_b, mid_b, high_b}}; |
| 438 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); | 441 EXPECT_THAT(SimulateWithFramerate(15.0), MatchesVp8StreamInfo(expected)); |
| 439 } | 442 } |
| 440 } | 443 } |
| 441 | 444 |
| 442 TEST_F(TestVideoSenderWithVp8, | 445 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) |
| 443 DISABLED_ON_IOS(DISABLED_ON_ANDROID(RealTimeTemporalLayersStrategy))) { | 446 #define MAYBE_RealTimeTemporalLayersStrategy \ |
| 447 DISABLED_RealTimeTemporalLayersStrategy |
| 448 #else |
| 449 #define MAYBE_RealTimeTemporalLayersStrategy RealTimeTemporalLayersStrategy |
| 450 #endif |
| 451 TEST_F(TestVideoSenderWithVp8, MAYBE_RealTimeTemporalLayersStrategy) { |
| 444 Config extra_options; | 452 Config extra_options; |
| 445 extra_options.Set<TemporalLayers::Factory>( | 453 extra_options.Set<TemporalLayers::Factory>( |
| 446 new RealTimeTemporalLayersFactory()); | 454 new RealTimeTemporalLayersFactory()); |
| 447 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3); | 455 VideoCodec codec = MakeVp8VideoCodec(352, 288, 3); |
| 448 codec.extra_options = &extra_options; | 456 codec.extra_options = &extra_options; |
| 449 codec.minBitrate = 10; | 457 codec.minBitrate = 10; |
| 450 codec.startBitrate = codec_bitrate_kbps_; | 458 codec.startBitrate = codec_bitrate_kbps_; |
| 451 codec.maxBitrate = codec_bitrate_kbps_; | 459 codec.maxBitrate = codec_bitrate_kbps_; |
| 452 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200)); | 460 EXPECT_EQ(0, sender_->RegisterSendCodec(&codec, 1, 1200)); |
| 453 | 461 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 473 } | 481 } |
| 474 { | 482 { |
| 475 // TODO(andresp): Find out why this fails with framerate = 7.5 | 483 // 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}}; | 484 Vp8StreamInfo expected = {{7.0, 7.0, 7.0}, {high_b, high_b, high_b}}; |
| 477 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); | 485 EXPECT_THAT(SimulateWithFramerate(7.0), MatchesVp8StreamInfo(expected)); |
| 478 } | 486 } |
| 479 } | 487 } |
| 480 } // namespace | 488 } // namespace |
| 481 } // namespace vcm | 489 } // namespace vcm |
| 482 } // namespace webrtc | 490 } // namespace webrtc |
| OLD | NEW |