OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #include "webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest
.h" |
| 12 |
| 13 #include <vector> |
| 14 |
| 15 #include "webrtc/test/field_trial.h" |
| 16 #include "webrtc/test/testsupport/fileutils.h" |
| 17 |
| 18 namespace webrtc { |
| 19 namespace test { |
| 20 |
| 21 #if defined(WEBRTC_ANDROID) |
| 22 |
| 23 namespace { |
| 24 const int kForemanNumFrames = 300; |
| 25 const std::nullptr_t kNoVisualizationParams = nullptr; |
| 26 } // namespace |
| 27 |
| 28 class VideoProcessorIntegrationTestMediaCodec |
| 29 : public VideoProcessorIntegrationTest { |
| 30 protected: |
| 31 VideoProcessorIntegrationTestMediaCodec() { |
| 32 config_.filename = "foreman_cif"; |
| 33 config_.input_filename = ResourcePath(config_.filename, "yuv"); |
| 34 config_.output_filename = |
| 35 TempFilename(OutputPath(), "videoprocessor_integrationtest_mediacodec"); |
| 36 config_.verbose = false; |
| 37 config_.hw_encoder = true; |
| 38 config_.hw_decoder = true; |
| 39 } |
| 40 }; |
| 41 |
| 42 TEST_F(VideoProcessorIntegrationTestMediaCodec, |
| 43 ForemanCif500kbpsMediaCodecVp8) { |
| 44 config_.input_filename = ResourcePath(config_.filename, "yuv"); |
| 45 SetCodecSettings(&config_, kVideoCodecVP8, 1, false, false, false, false, |
| 46 false, 352, 288); |
| 47 |
| 48 RateProfile rate_profile; |
| 49 SetRateProfile(&rate_profile, 0, 500, 30, 0); // Start below |low_kbps|. |
| 50 rate_profile.frame_index_rate_update[1] = kForemanNumFrames + 1; |
| 51 rate_profile.num_frames = kForemanNumFrames; |
| 52 |
| 53 // The thresholds below may have to be tweaked to let even poor MediaCodec |
| 54 // implementations pass. If this test fails on the bots, disable it and |
| 55 // ping brandtr@. |
| 56 std::vector<RateControlThresholds> rc_thresholds; |
| 57 AddRateControlThresholds(5, 95, 20, 10, 10, 0, 1, &rc_thresholds); |
| 58 |
| 59 QualityThresholds quality_thresholds(30.0, 15.0, 0.90, 0.40); |
| 60 |
| 61 ProcessFramesAndMaybeVerify(rate_profile, &rc_thresholds, &quality_thresholds, |
| 62 kNoVisualizationParams); |
| 63 } |
| 64 |
| 65 TEST_F(VideoProcessorIntegrationTestMediaCodec, |
| 66 Foreman240p100kbpsMediaCodecVp8WithForcedSwFallback) { |
| 67 ScopedFieldTrials override_field_trials( |
| 68 "WebRTC-VP8-Forced-Fallback-Encoder/Enabled-150,175,10000,1/"); |
| 69 |
| 70 config_.filename = "foreman_320x240"; |
| 71 config_.input_filename = ResourcePath(config_.filename, "yuv"); |
| 72 config_.sw_fallback_encoder = true; |
| 73 SetCodecSettings(&config_, kVideoCodecVP8, 1, false, false, false, false, |
| 74 false, 320, 240); |
| 75 |
| 76 RateProfile rate_profile; |
| 77 SetRateProfile(&rate_profile, 0, 100, 10, 0); // Start below |low_kbps|. |
| 78 SetRateProfile(&rate_profile, 1, 100, 10, 80); // Fallback in this bucket. |
| 79 SetRateProfile(&rate_profile, 2, 200, 10, 200); // Switch back here. |
| 80 rate_profile.frame_index_rate_update[3] = kForemanNumFrames + 1; |
| 81 rate_profile.num_frames = kForemanNumFrames; |
| 82 |
| 83 // The thresholds below may have to be tweaked to let even poor MediaCodec |
| 84 // implementations pass. If this test fails on the bots, disable it and |
| 85 // ping brandtr@. |
| 86 std::vector<RateControlThresholds> rc_thresholds; |
| 87 AddRateControlThresholds(0, 50, 75, 70, 10, 0, 1, &rc_thresholds); |
| 88 AddRateControlThresholds(0, 50, 25, 12, 60, 0, 1, &rc_thresholds); |
| 89 AddRateControlThresholds(0, 65, 15, 5, 5, 0, 1, &rc_thresholds); |
| 90 |
| 91 QualityThresholds quality_thresholds(33.0, 30.0, 0.90, 0.85); |
| 92 |
| 93 ProcessFramesAndMaybeVerify(rate_profile, &rc_thresholds, &quality_thresholds, |
| 94 kNoVisualizationParams); |
| 95 } |
| 96 |
| 97 #endif // defined(WEBRTC_ANDROID) |
| 98 |
| 99 } // namespace test |
| 100 } // namespace webrtc |
OLD | NEW |