OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 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 "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" | 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" |
12 | 12 |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
| 15 #include "webrtc/test/testsupport/fileutils.h" |
| 16 |
15 namespace webrtc { | 17 namespace webrtc { |
16 namespace test { | 18 namespace test { |
17 | 19 |
18 #if defined(WEBRTC_USE_H264) | 20 #if defined(WEBRTC_USE_H264) |
19 | 21 |
20 namespace { | 22 namespace { |
21 | 23 |
22 // Test settings. | |
23 // Only allow encoder/decoder to use single core, for predictability. | |
24 const bool kUseSingleCore = true; | |
25 const bool kVerboseLogging = false; | |
26 const bool kHwCodec = false; | |
27 | |
28 // Codec settings. | 24 // Codec settings. |
29 const bool kResilienceOn = true; | 25 const bool kResilienceOn = true; |
30 | |
31 // Default sequence is foreman (CIF): may be better to use VGA for resize test. | |
32 const int kCifWidth = 352; | 26 const int kCifWidth = 352; |
33 const int kCifHeight = 288; | 27 const int kCifHeight = 288; |
34 const char kForemanCif[] = "foreman_cif"; | |
35 const int kNumFrames = 100; | 28 const int kNumFrames = 100; |
36 | 29 |
37 const std::nullptr_t kNoVisualizationParams = nullptr; | 30 const std::nullptr_t kNoVisualizationParams = nullptr; |
38 | 31 |
39 } // namespace | 32 } // namespace |
40 | 33 |
| 34 class VideoProcessorIntegrationTestOpenH264 |
| 35 : public VideoProcessorIntegrationTest { |
| 36 protected: |
| 37 VideoProcessorIntegrationTestOpenH264() { |
| 38 config_.filename = "foreman_cif"; |
| 39 config_.input_filename = ResourcePath(config_.filename, "yuv"); |
| 40 config_.output_filename = |
| 41 TempFilename(OutputPath(), "videoprocessor_integrationtest_libvpx"); |
| 42 config_.networking_config.packet_loss_probability = 0.0; |
| 43 // Only allow encoder/decoder to use single core, for predictability. |
| 44 config_.use_single_core = true; |
| 45 config_.verbose = false; |
| 46 config_.hw_codec = false; |
| 47 } |
| 48 }; |
| 49 |
41 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. | 50 // H264: Run with no packet loss and fixed bitrate. Quality should be very high. |
42 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in | 51 // Note(hbos): The PacketManipulatorImpl code used to simulate packet loss in |
43 // these unittests appears to drop "packets" in a way that is not compatible | 52 // these unittests appears to drop "packets" in a way that is not compatible |
44 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have | 53 // with H264. Therefore ProcessXPercentPacketLossH264, X != 0, unittests have |
45 // not been added. | 54 // not been added. |
46 TEST_F(VideoProcessorIntegrationTest, Process0PercentPacketLossH264) { | 55 TEST_F(VideoProcessorIntegrationTestOpenH264, Process0PercentPacketLossH264) { |
47 SetTestConfig(&config_, kHwCodec, kUseSingleCore, 0.0f, kForemanCif, | |
48 kVerboseLogging); | |
49 SetCodecSettings(&config_, kVideoCodecH264, 1, false, false, true, false, | 56 SetCodecSettings(&config_, kVideoCodecH264, 1, false, false, true, false, |
50 kResilienceOn, kCifWidth, kCifHeight); | 57 kResilienceOn, kCifWidth, kCifHeight); |
51 | 58 |
52 RateProfile rate_profile; | 59 RateProfile rate_profile; |
53 SetRateProfile(&rate_profile, 0, 500, 30, 0); | 60 SetRateProfile(&rate_profile, 0, 500, 30, 0); |
54 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; | 61 rate_profile.frame_index_rate_update[1] = kNumFrames + 1; |
55 rate_profile.num_frames = kNumFrames; | 62 rate_profile.num_frames = kNumFrames; |
56 | 63 |
57 std::vector<RateControlThresholds> rc_thresholds; | 64 std::vector<RateControlThresholds> rc_thresholds; |
58 AddRateControlThresholds(2, 60, 20, 10, 20, 0, 1, &rc_thresholds); | 65 AddRateControlThresholds(2, 60, 20, 10, 20, 0, 1, &rc_thresholds); |
59 | 66 |
60 QualityThresholds quality_thresholds(35.0, 25.0, 0.93, 0.70); | 67 QualityThresholds quality_thresholds(35.0, 25.0, 0.93, 0.70); |
61 | 68 |
62 ProcessFramesAndMaybeVerify(rate_profile, &rc_thresholds, &quality_thresholds, | 69 ProcessFramesAndMaybeVerify(rate_profile, &rc_thresholds, &quality_thresholds, |
63 kNoVisualizationParams); | 70 kNoVisualizationParams); |
64 } | 71 } |
65 | 72 |
66 #endif // defined(WEBRTC_USE_H264) | 73 #endif // defined(WEBRTC_USE_H264) |
67 | 74 |
68 } // namespace test | 75 } // namespace test |
69 } // namespace webrtc | 76 } // namespace webrtc |
OLD | NEW |