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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 constexpr int kSendStatsPollingIntervalMs = 1000; | 51 constexpr int kSendStatsPollingIntervalMs = 1000; |
52 constexpr int kPayloadTypeH264 = 122; | 52 constexpr int kPayloadTypeH264 = 122; |
53 constexpr int kPayloadTypeVP8 = 123; | 53 constexpr int kPayloadTypeVP8 = 123; |
54 constexpr int kPayloadTypeVP9 = 124; | 54 constexpr int kPayloadTypeVP9 = 124; |
55 constexpr size_t kMaxComparisons = 10; | 55 constexpr size_t kMaxComparisons = 10; |
56 constexpr char kSyncGroup[] = "av_sync"; | 56 constexpr char kSyncGroup[] = "av_sync"; |
57 constexpr int kOpusMinBitrateBps = 6000; | 57 constexpr int kOpusMinBitrateBps = 6000; |
58 constexpr int kOpusBitrateFbBps = 32000; | 58 constexpr int kOpusBitrateFbBps = 32000; |
59 constexpr int kFramesSentInQuickTest = 1; | 59 constexpr int kFramesSentInQuickTest = 1; |
| 60 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; |
| 61 constexpr uint32_t kThumbnailRtxSsrcStart = 0xF0000; |
60 | 62 |
61 struct VoiceEngineState { | 63 struct VoiceEngineState { |
62 VoiceEngineState() | 64 VoiceEngineState() |
63 : voice_engine(nullptr), | 65 : voice_engine(nullptr), |
64 base(nullptr), | 66 base(nullptr), |
65 send_channel_id(-1), | 67 send_channel_id(-1), |
66 receive_channel_id(-1) {} | 68 receive_channel_id(-1) {} |
67 | 69 |
68 webrtc::VoiceEngine* voice_engine; | 70 webrtc::VoiceEngine* voice_engine; |
69 webrtc::VoEBase* base; | 71 webrtc::VoEBase* base; |
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1023 | 1025 |
1024 VideoQualityTest::Params::Params() | 1026 VideoQualityTest::Params::Params() |
1025 : call({false, Call::Config::BitrateConfig()}), | 1027 : call({false, Call::Config::BitrateConfig()}), |
1026 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, | 1028 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, |
1027 false, "", ""}), | 1029 false, "", ""}), |
1028 audio({false, false}), | 1030 audio({false, false}), |
1029 screenshare({false, 10, 0}), | 1031 screenshare({false, 10, 0}), |
1030 analyzer({"", 0.0, 0.0, 0, "", ""}), | 1032 analyzer({"", 0.0, 0.0, 0, "", ""}), |
1031 pipe(), | 1033 pipe(), |
1032 logs(false), | 1034 logs(false), |
1033 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}) {} | 1035 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}), |
| 1036 num_thumbnails(0) {} |
1034 | 1037 |
1035 VideoQualityTest::Params::~Params() = default; | 1038 VideoQualityTest::Params::~Params() = default; |
1036 | 1039 |
1037 void VideoQualityTest::TestBody() {} | 1040 void VideoQualityTest::TestBody() {} |
1038 | 1041 |
1039 std::string VideoQualityTest::GenerateGraphTitle() const { | 1042 std::string VideoQualityTest::GenerateGraphTitle() const { |
1040 std::stringstream ss; | 1043 std::stringstream ss; |
1041 ss << params_.video.codec; | 1044 ss << params_.video.codec; |
1042 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps"; | 1045 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps"; |
1043 ss << ", " << params_.video.fps << " FPS"; | 1046 ss << ", " << params_.video.fps << " FPS"; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); | 1094 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); |
1092 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); | 1095 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); |
1093 RTC_CHECK(params_.ss.spatial_layers.empty() || | 1096 RTC_CHECK(params_.ss.spatial_layers.empty() || |
1094 params_.ss.spatial_layers.size() == | 1097 params_.ss.spatial_layers.size() == |
1095 static_cast<size_t>(params_.ss.num_spatial_layers)); | 1098 static_cast<size_t>(params_.ss.num_spatial_layers)); |
1096 if (params_.video.codec == "VP8") { | 1099 if (params_.video.codec == "VP8") { |
1097 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); | 1100 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); |
1098 } else if (params_.video.codec == "VP9") { | 1101 } else if (params_.video.codec == "VP9") { |
1099 RTC_CHECK_EQ(params_.ss.streams.size(), 1); | 1102 RTC_CHECK_EQ(params_.ss.streams.size(), 1); |
1100 } | 1103 } |
| 1104 RTC_CHECK_GE(params_.num_thumbnails, 0); |
| 1105 if (params_.num_thumbnails > 0) { |
| 1106 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); |
| 1107 RTC_CHECK_EQ(params_.ss.streams.size(), 3); |
| 1108 RTC_CHECK_EQ(params_.video.num_temporal_layers, 3); |
| 1109 RTC_CHECK_EQ(params_.video.codec, "VP8"); |
| 1110 } |
1101 } | 1111 } |
1102 | 1112 |
1103 // Static. | 1113 // Static. |
1104 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { | 1114 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { |
1105 // Parse comma separated nonnegative integers, where some elements may be | 1115 // Parse comma separated nonnegative integers, where some elements may be |
1106 // empty. The empty values are replaced with -1. | 1116 // empty. The empty values are replaced with -1. |
1107 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40} | 1117 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40} |
1108 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1} | 1118 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1} |
1109 std::vector<int> result; | 1119 std::vector<int> result; |
1110 if (str.empty()) | 1120 if (str.empty()) |
(...skipping 20 matching lines...) Expand all Loading... |
1131 // Static. | 1141 // Static. |
1132 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { | 1142 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { |
1133 VideoStream stream; | 1143 VideoStream stream; |
1134 stream.width = params.video.width; | 1144 stream.width = params.video.width; |
1135 stream.height = params.video.height; | 1145 stream.height = params.video.height; |
1136 stream.max_framerate = params.video.fps; | 1146 stream.max_framerate = params.video.fps; |
1137 stream.min_bitrate_bps = params.video.min_bitrate_bps; | 1147 stream.min_bitrate_bps = params.video.min_bitrate_bps; |
1138 stream.target_bitrate_bps = params.video.target_bitrate_bps; | 1148 stream.target_bitrate_bps = params.video.target_bitrate_bps; |
1139 stream.max_bitrate_bps = params.video.max_bitrate_bps; | 1149 stream.max_bitrate_bps = params.video.max_bitrate_bps; |
1140 stream.max_qp = 52; | 1150 stream.max_qp = 52; |
1141 if (params.video.num_temporal_layers == 2) | 1151 if (params.video.num_temporal_layers == 2) { |
1142 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); | 1152 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); |
| 1153 } else if (params.video.num_temporal_layers == 3) { |
| 1154 stream.temporal_layer_thresholds_bps.push_back(stream.max_bitrate_bps / 4); |
| 1155 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); |
| 1156 } |
1143 return stream; | 1157 return stream; |
1144 } | 1158 } |
1145 | 1159 |
| 1160 // Static. |
| 1161 VideoStream VideoQualityTest::DefaultThumbnailStream() { |
| 1162 VideoStream stream; |
| 1163 stream.width = 320; |
| 1164 stream.height = 180; |
| 1165 stream.max_framerate = 7; |
| 1166 stream.min_bitrate_bps = 7500; |
| 1167 stream.target_bitrate_bps = 37500; |
| 1168 stream.max_bitrate_bps = 50000; |
| 1169 stream.max_qp = 52; |
| 1170 return stream; |
| 1171 } |
| 1172 |
1146 // Static. | 1173 // Static. |
1147 void VideoQualityTest::FillScalabilitySettings( | 1174 void VideoQualityTest::FillScalabilitySettings( |
1148 Params* params, | 1175 Params* params, |
1149 const std::vector<std::string>& stream_descriptors, | 1176 const std::vector<std::string>& stream_descriptors, |
1150 size_t selected_stream, | 1177 size_t selected_stream, |
1151 int num_spatial_layers, | 1178 int num_spatial_layers, |
1152 int selected_sl, | 1179 int selected_sl, |
1153 const std::vector<std::string>& sl_descriptors) { | 1180 const std::vector<std::string>& sl_descriptors) { |
1154 // Read VideoStream and SpatialLayer elements from a list of comma separated | 1181 // Read VideoStream and SpatialLayer elements from a list of comma separated |
1155 // lists. To use a default value for an element, use -1 or leave empty. | 1182 // lists. To use a default value for an element, use -1 or leave empty. |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1320 video_send_config_.rtp.ulpfec.red_payload_type; | 1347 video_send_config_.rtp.ulpfec.red_payload_type; |
1321 video_receive_configs_[params_.ss.selected_stream] | 1348 video_receive_configs_[params_.ss.selected_stream] |
1322 .rtp.ulpfec.ulpfec_payload_type = | 1349 .rtp.ulpfec.ulpfec_payload_type = |
1323 video_send_config_.rtp.ulpfec.ulpfec_payload_type; | 1350 video_send_config_.rtp.ulpfec.ulpfec_payload_type; |
1324 video_receive_configs_[params_.ss.selected_stream] | 1351 video_receive_configs_[params_.ss.selected_stream] |
1325 .rtp.ulpfec.red_rtx_payload_type = | 1352 .rtp.ulpfec.red_rtx_payload_type = |
1326 video_send_config_.rtp.ulpfec.red_rtx_payload_type; | 1353 video_send_config_.rtp.ulpfec.red_rtx_payload_type; |
1327 } | 1354 } |
1328 } | 1355 } |
1329 | 1356 |
| 1357 void VideoQualityTest::SetupThumbnails(Transport* send_transport, |
| 1358 Transport* recv_transport) { |
| 1359 for (int i = 0; i < params_.num_thumbnails; ++i) { |
| 1360 thumbnail_encoders_.emplace_back(VP8Encoder::Create()); |
| 1361 |
| 1362 // Thumbnails will be send in the other way: from receiver_call to |
| 1363 // sender_call. |
| 1364 VideoSendStream::Config thumbnail_send_config(recv_transport); |
| 1365 thumbnail_send_config.rtp.ssrcs.push_back(kThumbnailSendSsrcStart + i); |
| 1366 thumbnail_send_config.encoder_settings.encoder = |
| 1367 thumbnail_encoders_.back().get(); |
| 1368 thumbnail_send_config.encoder_settings.payload_name = params_.video.codec; |
| 1369 thumbnail_send_config.encoder_settings.payload_type = kPayloadTypeVP8; |
| 1370 thumbnail_send_config.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1371 thumbnail_send_config.rtp.rtx.payload_type = kSendRtxPayloadType; |
| 1372 thumbnail_send_config.rtp.rtx.ssrcs.push_back(kThumbnailRtxSsrcStart + i); |
| 1373 thumbnail_send_config.rtp.extensions.clear(); |
| 1374 if (params_.call.send_side_bwe) { |
| 1375 thumbnail_send_config.rtp.extensions.push_back( |
| 1376 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
| 1377 test::kTransportSequenceNumberExtensionId)); |
| 1378 } else { |
| 1379 thumbnail_send_config.rtp.extensions.push_back(RtpExtension( |
| 1380 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); |
| 1381 } |
| 1382 |
| 1383 VideoEncoderConfig thumbnail_encoder_config; |
| 1384 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500; |
| 1385 thumbnail_send_config.suspend_below_min_bitrate = |
| 1386 params_.video.suspend_below_min_bitrate; |
| 1387 thumbnail_encoder_config.number_of_streams = 1; |
| 1388 thumbnail_encoder_config.max_bitrate_bps = 50000; |
| 1389 thumbnail_encoder_config.video_stream_factory = |
| 1390 new rtc::RefCountedObject<VideoStreamFactory>( |
| 1391 std::vector<webrtc::VideoStream>{DefaultThumbnailStream()}); |
| 1392 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers; |
| 1393 |
| 1394 VideoReceiveStream::Config thumbnail_receive_config(send_transport); |
| 1395 thumbnail_receive_config.rtp.remb = false; |
| 1396 thumbnail_receive_config.rtp.transport_cc = true; |
| 1397 thumbnail_receive_config.rtp.local_ssrc = kReceiverLocalVideoSsrc; |
| 1398 for (const RtpExtension& extension : thumbnail_send_config.rtp.extensions) |
| 1399 thumbnail_receive_config.rtp.extensions.push_back(extension); |
| 1400 thumbnail_receive_config.renderer = &fake_renderer_; |
| 1401 |
| 1402 VideoReceiveStream::Decoder decoder = |
| 1403 test::CreateMatchingDecoder(thumbnail_send_config.encoder_settings); |
| 1404 allocated_decoders_.push_back( |
| 1405 std::unique_ptr<VideoDecoder>(decoder.decoder)); |
| 1406 thumbnail_receive_config.decoders.clear(); |
| 1407 thumbnail_receive_config.decoders.push_back(decoder); |
| 1408 thumbnail_receive_config.rtp.remote_ssrc = |
| 1409 thumbnail_send_config.rtp.ssrcs[0]; |
| 1410 |
| 1411 thumbnail_receive_config.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1412 thumbnail_receive_config.rtp.rtx_ssrc = kThumbnailRtxSsrcStart + i; |
| 1413 thumbnail_receive_config.rtp.rtx_payload_types[kPayloadTypeVP8] = |
| 1414 kSendRtxPayloadType; |
| 1415 thumbnail_receive_config.rtp.transport_cc = params_.call.send_side_bwe; |
| 1416 thumbnail_receive_config.rtp.remb = !params_.call.send_side_bwe; |
| 1417 |
| 1418 thumbnail_encoder_configs_.push_back(thumbnail_encoder_config.Copy()); |
| 1419 thumbnail_send_configs_.push_back(thumbnail_send_config.Copy()); |
| 1420 thumbnail_receive_configs_.push_back(thumbnail_receive_config.Copy()); |
| 1421 } |
| 1422 |
| 1423 for (int i = 0; i < params_.num_thumbnails; ++i) { |
| 1424 thumbnail_send_streams_.push_back(receiver_call_->CreateVideoSendStream( |
| 1425 thumbnail_send_configs_[i].Copy(), |
| 1426 thumbnail_encoder_configs_[i].Copy())); |
| 1427 thumbnail_receive_streams_.push_back(sender_call_->CreateVideoReceiveStream( |
| 1428 thumbnail_receive_configs_[i].Copy())); |
| 1429 } |
| 1430 } |
| 1431 |
| 1432 void VideoQualityTest::DestroyThumbnailStreams() { |
| 1433 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1434 receiver_call_->DestroyVideoSendStream(thumbnail_send_stream); |
| 1435 thumbnail_send_streams_.clear(); |
| 1436 for (VideoReceiveStream* thumbnail_receive_stream : |
| 1437 thumbnail_receive_streams_) |
| 1438 sender_call_->DestroyVideoReceiveStream(thumbnail_receive_stream); |
| 1439 thumbnail_send_streams_.clear(); |
| 1440 thumbnail_receive_streams_.clear(); |
| 1441 } |
| 1442 |
1330 void VideoQualityTest::SetupScreenshareOrSVC() { | 1443 void VideoQualityTest::SetupScreenshareOrSVC() { |
1331 if (params_.screenshare.enabled) { | 1444 if (params_.screenshare.enabled) { |
1332 // Fill out codec settings. | 1445 // Fill out codec settings. |
1333 video_encoder_config_.content_type = | 1446 video_encoder_config_.content_type = |
1334 VideoEncoderConfig::ContentType::kScreen; | 1447 VideoEncoderConfig::ContentType::kScreen; |
1335 degradation_preference_ = | 1448 degradation_preference_ = |
1336 VideoSendStream::DegradationPreference::kMaintainResolution; | 1449 VideoSendStream::DegradationPreference::kMaintainResolution; |
1337 if (params_.video.codec == "VP8") { | 1450 if (params_.video.codec == "VP8") { |
1338 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 1451 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
1339 vp8_settings.denoisingOn = false; | 1452 vp8_settings.denoisingOn = false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1389 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1502 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
1390 vp9_settings.numberOfTemporalLayers = | 1503 vp9_settings.numberOfTemporalLayers = |
1391 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1504 static_cast<unsigned char>(params_.video.num_temporal_layers); |
1392 vp9_settings.numberOfSpatialLayers = | 1505 vp9_settings.numberOfSpatialLayers = |
1393 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1506 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
1394 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1507 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
1395 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1508 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
1396 } | 1509 } |
1397 } | 1510 } |
1398 | 1511 |
| 1512 void VideoQualityTest::SetupThumbnailCapturers(size_t num_thumbnail_streams) { |
| 1513 VideoStream thumbnail = DefaultThumbnailStream(); |
| 1514 for (size_t i = 0; i < num_thumbnail_streams; ++i) { |
| 1515 thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create( |
| 1516 static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height), |
| 1517 thumbnail.max_framerate, clock_)); |
| 1518 } |
| 1519 } |
| 1520 |
1399 void VideoQualityTest::CreateCapturer() { | 1521 void VideoQualityTest::CreateCapturer() { |
1400 if (params_.screenshare.enabled) { | 1522 if (params_.screenshare.enabled) { |
1401 test::FrameGeneratorCapturer* frame_generator_capturer = | 1523 test::FrameGeneratorCapturer* frame_generator_capturer = |
1402 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), | 1524 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
1403 params_.video.fps); | 1525 params_.video.fps); |
1404 EXPECT_TRUE(frame_generator_capturer->Init()); | 1526 EXPECT_TRUE(frame_generator_capturer->Init()); |
1405 video_capturer_.reset(frame_generator_capturer); | 1527 video_capturer_.reset(frame_generator_capturer); |
1406 } else { | 1528 } else { |
1407 if (params_.video.clip_name.empty()) { | 1529 if (params_.video.clip_name.empty()) { |
1408 video_capturer_.reset(test::VcmCapturer::Create( | 1530 video_capturer_.reset(test::VcmCapturer::Create( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1450 | 1572 |
1451 test::LayerFilteringTransport send_transport( | 1573 test::LayerFilteringTransport send_transport( |
1452 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1574 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1453 params_.video.selected_tl, params_.ss.selected_sl); | 1575 params_.video.selected_tl, params_.ss.selected_sl); |
1454 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); | 1576 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); |
1455 | 1577 |
1456 std::string graph_title = params_.analyzer.graph_title; | 1578 std::string graph_title = params_.analyzer.graph_title; |
1457 if (graph_title.empty()) | 1579 if (graph_title.empty()) |
1458 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1580 graph_title = VideoQualityTest::GenerateGraphTitle(); |
1459 | 1581 |
1460 // In the case of different resolutions, the functions calculating PSNR and | |
1461 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer | |
1462 // aborts if the average psnr/ssim are below the given threshold, which is | |
1463 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary | |
1464 // abort. | |
1465 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; | 1582 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; |
1466 | 1583 |
1467 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); | 1584 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); |
1468 VideoAnalyzer analyzer( | 1585 VideoAnalyzer analyzer( |
1469 &send_transport, params_.analyzer.test_label, | 1586 &send_transport, params_.analyzer.test_label, |
1470 | |
1471 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1587 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1472 is_quick_test_enabled | 1588 is_quick_test_enabled |
1473 ? kFramesSentInQuickTest | 1589 ? kFramesSentInQuickTest |
1474 : params_.analyzer.test_durations_secs * params_.video.fps, | 1590 : params_.analyzer.test_durations_secs * params_.video.fps, |
1475 graph_data_output_file, graph_title, | 1591 graph_data_output_file, graph_title, |
1476 kVideoSendSsrcs[params_.ss.selected_stream], | 1592 kVideoSendSsrcs[params_.ss.selected_stream], |
1477 kSendRtxSsrcs[params_.ss.selected_stream], | 1593 kSendRtxSsrcs[params_.ss.selected_stream], |
1478 static_cast<uint32_t>(selected_stream.width), | 1594 static_cast<uint32_t>(selected_stream.width), |
1479 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, | 1595 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, |
1480 params_.video.selected_tl, is_quick_test_enabled); | 1596 params_.video.selected_tl, is_quick_test_enabled); |
1481 analyzer.SetReceiver(receiver_call_->Receiver()); | 1597 analyzer.SetReceiver(receiver_call_->Receiver()); |
1482 send_transport.SetReceiver(&analyzer); | 1598 send_transport.SetReceiver(&analyzer); |
1483 recv_transport.SetReceiver(sender_call_->Receiver()); | 1599 recv_transport.SetReceiver(sender_call_->Receiver()); |
1484 | 1600 |
1485 SetupVideo(&analyzer, &recv_transport); | 1601 SetupVideo(&analyzer, &recv_transport); |
| 1602 SetupThumbnails(&analyzer, &recv_transport); |
1486 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1603 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1487 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1604 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1488 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1605 RTC_DCHECK(!video_send_config_.post_encode_callback); |
1489 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1606 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1490 | 1607 |
1491 SetupScreenshareOrSVC(); | 1608 SetupScreenshareOrSVC(); |
1492 | 1609 |
1493 CreateFlexfecStreams(); | 1610 CreateFlexfecStreams(); |
1494 CreateVideoStreams(); | 1611 CreateVideoStreams(); |
1495 analyzer.SetSendStream(video_send_stream_); | 1612 analyzer.SetSendStream(video_send_stream_); |
1496 if (video_receive_streams_.size() == 1) | 1613 if (video_receive_streams_.size() == 1) |
1497 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1614 analyzer.SetReceiveStream(video_receive_streams_[0]); |
1498 | 1615 |
1499 video_send_stream_->SetSource(analyzer.OutputInterface(), | 1616 video_send_stream_->SetSource(analyzer.OutputInterface(), |
1500 degradation_preference_); | 1617 degradation_preference_); |
1501 | 1618 |
| 1619 SetupThumbnailCapturers(params_.num_thumbnails); |
| 1620 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { |
| 1621 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), |
| 1622 degradation_preference_); |
| 1623 } |
| 1624 |
1502 CreateCapturer(); | 1625 CreateCapturer(); |
| 1626 |
1503 rtc::VideoSinkWants wants; | 1627 rtc::VideoSinkWants wants; |
1504 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | 1628 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); |
1505 | 1629 |
1506 StartEncodedFrameLogs(video_send_stream_); | 1630 StartEncodedFrameLogs(video_send_stream_); |
1507 StartEncodedFrameLogs(video_receive_streams_[0]); | 1631 StartEncodedFrameLogs(video_receive_streams_[0]); |
1508 video_send_stream_->Start(); | 1632 video_send_stream_->Start(); |
| 1633 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1634 thumbnail_send_stream->Start(); |
1509 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1635 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1510 receive_stream->Start(); | 1636 receive_stream->Start(); |
1511 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1637 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
1512 receive_stream->Start(); | 1638 receive_stream->Start(); |
| 1639 for (VideoReceiveStream* thumbnail_receive_stream : |
| 1640 thumbnail_receive_streams_) |
| 1641 thumbnail_receive_stream->Start(); |
| 1642 |
1513 analyzer.StartMeasuringCpuProcessTime(); | 1643 analyzer.StartMeasuringCpuProcessTime(); |
| 1644 |
1514 video_capturer_->Start(); | 1645 video_capturer_->Start(); |
| 1646 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : |
| 1647 thumbnail_capturers_) { |
| 1648 video_caputurer->Start(); |
| 1649 } |
1515 | 1650 |
1516 analyzer.Wait(); | 1651 analyzer.Wait(); |
1517 | 1652 |
1518 send_transport.StopSending(); | 1653 send_transport.StopSending(); |
1519 recv_transport.StopSending(); | 1654 recv_transport.StopSending(); |
1520 | 1655 |
| 1656 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : |
| 1657 thumbnail_capturers_) |
| 1658 video_caputurer->Stop(); |
1521 video_capturer_->Stop(); | 1659 video_capturer_->Stop(); |
| 1660 for (VideoReceiveStream* thumbnail_receive_stream : |
| 1661 thumbnail_receive_streams_) |
| 1662 thumbnail_receive_stream->Stop(); |
1522 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1663 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
1523 receive_stream->Stop(); | 1664 receive_stream->Stop(); |
1524 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1665 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1525 receive_stream->Stop(); | 1666 receive_stream->Stop(); |
| 1667 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1668 thumbnail_send_stream->Stop(); |
1526 video_send_stream_->Stop(); | 1669 video_send_stream_->Stop(); |
1527 | 1670 |
1528 DestroyStreams(); | 1671 DestroyStreams(); |
| 1672 DestroyThumbnailStreams(); |
1529 | 1673 |
1530 if (graph_data_output_file) | 1674 if (graph_data_output_file) |
1531 fclose(graph_data_output_file); | 1675 fclose(graph_data_output_file); |
1532 } | 1676 } |
1533 | 1677 |
1534 void VideoQualityTest::SetupAudio(int send_channel_id, | 1678 void VideoQualityTest::SetupAudio(int send_channel_id, |
1535 int receive_channel_id, | 1679 int receive_channel_id, |
1536 Call* call, | 1680 Call* call, |
1537 Transport* transport, | 1681 Transport* transport, |
1538 AudioReceiveStream** audio_receive_stream) { | 1682 AudioReceiveStream** audio_receive_stream) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1723 std::ostringstream str; | 1867 std::ostringstream str; |
1724 str << receive_logs_++; | 1868 str << receive_logs_++; |
1725 std::string path = | 1869 std::string path = |
1726 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1870 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1727 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1871 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1728 10000000); | 1872 10000000); |
1729 } | 1873 } |
1730 } | 1874 } |
1731 | 1875 |
1732 } // namespace webrtc | 1876 } // namespace webrtc |
OLD | NEW |