OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 #include "webrtc/video/video_quality_test.h" | 10 #include "webrtc/video/video_quality_test.h" |
(...skipping 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1336 const size_t kWidth = 1850; | 1336 const size_t kWidth = 1850; |
1337 const size_t kHeight = 1110; | 1337 const size_t kHeight = 1110; |
1338 std::vector<std::string> slides; | 1338 std::vector<std::string> slides; |
1339 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | 1339 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
1340 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); | 1340 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
1341 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); | 1341 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
1342 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); | 1342 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
1343 | 1343 |
1344 if (params_.screenshare.scroll_duration == 0) { | 1344 if (params_.screenshare.scroll_duration == 0) { |
1345 // Cycle image every slide_change_interval seconds. | 1345 // Cycle image every slide_change_interval seconds. |
1346 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile( | 1346 frame_generator_ = test::FrameGenerator::CreateFromYuvFile( |
1347 slides, kWidth, kHeight, | 1347 slides, kWidth, kHeight, |
1348 params_.screenshare.slide_change_interval * params_.video.fps)); | 1348 params_.screenshare.slide_change_interval * params_.video.fps); |
1349 } else { | 1349 } else { |
1350 RTC_CHECK_LE(params_.video.width, kWidth); | 1350 RTC_CHECK_LE(params_.video.width, kWidth); |
1351 RTC_CHECK_LE(params_.video.height, kHeight); | 1351 RTC_CHECK_LE(params_.video.height, kHeight); |
1352 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); | 1352 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); |
1353 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - | 1353 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - |
1354 params_.screenshare.scroll_duration) * | 1354 params_.screenshare.scroll_duration) * |
1355 1000; | 1355 1000; |
1356 RTC_CHECK_LE(params_.screenshare.scroll_duration, | 1356 RTC_CHECK_LE(params_.screenshare.scroll_duration, |
1357 params_.screenshare.slide_change_interval); | 1357 params_.screenshare.slide_change_interval); |
1358 | 1358 |
1359 frame_generator_.reset( | 1359 frame_generator_ = test::FrameGenerator::CreateScrollingInputFromYuvFiles( |
1360 test::FrameGenerator::CreateScrollingInputFromYuvFiles( | 1360 clock_, slides, kWidth, kHeight, params_.video.width, |
1361 clock_, slides, kWidth, kHeight, params_.video.width, | 1361 params_.video.height, params_.screenshare.scroll_duration * 1000, |
1362 params_.video.height, params_.screenshare.scroll_duration * 1000, | 1362 kPauseDurationMs); |
1363 kPauseDurationMs)); | |
1364 } | 1363 } |
1365 } else if (params_.ss.num_spatial_layers > 1) { // For non-screenshare case. | 1364 } else if (params_.ss.num_spatial_layers > 1) { // For non-screenshare case. |
1366 RTC_CHECK(params_.video.codec == "VP9"); | 1365 RTC_CHECK(params_.video.codec == "VP9"); |
1367 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1366 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
1368 vp9_settings.numberOfTemporalLayers = | 1367 vp9_settings.numberOfTemporalLayers = |
1369 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1368 static_cast<unsigned char>(params_.video.num_temporal_layers); |
1370 vp9_settings.numberOfSpatialLayers = | 1369 vp9_settings.numberOfSpatialLayers = |
1371 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1370 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
1372 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1371 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
1373 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1372 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
1374 } | 1373 } |
1375 } | 1374 } |
1376 | 1375 |
1377 void VideoQualityTest::CreateCapturer() { | 1376 void VideoQualityTest::CreateCapturer() { |
1378 if (params_.screenshare.enabled) { | 1377 if (params_.screenshare.enabled) { |
1379 test::FrameGeneratorCapturer* frame_generator_capturer = | 1378 test::FrameGeneratorCapturer* frame_generator_capturer = |
1380 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), | 1379 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
1381 params_.video.fps); | 1380 params_.video.fps); |
1382 EXPECT_TRUE(frame_generator_capturer->Init()); | 1381 EXPECT_TRUE(frame_generator_capturer->Init()); |
1383 video_capturer_.reset(frame_generator_capturer); | 1382 video_capturer_.reset(frame_generator_capturer); |
1384 } else { | 1383 } else { |
1385 if (params_.video.clip_name.empty()) { | 1384 if (params_.video.clip_name.empty()) { |
1386 video_capturer_.reset(test::VcmCapturer::Create( | 1385 video_capturer_.reset(test::VcmCapturer::Create( |
1387 params_.video.width, params_.video.height, params_.video.fps)); | 1386 params_.video.width, params_.video.height, params_.video.fps)); |
1388 if (!video_capturer_) { | 1387 if (!video_capturer_) { |
1389 // Failed to get actual camera, use chroma generator as backup. | 1388 // Failed to get actual camera, use chroma generator as backup. |
1390 video_capturer_.reset(test::FrameGeneratorCapturer::Create( | 1389 video_capturer_.reset(test::FrameGeneratorCapturer::Create( |
1391 params_.video.width, params_.video.height, params_.video.fps, | 1390 static_cast<int>(params_.video.width), |
1392 clock_)); | 1391 static_cast<int>(params_.video.height), params_.video.fps, clock_)); |
1393 } | 1392 } |
1394 } else { | 1393 } else { |
1395 video_capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( | 1394 video_capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( |
1396 test::ResourcePath(params_.video.clip_name, "yuv"), | 1395 test::ResourcePath(params_.video.clip_name, "yuv"), |
1397 params_.video.width, params_.video.height, params_.video.fps, | 1396 params_.video.width, params_.video.height, params_.video.fps, |
1398 clock_)); | 1397 clock_)); |
1399 ASSERT_TRUE(video_capturer_) << "Could not create capturer for " | 1398 ASSERT_TRUE(video_capturer_) << "Could not create capturer for " |
1400 << params_.video.clip_name | 1399 << params_.video.clip_name |
1401 << ".yuv. Is this resource file present?"; | 1400 << ".yuv. Is this resource file present?"; |
1402 } | 1401 } |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1702 std::ostringstream str; | 1701 std::ostringstream str; |
1703 str << receive_logs_++; | 1702 str << receive_logs_++; |
1704 std::string path = | 1703 std::string path = |
1705 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1704 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1706 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1705 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1707 10000000); | 1706 10000000); |
1708 } | 1707 } |
1709 } | 1708 } |
1710 | 1709 |
1711 } // namespace webrtc | 1710 } // namespace webrtc |
OLD | NEW |