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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 video_send_config_.rtp.ulpfec.red_payload_type; | 1337 video_send_config_.rtp.ulpfec.red_payload_type; |
1311 video_receive_configs_[params_.ss.selected_stream] | 1338 video_receive_configs_[params_.ss.selected_stream] |
1312 .rtp.ulpfec.ulpfec_payload_type = | 1339 .rtp.ulpfec.ulpfec_payload_type = |
1313 video_send_config_.rtp.ulpfec.ulpfec_payload_type; | 1340 video_send_config_.rtp.ulpfec.ulpfec_payload_type; |
1314 video_receive_configs_[params_.ss.selected_stream] | 1341 video_receive_configs_[params_.ss.selected_stream] |
1315 .rtp.ulpfec.red_rtx_payload_type = | 1342 .rtp.ulpfec.red_rtx_payload_type = |
1316 video_send_config_.rtp.ulpfec.red_rtx_payload_type; | 1343 video_send_config_.rtp.ulpfec.red_rtx_payload_type; |
1317 } | 1344 } |
1318 } | 1345 } |
1319 | 1346 |
| 1347 void VideoQualityTest::SetupThumbnails(Transport* send_transport, |
| 1348 Transport* recv_transport) { |
| 1349 size_t num_video_streams = params_.ss.streams.size(); |
| 1350 for (int i = 0; i < params_.num_thumbnails; ++i) { |
| 1351 thumbnail_encoders_.emplace_back(VP8Encoder::Create()); |
| 1352 |
| 1353 VideoSendStream::Config thumbnail_send_config(send_transport); |
| 1354 thumbnail_send_config.rtp.ssrcs.push_back(kThumbnailSendSsrcStart + i); |
| 1355 thumbnail_send_config.encoder_settings.encoder = |
| 1356 thumbnail_encoders_.back().get(); |
| 1357 thumbnail_send_config.encoder_settings.payload_name = params_.video.codec; |
| 1358 thumbnail_send_config.encoder_settings.payload_type = kPayloadTypeVP8; |
| 1359 thumbnail_send_config.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
| 1360 thumbnail_send_config.rtp.rtx.payload_type = kSendRtxPayloadType; |
| 1361 thumbnail_send_config.rtp.rtx.ssrcs.push_back(kThumbnailRtxSsrcStart + i); |
| 1362 thumbnail_send_config.rtp.extensions.clear(); |
| 1363 if (params_.call.send_side_bwe) { |
| 1364 thumbnail_send_config.rtp.extensions.push_back( |
| 1365 RtpExtension(RtpExtension::kTransportSequenceNumberUri, |
| 1366 test::kTransportSequenceNumberExtensionId)); |
| 1367 } else { |
| 1368 thumbnail_send_config.rtp.extensions.push_back(RtpExtension( |
| 1369 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); |
| 1370 } |
| 1371 |
| 1372 VideoEncoderConfig thumbnail_encoder_config; |
| 1373 thumbnail_encoder_config.min_transmit_bitrate_bps = 7500; |
| 1374 thumbnail_send_config.suspend_below_min_bitrate = |
| 1375 params_.video.suspend_below_min_bitrate; |
| 1376 thumbnail_encoder_config.number_of_streams = 1; |
| 1377 thumbnail_encoder_config.max_bitrate_bps = 50000; |
| 1378 thumbnail_encoder_config.video_stream_factory = |
| 1379 new rtc::RefCountedObject<VideoStreamFactory>( |
| 1380 std::vector<webrtc::VideoStream>{DefaultThumbnailStream()}); |
| 1381 thumbnail_encoder_config.spatial_layers = params_.ss.spatial_layers; |
| 1382 |
| 1383 thumbnail_encoder_configs_.push_back(thumbnail_encoder_config.Copy()); |
| 1384 thumbnail_send_configs_.push_back(thumbnail_send_config.Copy()); |
| 1385 |
| 1386 CreateMatchingVideoReceiveConfigs(thumbnail_send_configs_[i], |
| 1387 recv_transport); |
| 1388 RTC_CHECK(video_receive_configs_.size() == num_video_streams + i + 1); |
| 1389 video_receive_configs_[num_video_streams + i].rtp.nack.rtp_history_ms = |
| 1390 kNackRtpHistoryMs; |
| 1391 video_receive_configs_[num_video_streams + i].rtp.rtx_ssrc = |
| 1392 kThumbnailRtxSsrcStart + i; |
| 1393 video_receive_configs_[num_video_streams + i] |
| 1394 .rtp.rtx_payload_types[kPayloadTypeVP8] = kSendRtxPayloadType; |
| 1395 video_receive_configs_[num_video_streams + i].rtp.transport_cc = |
| 1396 params_.call.send_side_bwe; |
| 1397 video_receive_configs_[num_video_streams + i].rtp.remb = |
| 1398 !params_.call.send_side_bwe; |
| 1399 } |
| 1400 |
| 1401 for (size_t i = 0; i < thumbnail_send_configs_.size(); ++i) { |
| 1402 thumbnail_send_streams_.push_back(sender_call_->CreateVideoSendStream( |
| 1403 thumbnail_send_configs_[i].Copy(), |
| 1404 thumbnail_encoder_configs_[i].Copy())); |
| 1405 } |
| 1406 } |
| 1407 |
1320 void VideoQualityTest::SetupScreenshareOrSVC() { | 1408 void VideoQualityTest::SetupScreenshareOrSVC() { |
1321 if (params_.screenshare.enabled) { | 1409 if (params_.screenshare.enabled) { |
1322 // Fill out codec settings. | 1410 // Fill out codec settings. |
1323 video_encoder_config_.content_type = | 1411 video_encoder_config_.content_type = |
1324 VideoEncoderConfig::ContentType::kScreen; | 1412 VideoEncoderConfig::ContentType::kScreen; |
1325 degradation_preference_ = | 1413 degradation_preference_ = |
1326 VideoSendStream::DegradationPreference::kMaintainResolution; | 1414 VideoSendStream::DegradationPreference::kMaintainResolution; |
1327 if (params_.video.codec == "VP8") { | 1415 if (params_.video.codec == "VP8") { |
1328 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 1416 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
1329 vp8_settings.denoisingOn = false; | 1417 vp8_settings.denoisingOn = false; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1467 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
1380 vp9_settings.numberOfTemporalLayers = | 1468 vp9_settings.numberOfTemporalLayers = |
1381 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1469 static_cast<unsigned char>(params_.video.num_temporal_layers); |
1382 vp9_settings.numberOfSpatialLayers = | 1470 vp9_settings.numberOfSpatialLayers = |
1383 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1471 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
1384 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1472 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
1385 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1473 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
1386 } | 1474 } |
1387 } | 1475 } |
1388 | 1476 |
| 1477 void VideoQualityTest::SetupThumbnailCapturers(size_t num_thumbnail_streams) { |
| 1478 VideoStream thumbnail = DefaultThumbnailStream(); |
| 1479 for (size_t i = 0; i < num_thumbnail_streams; ++i) { |
| 1480 thumbnail_capturers_.emplace_back(test::FrameGeneratorCapturer::Create( |
| 1481 static_cast<int>(thumbnail.width), static_cast<int>(thumbnail.height), |
| 1482 thumbnail.max_framerate, clock_)); |
| 1483 } |
| 1484 } |
| 1485 |
1389 void VideoQualityTest::CreateCapturer() { | 1486 void VideoQualityTest::CreateCapturer() { |
1390 if (params_.screenshare.enabled) { | 1487 if (params_.screenshare.enabled) { |
1391 test::FrameGeneratorCapturer* frame_generator_capturer = | 1488 test::FrameGeneratorCapturer* frame_generator_capturer = |
1392 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), | 1489 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
1393 params_.video.fps); | 1490 params_.video.fps); |
1394 EXPECT_TRUE(frame_generator_capturer->Init()); | 1491 EXPECT_TRUE(frame_generator_capturer->Init()); |
1395 video_capturer_.reset(frame_generator_capturer); | 1492 video_capturer_.reset(frame_generator_capturer); |
1396 } else { | 1493 } else { |
1397 if (params_.video.clip_name.empty()) { | 1494 if (params_.video.clip_name.empty()) { |
1398 video_capturer_.reset(test::VcmCapturer::Create( | 1495 video_capturer_.reset(test::VcmCapturer::Create( |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1440 | 1537 |
1441 test::LayerFilteringTransport send_transport( | 1538 test::LayerFilteringTransport send_transport( |
1442 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1539 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
1443 params_.video.selected_tl, params_.ss.selected_sl); | 1540 params_.video.selected_tl, params_.ss.selected_sl); |
1444 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); | 1541 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); |
1445 | 1542 |
1446 std::string graph_title = params_.analyzer.graph_title; | 1543 std::string graph_title = params_.analyzer.graph_title; |
1447 if (graph_title.empty()) | 1544 if (graph_title.empty()) |
1448 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1545 graph_title = VideoQualityTest::GenerateGraphTitle(); |
1449 | 1546 |
1450 // In the case of different resolutions, the functions calculating PSNR and | |
1451 // SSIM return -1.0, instead of a positive value as usual. VideoAnalyzer | |
1452 // aborts if the average psnr/ssim are below the given threshold, which is | |
1453 // 0.0 by default. Setting the thresholds to -1.1 prevents the unnecessary | |
1454 // abort. | |
1455 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; | 1547 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; |
1456 | 1548 |
1457 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); | 1549 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); |
1458 VideoAnalyzer analyzer( | 1550 VideoAnalyzer analyzer( |
1459 &send_transport, params_.analyzer.test_label, | 1551 &send_transport, params_.analyzer.test_label, |
1460 | |
1461 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1552 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
1462 is_quick_test_enabled | 1553 is_quick_test_enabled |
1463 ? kFramesSentInQuickTest | 1554 ? kFramesSentInQuickTest |
1464 : params_.analyzer.test_durations_secs * params_.video.fps, | 1555 : params_.analyzer.test_durations_secs * params_.video.fps, |
1465 graph_data_output_file, graph_title, | 1556 graph_data_output_file, graph_title, |
1466 kVideoSendSsrcs[params_.ss.selected_stream], | 1557 kVideoSendSsrcs[params_.ss.selected_stream], |
1467 kSendRtxSsrcs[params_.ss.selected_stream], | 1558 kSendRtxSsrcs[params_.ss.selected_stream], |
1468 static_cast<uint32_t>(selected_stream.width), | 1559 static_cast<uint32_t>(selected_stream.width), |
1469 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, | 1560 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, |
1470 params_.video.selected_tl, is_quick_test_enabled); | 1561 params_.video.selected_tl, is_quick_test_enabled); |
1471 analyzer.SetReceiver(receiver_call_->Receiver()); | 1562 analyzer.SetReceiver(receiver_call_->Receiver()); |
1472 send_transport.SetReceiver(&analyzer); | 1563 send_transport.SetReceiver(&analyzer); |
1473 recv_transport.SetReceiver(sender_call_->Receiver()); | 1564 recv_transport.SetReceiver(sender_call_->Receiver()); |
1474 | 1565 |
1475 SetupVideo(&analyzer, &recv_transport); | 1566 SetupVideo(&analyzer, &recv_transport); |
| 1567 SetupThumbnails(&analyzer, &recv_transport); |
1476 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1568 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
1477 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1569 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
1478 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1570 RTC_DCHECK(!video_send_config_.post_encode_callback); |
1479 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1571 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
1480 | 1572 |
1481 SetupScreenshareOrSVC(); | 1573 SetupScreenshareOrSVC(); |
1482 | 1574 |
1483 CreateFlexfecStreams(); | 1575 CreateFlexfecStreams(); |
1484 CreateVideoStreams(); | 1576 CreateVideoStreams(); |
1485 analyzer.SetSendStream(video_send_stream_); | 1577 analyzer.SetSendStream(video_send_stream_); |
1486 if (video_receive_streams_.size() == 1) | 1578 if (video_receive_streams_.size() == 1) |
1487 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1579 analyzer.SetReceiveStream(video_receive_streams_[0]); |
1488 | 1580 |
1489 video_send_stream_->SetSource(analyzer.OutputInterface(), | 1581 video_send_stream_->SetSource(analyzer.OutputInterface(), |
1490 degradation_preference_); | 1582 degradation_preference_); |
1491 | 1583 |
| 1584 SetupThumbnailCapturers(params_.num_thumbnails); |
| 1585 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { |
| 1586 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), |
| 1587 degradation_preference_); |
| 1588 } |
| 1589 |
1492 CreateCapturer(); | 1590 CreateCapturer(); |
| 1591 |
1493 rtc::VideoSinkWants wants; | 1592 rtc::VideoSinkWants wants; |
1494 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | 1593 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); |
1495 | 1594 |
1496 StartEncodedFrameLogs(video_send_stream_); | 1595 StartEncodedFrameLogs(video_send_stream_); |
1497 StartEncodedFrameLogs(video_receive_streams_[0]); | 1596 StartEncodedFrameLogs(video_receive_streams_[0]); |
1498 video_send_stream_->Start(); | 1597 video_send_stream_->Start(); |
| 1598 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1599 thumbnail_send_stream->Start(); |
1499 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1600 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1500 receive_stream->Start(); | 1601 receive_stream->Start(); |
1501 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1602 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
1502 receive_stream->Start(); | 1603 receive_stream->Start(); |
| 1604 |
1503 analyzer.StartMeasuringCpuProcessTime(); | 1605 analyzer.StartMeasuringCpuProcessTime(); |
| 1606 |
1504 video_capturer_->Start(); | 1607 video_capturer_->Start(); |
| 1608 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : |
| 1609 thumbnail_capturers_) { |
| 1610 video_caputurer->Start(); |
| 1611 } |
1505 | 1612 |
1506 analyzer.Wait(); | 1613 analyzer.Wait(); |
1507 | 1614 |
1508 send_transport.StopSending(); | 1615 send_transport.StopSending(); |
1509 recv_transport.StopSending(); | 1616 recv_transport.StopSending(); |
1510 | 1617 |
| 1618 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : |
| 1619 thumbnail_capturers_) |
| 1620 video_caputurer->Stop(); |
1511 video_capturer_->Stop(); | 1621 video_capturer_->Stop(); |
1512 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1622 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
1513 receive_stream->Stop(); | 1623 receive_stream->Stop(); |
1514 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1624 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
1515 receive_stream->Stop(); | 1625 receive_stream->Stop(); |
| 1626 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1627 thumbnail_send_stream->Stop(); |
1516 video_send_stream_->Stop(); | 1628 video_send_stream_->Stop(); |
1517 | 1629 |
1518 DestroyStreams(); | 1630 DestroyStreams(); |
| 1631 // Thumbnails are not managed by CallTest. We need to destroy them manually. |
| 1632 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) |
| 1633 sender_call_->DestroyVideoSendStream(thumbnail_send_stream); |
| 1634 thumbnail_send_streams_.clear(); |
1519 | 1635 |
1520 if (graph_data_output_file) | 1636 if (graph_data_output_file) |
1521 fclose(graph_data_output_file); | 1637 fclose(graph_data_output_file); |
1522 } | 1638 } |
1523 | 1639 |
1524 void VideoQualityTest::SetupAudio(int send_channel_id, | 1640 void VideoQualityTest::SetupAudio(int send_channel_id, |
1525 int receive_channel_id, | 1641 int receive_channel_id, |
1526 Call* call, | 1642 Call* call, |
1527 Transport* transport, | 1643 Transport* transport, |
1528 AudioReceiveStream** audio_receive_stream) { | 1644 AudioReceiveStream** audio_receive_stream) { |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1713 std::ostringstream str; | 1829 std::ostringstream str; |
1714 str << receive_logs_++; | 1830 str << receive_logs_++; |
1715 std::string path = | 1831 std::string path = |
1716 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1832 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
1717 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1833 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
1718 10000000); | 1834 10000000); |
1719 } | 1835 } |
1720 } | 1836 } |
1721 | 1837 |
1722 } // namespace webrtc | 1838 } // namespace webrtc |
OLD | NEW |