| 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 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1238 const size_t kWidth = 1850; | 1238 const size_t kWidth = 1850; |
| 1239 const size_t kHeight = 1110; | 1239 const size_t kHeight = 1110; |
| 1240 std::vector<std::string> slides; | 1240 std::vector<std::string> slides; |
| 1241 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); | 1241 slides.push_back(test::ResourcePath("web_screenshot_1850_1110", "yuv")); |
| 1242 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); | 1242 slides.push_back(test::ResourcePath("presentation_1850_1110", "yuv")); |
| 1243 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); | 1243 slides.push_back(test::ResourcePath("photo_1850_1110", "yuv")); |
| 1244 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); | 1244 slides.push_back(test::ResourcePath("difficult_photo_1850_1110", "yuv")); |
| 1245 | 1245 |
| 1246 if (params_.screenshare.scroll_duration == 0) { | 1246 if (params_.screenshare.scroll_duration == 0) { |
| 1247 // Cycle image every slide_change_interval seconds. | 1247 // Cycle image every slide_change_interval seconds. |
| 1248 frame_generator_.reset(test::FrameGenerator::CreateFromYuvFile( | 1248 frame_generator_ = test::FrameGenerator::CreateFromYuvFile( |
| 1249 slides, kWidth, kHeight, | 1249 slides, kWidth, kHeight, |
| 1250 params_.screenshare.slide_change_interval * params_.video.fps)); | 1250 params_.screenshare.slide_change_interval * params_.video.fps); |
| 1251 } else { | 1251 } else { |
| 1252 RTC_CHECK_LE(params_.video.width, kWidth); | 1252 RTC_CHECK_LE(params_.video.width, kWidth); |
| 1253 RTC_CHECK_LE(params_.video.height, kHeight); | 1253 RTC_CHECK_LE(params_.video.height, kHeight); |
| 1254 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); | 1254 RTC_CHECK_GT(params_.screenshare.slide_change_interval, 0); |
| 1255 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - | 1255 const int kPauseDurationMs = (params_.screenshare.slide_change_interval - |
| 1256 params_.screenshare.scroll_duration) * | 1256 params_.screenshare.scroll_duration) * |
| 1257 1000; | 1257 1000; |
| 1258 RTC_CHECK_LE(params_.screenshare.scroll_duration, | 1258 RTC_CHECK_LE(params_.screenshare.scroll_duration, |
| 1259 params_.screenshare.slide_change_interval); | 1259 params_.screenshare.slide_change_interval); |
| 1260 | 1260 |
| 1261 frame_generator_.reset( | 1261 frame_generator_ = test::FrameGenerator::CreateScrollingInputFromYuvFiles( |
| 1262 test::FrameGenerator::CreateScrollingInputFromYuvFiles( | 1262 clock_, slides, kWidth, kHeight, params_.video.width, |
| 1263 clock_, slides, kWidth, kHeight, params_.video.width, | 1263 params_.video.height, params_.screenshare.scroll_duration * 1000, |
| 1264 params_.video.height, params_.screenshare.scroll_duration * 1000, | 1264 kPauseDurationMs); |
| 1265 kPauseDurationMs)); | |
| 1266 } | 1265 } |
| 1267 } else if (params_.ss.num_spatial_layers > 1) { // For non-screenshare case. | 1266 } else if (params_.ss.num_spatial_layers > 1) { // For non-screenshare case. |
| 1268 RTC_CHECK(params_.video.codec == "VP9"); | 1267 RTC_CHECK(params_.video.codec == "VP9"); |
| 1269 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1268 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
| 1270 vp9_settings.numberOfTemporalLayers = | 1269 vp9_settings.numberOfTemporalLayers = |
| 1271 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1270 static_cast<unsigned char>(params_.video.num_temporal_layers); |
| 1272 vp9_settings.numberOfSpatialLayers = | 1271 vp9_settings.numberOfSpatialLayers = |
| 1273 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1272 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
| 1274 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1273 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
| 1275 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1274 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
| 1276 } | 1275 } |
| 1277 } | 1276 } |
| 1278 | 1277 |
| 1279 void VideoQualityTest::CreateCapturer() { | 1278 void VideoQualityTest::CreateCapturer() { |
| 1280 if (params_.screenshare.enabled) { | 1279 if (params_.screenshare.enabled) { |
| 1281 test::FrameGeneratorCapturer* frame_generator_capturer = | 1280 test::FrameGeneratorCapturer* frame_generator_capturer = |
| 1282 new test::FrameGeneratorCapturer(clock_, frame_generator_.release(), | 1281 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
| 1283 params_.video.fps); | 1282 params_.video.fps); |
| 1284 EXPECT_TRUE(frame_generator_capturer->Init()); | 1283 EXPECT_TRUE(frame_generator_capturer->Init()); |
| 1285 video_capturer_.reset(frame_generator_capturer); | 1284 video_capturer_.reset(frame_generator_capturer); |
| 1286 } else { | 1285 } else { |
| 1287 if (params_.video.clip_name.empty()) { | 1286 if (params_.video.clip_name.empty()) { |
| 1288 video_capturer_.reset(test::VcmCapturer::Create( | 1287 video_capturer_.reset(test::VcmCapturer::Create( |
| 1289 params_.video.width, params_.video.height, params_.video.fps)); | 1288 params_.video.width, params_.video.height, params_.video.fps)); |
| 1290 if (!video_capturer_) { | 1289 if (!video_capturer_) { |
| 1291 // Failed to get actual camera, use chroma generator as backup. | 1290 // Failed to get actual camera, use chroma generator as backup. |
| 1292 video_capturer_.reset(test::FrameGeneratorCapturer::Create( | 1291 video_capturer_.reset(test::FrameGeneratorCapturer::Create( |
| 1293 params_.video.width, params_.video.height, params_.video.fps, | 1292 static_cast<int>(params_.video.width), |
| 1294 clock_)); | 1293 static_cast<int>(params_.video.height), params_.video.fps, clock_)); |
| 1295 } | 1294 } |
| 1296 } else { | 1295 } else { |
| 1297 video_capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( | 1296 video_capturer_.reset(test::FrameGeneratorCapturer::CreateFromYuvFile( |
| 1298 test::ResourcePath(params_.video.clip_name, "yuv"), | 1297 test::ResourcePath(params_.video.clip_name, "yuv"), |
| 1299 params_.video.width, params_.video.height, params_.video.fps, | 1298 params_.video.width, params_.video.height, params_.video.fps, |
| 1300 clock_)); | 1299 clock_)); |
| 1301 ASSERT_TRUE(video_capturer_) << "Could not create capturer for " | 1300 ASSERT_TRUE(video_capturer_) << "Could not create capturer for " |
| 1302 << params_.video.clip_name | 1301 << params_.video.clip_name |
| 1303 << ".yuv. Is this resource file present?"; | 1302 << ".yuv. Is this resource file present?"; |
| 1304 } | 1303 } |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 std::ostringstream str; | 1603 std::ostringstream str; |
| 1605 str << receive_logs_++; | 1604 str << receive_logs_++; |
| 1606 std::string path = | 1605 std::string path = |
| 1607 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1606 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1608 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1607 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1609 10000000); | 1608 10000000); |
| 1610 } | 1609 } |
| 1611 } | 1610 } |
| 1612 | 1611 |
| 1613 } // namespace webrtc | 1612 } // namespace webrtc |
| OLD | NEW |