Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: webrtc/modules/video_coding/codecs/test/videoprocessor_integrationtest.cc

Issue 3011043002: Add VideoProcessorIntegrationTest for MediaCodec implementations. (Closed)
Patch Set: asapersson comments 1. Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } else if (codec_settings.codecType == kVideoCodecVP9) { 64 } else if (codec_settings.codecType == kVideoCodecVP9) {
65 return codec_settings.VP9().numberOfTemporalLayers; 65 return codec_settings.VP9().numberOfTemporalLayers;
66 } else { 66 } else {
67 return 1; 67 return 1;
68 } 68 }
69 } 69 }
70 70
71 } // namespace 71 } // namespace
72 72
73 VideoProcessorIntegrationTest::VideoProcessorIntegrationTest() { 73 VideoProcessorIntegrationTest::VideoProcessorIntegrationTest() {
74 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED) && \ 74 #if defined(WEBRTC_ANDROID)
75 defined(WEBRTC_ANDROID)
76 InitializeAndroidObjects(); 75 InitializeAndroidObjects();
77 #endif 76 #endif
78 } 77 }
79 78
80 VideoProcessorIntegrationTest::~VideoProcessorIntegrationTest() = default; 79 VideoProcessorIntegrationTest::~VideoProcessorIntegrationTest() = default;
81 80
82 void VideoProcessorIntegrationTest::SetCodecSettings(TestConfig* config, 81 void VideoProcessorIntegrationTest::SetCodecSettings(TestConfig* config,
83 VideoCodecType codec_type, 82 VideoCodecType codec_type,
84 int num_temporal_layers, 83 int num_temporal_layers,
85 bool error_concealment_on, 84 bool error_concealment_on,
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 268
270 // Remove analysis file. 269 // Remove analysis file.
271 if (remove(config_.output_filename.c_str()) < 0) { 270 if (remove(config_.output_filename.c_str()) < 0) {
272 fprintf(stderr, "Failed to remove temporary file!\n"); 271 fprintf(stderr, "Failed to remove temporary file!\n");
273 } 272 }
274 } 273 }
275 274
276 void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() { 275 void VideoProcessorIntegrationTest::CreateEncoderAndDecoder() {
277 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory; 276 std::unique_ptr<cricket::WebRtcVideoEncoderFactory> encoder_factory;
278 if (config_.hw_encoder) { 277 if (config_.hw_encoder) {
279 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED)
280 #if defined(WEBRTC_ANDROID) 278 #if defined(WEBRTC_ANDROID)
281 encoder_factory.reset(new jni::MediaCodecVideoEncoderFactory()); 279 encoder_factory.reset(new jni::MediaCodecVideoEncoderFactory());
282 #elif defined(WEBRTC_IOS) 280 #elif defined(WEBRTC_IOS)
283 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType) 281 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
284 << "iOS HW codecs only support H264."; 282 << "iOS HW codecs only support H264.";
285 encoder_factory = CreateObjCEncoderFactory(); 283 encoder_factory = CreateObjCEncoderFactory();
286 #else 284 #else
287 RTC_NOTREACHED() << "Only support HW encoder on Android and iOS."; 285 RTC_NOTREACHED() << "Only support HW encoder on Android and iOS.";
288 #endif 286 #endif
289 #endif // WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED
290 } else { 287 } else {
291 encoder_factory.reset(new cricket::InternalEncoderFactory()); 288 encoder_factory.reset(new cricket::InternalEncoderFactory());
292 } 289 }
293 290
294 if (config_.hw_decoder) { 291 if (config_.hw_decoder) {
295 #if defined(WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED)
296 #if defined(WEBRTC_ANDROID) 292 #if defined(WEBRTC_ANDROID)
297 decoder_factory_.reset(new jni::MediaCodecVideoDecoderFactory()); 293 decoder_factory_.reset(new jni::MediaCodecVideoDecoderFactory());
298 #elif defined(WEBRTC_IOS) 294 #elif defined(WEBRTC_IOS)
299 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType) 295 EXPECT_EQ(kVideoCodecH264, config_.codec_settings.codecType)
300 << "iOS HW codecs only support H264."; 296 << "iOS HW codecs only support H264.";
301 decoder_factory_ = CreateObjCDecoderFactory(); 297 decoder_factory_ = CreateObjCDecoderFactory();
302 #else 298 #else
303 RTC_NOTREACHED() << "Only support HW decoder on Android and iOS."; 299 RTC_NOTREACHED() << "Only support HW decoder on Android and iOS.";
304 #endif 300 #endif
305 #endif // WEBRTC_VIDEOPROCESSOR_INTEGRATIONTEST_HW_CODECS_ENABLED
306 } else { 301 } else {
307 decoder_factory_.reset(new cricket::InternalDecoderFactory()); 302 decoder_factory_.reset(new cricket::InternalDecoderFactory());
308 } 303 }
309 304
310 cricket::VideoCodec encoder_codec; 305 cricket::VideoCodec encoder_codec;
311 switch (config_.codec_settings.codecType) { 306 switch (config_.codec_settings.codecType) {
312 case kVideoCodecVP8: 307 case kVideoCodecVP8:
313 encoder_codec = cricket::VideoCodec(cricket::kVp8CodecName); 308 encoder_codec = cricket::VideoCodec(cricket::kVp8CodecName);
314 encoder_.reset(encoder_factory->CreateVideoEncoder(encoder_codec)); 309 encoder_.reset(encoder_factory->CreateVideoEncoder(encoder_codec));
315 decoder_ = decoder_factory_->CreateVideoDecoder(kVideoCodecVP8); 310 decoder_ = decoder_factory_->CreateVideoDecoder(kVideoCodecVP8);
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 perc_encoding_rate_mismatch_ = 0.0f; 643 perc_encoding_rate_mismatch_ = 0.0f;
649 num_frames_to_hit_target_ = 644 num_frames_to_hit_target_ =
650 rate_profile.frame_index_rate_update[rate_update_index + 1]; 645 rate_profile.frame_index_rate_update[rate_update_index + 1];
651 encoding_rate_within_target_ = false; 646 encoding_rate_within_target_ = false;
652 sum_key_frame_size_mismatch_ = 0.0; 647 sum_key_frame_size_mismatch_ = 0.0;
653 num_key_frames_ = 0; 648 num_key_frames_ = 0;
654 } 649 }
655 650
656 } // namespace test 651 } // namespace test
657 } // namespace webrtc 652 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698