| 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; | |
| 62 | 60 |
| 63 struct VoiceEngineState { | 61 struct VoiceEngineState { |
| 64 VoiceEngineState() | 62 VoiceEngineState() |
| 65 : voice_engine(nullptr), | 63 : voice_engine(nullptr), |
| 66 base(nullptr), | 64 base(nullptr), |
| 67 send_channel_id(-1), | 65 send_channel_id(-1), |
| 68 receive_channel_id(-1) {} | 66 receive_channel_id(-1) {} |
| 69 | 67 |
| 70 webrtc::VoiceEngine* voice_engine; | 68 webrtc::VoiceEngine* voice_engine; |
| 71 webrtc::VoEBase* base; | 69 webrtc::VoEBase* base; |
| (...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 | 1023 |
| 1026 VideoQualityTest::Params::Params() | 1024 VideoQualityTest::Params::Params() |
| 1027 : call({false, Call::Config::BitrateConfig()}), | 1025 : call({false, Call::Config::BitrateConfig()}), |
| 1028 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, | 1026 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, |
| 1029 false, "", ""}), | 1027 false, "", ""}), |
| 1030 audio({false, false}), | 1028 audio({false, false}), |
| 1031 screenshare({false, 10, 0}), | 1029 screenshare({false, 10, 0}), |
| 1032 analyzer({"", 0.0, 0.0, 0, "", ""}), | 1030 analyzer({"", 0.0, 0.0, 0, "", ""}), |
| 1033 pipe(), | 1031 pipe(), |
| 1034 logs(false), | 1032 logs(false), |
| 1035 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}), | 1033 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}) {} |
| 1036 num_thumbnails(0) {} | |
| 1037 | 1034 |
| 1038 VideoQualityTest::Params::~Params() = default; | 1035 VideoQualityTest::Params::~Params() = default; |
| 1039 | 1036 |
| 1040 void VideoQualityTest::TestBody() {} | 1037 void VideoQualityTest::TestBody() {} |
| 1041 | 1038 |
| 1042 std::string VideoQualityTest::GenerateGraphTitle() const { | 1039 std::string VideoQualityTest::GenerateGraphTitle() const { |
| 1043 std::stringstream ss; | 1040 std::stringstream ss; |
| 1044 ss << params_.video.codec; | 1041 ss << params_.video.codec; |
| 1045 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps"; | 1042 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps"; |
| 1046 ss << ", " << params_.video.fps << " FPS"; | 1043 ss << ", " << params_.video.fps << " FPS"; |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1094 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); | 1091 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); |
| 1095 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); | 1092 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); |
| 1096 RTC_CHECK(params_.ss.spatial_layers.empty() || | 1093 RTC_CHECK(params_.ss.spatial_layers.empty() || |
| 1097 params_.ss.spatial_layers.size() == | 1094 params_.ss.spatial_layers.size() == |
| 1098 static_cast<size_t>(params_.ss.num_spatial_layers)); | 1095 static_cast<size_t>(params_.ss.num_spatial_layers)); |
| 1099 if (params_.video.codec == "VP8") { | 1096 if (params_.video.codec == "VP8") { |
| 1100 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); | 1097 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); |
| 1101 } else if (params_.video.codec == "VP9") { | 1098 } else if (params_.video.codec == "VP9") { |
| 1102 RTC_CHECK_EQ(params_.ss.streams.size(), 1); | 1099 RTC_CHECK_EQ(params_.ss.streams.size(), 1); |
| 1103 } | 1100 } |
| 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 } | |
| 1111 } | 1101 } |
| 1112 | 1102 |
| 1113 // Static. | 1103 // Static. |
| 1114 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { | 1104 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { |
| 1115 // Parse comma separated nonnegative integers, where some elements may be | 1105 // Parse comma separated nonnegative integers, where some elements may be |
| 1116 // empty. The empty values are replaced with -1. | 1106 // empty. The empty values are replaced with -1. |
| 1117 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40} | 1107 // E.g. "10,-20,,30,40" --> {10, 20, -1, 30,40} |
| 1118 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1} | 1108 // E.g. ",,10,,20," --> {-1, -1, 10, -1, 20, -1} |
| 1119 std::vector<int> result; | 1109 std::vector<int> result; |
| 1120 if (str.empty()) | 1110 if (str.empty()) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1141 // Static. | 1131 // Static. |
| 1142 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { | 1132 VideoStream VideoQualityTest::DefaultVideoStream(const Params& params) { |
| 1143 VideoStream stream; | 1133 VideoStream stream; |
| 1144 stream.width = params.video.width; | 1134 stream.width = params.video.width; |
| 1145 stream.height = params.video.height; | 1135 stream.height = params.video.height; |
| 1146 stream.max_framerate = params.video.fps; | 1136 stream.max_framerate = params.video.fps; |
| 1147 stream.min_bitrate_bps = params.video.min_bitrate_bps; | 1137 stream.min_bitrate_bps = params.video.min_bitrate_bps; |
| 1148 stream.target_bitrate_bps = params.video.target_bitrate_bps; | 1138 stream.target_bitrate_bps = params.video.target_bitrate_bps; |
| 1149 stream.max_bitrate_bps = params.video.max_bitrate_bps; | 1139 stream.max_bitrate_bps = params.video.max_bitrate_bps; |
| 1150 stream.max_qp = 52; | 1140 stream.max_qp = 52; |
| 1151 if (params.video.num_temporal_layers == 2) { | 1141 if (params.video.num_temporal_layers == 2) |
| 1152 stream.temporal_layer_thresholds_bps.push_back(stream.target_bitrate_bps); | 1142 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 } | |
| 1157 return stream; | 1143 return stream; |
| 1158 } | 1144 } |
| 1159 | 1145 |
| 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 | |
| 1173 // Static. | 1146 // Static. |
| 1174 void VideoQualityTest::FillScalabilitySettings( | 1147 void VideoQualityTest::FillScalabilitySettings( |
| 1175 Params* params, | 1148 Params* params, |
| 1176 const std::vector<std::string>& stream_descriptors, | 1149 const std::vector<std::string>& stream_descriptors, |
| 1177 size_t selected_stream, | 1150 size_t selected_stream, |
| 1178 int num_spatial_layers, | 1151 int num_spatial_layers, |
| 1179 int selected_sl, | 1152 int selected_sl, |
| 1180 const std::vector<std::string>& sl_descriptors) { | 1153 const std::vector<std::string>& sl_descriptors) { |
| 1181 // Read VideoStream and SpatialLayer elements from a list of comma separated | 1154 // Read VideoStream and SpatialLayer elements from a list of comma separated |
| 1182 // lists. To use a default value for an element, use -1 or leave empty. | 1155 // 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... |
| 1347 video_send_config_.rtp.ulpfec.red_payload_type; | 1320 video_send_config_.rtp.ulpfec.red_payload_type; |
| 1348 video_receive_configs_[params_.ss.selected_stream] | 1321 video_receive_configs_[params_.ss.selected_stream] |
| 1349 .rtp.ulpfec.ulpfec_payload_type = | 1322 .rtp.ulpfec.ulpfec_payload_type = |
| 1350 video_send_config_.rtp.ulpfec.ulpfec_payload_type; | 1323 video_send_config_.rtp.ulpfec.ulpfec_payload_type; |
| 1351 video_receive_configs_[params_.ss.selected_stream] | 1324 video_receive_configs_[params_.ss.selected_stream] |
| 1352 .rtp.ulpfec.red_rtx_payload_type = | 1325 .rtp.ulpfec.red_rtx_payload_type = |
| 1353 video_send_config_.rtp.ulpfec.red_rtx_payload_type; | 1326 video_send_config_.rtp.ulpfec.red_rtx_payload_type; |
| 1354 } | 1327 } |
| 1355 } | 1328 } |
| 1356 | 1329 |
| 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 | |
| 1443 void VideoQualityTest::SetupScreenshareOrSVC() { | 1330 void VideoQualityTest::SetupScreenshareOrSVC() { |
| 1444 if (params_.screenshare.enabled) { | 1331 if (params_.screenshare.enabled) { |
| 1445 // Fill out codec settings. | 1332 // Fill out codec settings. |
| 1446 video_encoder_config_.content_type = | 1333 video_encoder_config_.content_type = |
| 1447 VideoEncoderConfig::ContentType::kScreen; | 1334 VideoEncoderConfig::ContentType::kScreen; |
| 1448 degradation_preference_ = | 1335 degradation_preference_ = |
| 1449 VideoSendStream::DegradationPreference::kMaintainResolution; | 1336 VideoSendStream::DegradationPreference::kMaintainResolution; |
| 1450 if (params_.video.codec == "VP8") { | 1337 if (params_.video.codec == "VP8") { |
| 1451 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 1338 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
| 1452 vp8_settings.denoisingOn = false; | 1339 vp8_settings.denoisingOn = false; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | 1389 VideoCodecVP9 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); |
| 1503 vp9_settings.numberOfTemporalLayers = | 1390 vp9_settings.numberOfTemporalLayers = |
| 1504 static_cast<unsigned char>(params_.video.num_temporal_layers); | 1391 static_cast<unsigned char>(params_.video.num_temporal_layers); |
| 1505 vp9_settings.numberOfSpatialLayers = | 1392 vp9_settings.numberOfSpatialLayers = |
| 1506 static_cast<unsigned char>(params_.ss.num_spatial_layers); | 1393 static_cast<unsigned char>(params_.ss.num_spatial_layers); |
| 1507 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< | 1394 video_encoder_config_.encoder_specific_settings = new rtc::RefCountedObject< |
| 1508 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); | 1395 VideoEncoderConfig::Vp9EncoderSpecificSettings>(vp9_settings); |
| 1509 } | 1396 } |
| 1510 } | 1397 } |
| 1511 | 1398 |
| 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 | |
| 1521 void VideoQualityTest::CreateCapturer() { | 1399 void VideoQualityTest::CreateCapturer() { |
| 1522 if (params_.screenshare.enabled) { | 1400 if (params_.screenshare.enabled) { |
| 1523 test::FrameGeneratorCapturer* frame_generator_capturer = | 1401 test::FrameGeneratorCapturer* frame_generator_capturer = |
| 1524 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), | 1402 new test::FrameGeneratorCapturer(clock_, std::move(frame_generator_), |
| 1525 params_.video.fps); | 1403 params_.video.fps); |
| 1526 EXPECT_TRUE(frame_generator_capturer->Init()); | 1404 EXPECT_TRUE(frame_generator_capturer->Init()); |
| 1527 video_capturer_.reset(frame_generator_capturer); | 1405 video_capturer_.reset(frame_generator_capturer); |
| 1528 } else { | 1406 } else { |
| 1529 if (params_.video.clip_name.empty()) { | 1407 if (params_.video.clip_name.empty()) { |
| 1530 video_capturer_.reset(test::VcmCapturer::Create( | 1408 video_capturer_.reset(test::VcmCapturer::Create( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1572 | 1450 |
| 1573 test::LayerFilteringTransport send_transport( | 1451 test::LayerFilteringTransport send_transport( |
| 1574 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, | 1452 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, |
| 1575 params_.video.selected_tl, params_.ss.selected_sl); | 1453 params_.video.selected_tl, params_.ss.selected_sl); |
| 1576 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); | 1454 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get()); |
| 1577 | 1455 |
| 1578 std::string graph_title = params_.analyzer.graph_title; | 1456 std::string graph_title = params_.analyzer.graph_title; |
| 1579 if (graph_title.empty()) | 1457 if (graph_title.empty()) |
| 1580 graph_title = VideoQualityTest::GenerateGraphTitle(); | 1458 graph_title = VideoQualityTest::GenerateGraphTitle(); |
| 1581 | 1459 |
| 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. |
| 1582 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; | 1465 VideoStream& selected_stream = params_.ss.streams[params_.ss.selected_stream]; |
| 1583 | 1466 |
| 1584 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); | 1467 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); |
| 1585 VideoAnalyzer analyzer( | 1468 VideoAnalyzer analyzer( |
| 1586 &send_transport, params_.analyzer.test_label, | 1469 &send_transport, params_.analyzer.test_label, |
| 1470 |
| 1587 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, | 1471 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, |
| 1588 is_quick_test_enabled | 1472 is_quick_test_enabled |
| 1589 ? kFramesSentInQuickTest | 1473 ? kFramesSentInQuickTest |
| 1590 : params_.analyzer.test_durations_secs * params_.video.fps, | 1474 : params_.analyzer.test_durations_secs * params_.video.fps, |
| 1591 graph_data_output_file, graph_title, | 1475 graph_data_output_file, graph_title, |
| 1592 kVideoSendSsrcs[params_.ss.selected_stream], | 1476 kVideoSendSsrcs[params_.ss.selected_stream], |
| 1593 kSendRtxSsrcs[params_.ss.selected_stream], | 1477 kSendRtxSsrcs[params_.ss.selected_stream], |
| 1594 static_cast<uint32_t>(selected_stream.width), | 1478 static_cast<uint32_t>(selected_stream.width), |
| 1595 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, | 1479 static_cast<uint32_t>(selected_stream.height), params.ss.selected_sl, |
| 1596 params_.video.selected_tl, is_quick_test_enabled); | 1480 params_.video.selected_tl, is_quick_test_enabled); |
| 1597 analyzer.SetReceiver(receiver_call_->Receiver()); | 1481 analyzer.SetReceiver(receiver_call_->Receiver()); |
| 1598 send_transport.SetReceiver(&analyzer); | 1482 send_transport.SetReceiver(&analyzer); |
| 1599 recv_transport.SetReceiver(sender_call_->Receiver()); | 1483 recv_transport.SetReceiver(sender_call_->Receiver()); |
| 1600 | 1484 |
| 1601 SetupVideo(&analyzer, &recv_transport); | 1485 SetupVideo(&analyzer, &recv_transport); |
| 1602 SetupThumbnails(&analyzer, &recv_transport); | |
| 1603 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; | 1486 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; |
| 1604 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); | 1487 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); |
| 1605 RTC_DCHECK(!video_send_config_.post_encode_callback); | 1488 RTC_DCHECK(!video_send_config_.post_encode_callback); |
| 1606 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); | 1489 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); |
| 1607 | 1490 |
| 1608 SetupScreenshareOrSVC(); | 1491 SetupScreenshareOrSVC(); |
| 1609 | 1492 |
| 1610 CreateFlexfecStreams(); | 1493 CreateFlexfecStreams(); |
| 1611 CreateVideoStreams(); | 1494 CreateVideoStreams(); |
| 1612 analyzer.SetSendStream(video_send_stream_); | 1495 analyzer.SetSendStream(video_send_stream_); |
| 1613 if (video_receive_streams_.size() == 1) | 1496 if (video_receive_streams_.size() == 1) |
| 1614 analyzer.SetReceiveStream(video_receive_streams_[0]); | 1497 analyzer.SetReceiveStream(video_receive_streams_[0]); |
| 1615 | 1498 |
| 1616 video_send_stream_->SetSource(analyzer.OutputInterface(), | 1499 video_send_stream_->SetSource(analyzer.OutputInterface(), |
| 1617 degradation_preference_); | 1500 degradation_preference_); |
| 1618 | 1501 |
| 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 | |
| 1625 CreateCapturer(); | 1502 CreateCapturer(); |
| 1626 | |
| 1627 rtc::VideoSinkWants wants; | 1503 rtc::VideoSinkWants wants; |
| 1628 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); | 1504 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); |
| 1629 | 1505 |
| 1630 StartEncodedFrameLogs(video_send_stream_); | 1506 StartEncodedFrameLogs(video_send_stream_); |
| 1631 StartEncodedFrameLogs(video_receive_streams_[0]); | 1507 StartEncodedFrameLogs(video_receive_streams_[0]); |
| 1632 video_send_stream_->Start(); | 1508 video_send_stream_->Start(); |
| 1633 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) | |
| 1634 thumbnail_send_stream->Start(); | |
| 1635 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1509 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
| 1636 receive_stream->Start(); | 1510 receive_stream->Start(); |
| 1637 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1511 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
| 1638 receive_stream->Start(); | 1512 receive_stream->Start(); |
| 1639 for (VideoReceiveStream* thumbnail_receive_stream : | |
| 1640 thumbnail_receive_streams_) | |
| 1641 thumbnail_receive_stream->Start(); | |
| 1642 | |
| 1643 analyzer.StartMeasuringCpuProcessTime(); | 1513 analyzer.StartMeasuringCpuProcessTime(); |
| 1644 | |
| 1645 video_capturer_->Start(); | 1514 video_capturer_->Start(); |
| 1646 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : | |
| 1647 thumbnail_capturers_) { | |
| 1648 video_caputurer->Start(); | |
| 1649 } | |
| 1650 | 1515 |
| 1651 analyzer.Wait(); | 1516 analyzer.Wait(); |
| 1652 | 1517 |
| 1653 send_transport.StopSending(); | 1518 send_transport.StopSending(); |
| 1654 recv_transport.StopSending(); | 1519 recv_transport.StopSending(); |
| 1655 | 1520 |
| 1656 for (std::unique_ptr<test::VideoCapturer>& video_caputurer : | |
| 1657 thumbnail_capturers_) | |
| 1658 video_caputurer->Stop(); | |
| 1659 video_capturer_->Stop(); | 1521 video_capturer_->Stop(); |
| 1660 for (VideoReceiveStream* thumbnail_receive_stream : | |
| 1661 thumbnail_receive_streams_) | |
| 1662 thumbnail_receive_stream->Stop(); | |
| 1663 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) | 1522 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) |
| 1664 receive_stream->Stop(); | 1523 receive_stream->Stop(); |
| 1665 for (VideoReceiveStream* receive_stream : video_receive_streams_) | 1524 for (VideoReceiveStream* receive_stream : video_receive_streams_) |
| 1666 receive_stream->Stop(); | 1525 receive_stream->Stop(); |
| 1667 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) | |
| 1668 thumbnail_send_stream->Stop(); | |
| 1669 video_send_stream_->Stop(); | 1526 video_send_stream_->Stop(); |
| 1670 | 1527 |
| 1671 DestroyStreams(); | 1528 DestroyStreams(); |
| 1672 DestroyThumbnailStreams(); | |
| 1673 | 1529 |
| 1674 if (graph_data_output_file) | 1530 if (graph_data_output_file) |
| 1675 fclose(graph_data_output_file); | 1531 fclose(graph_data_output_file); |
| 1676 } | 1532 } |
| 1677 | 1533 |
| 1678 void VideoQualityTest::SetupAudio(int send_channel_id, | 1534 void VideoQualityTest::SetupAudio(int send_channel_id, |
| 1679 int receive_channel_id, | 1535 int receive_channel_id, |
| 1680 Call* call, | 1536 Call* call, |
| 1681 Transport* transport, | 1537 Transport* transport, |
| 1682 AudioReceiveStream** audio_receive_stream) { | 1538 AudioReceiveStream** audio_receive_stream) { |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1867 std::ostringstream str; | 1723 std::ostringstream str; |
| 1868 str << receive_logs_++; | 1724 str << receive_logs_++; |
| 1869 std::string path = | 1725 std::string path = |
| 1870 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; | 1726 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; |
| 1871 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), | 1727 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), |
| 1872 10000000); | 1728 10000000); |
| 1873 } | 1729 } |
| 1874 } | 1730 } |
| 1875 | 1731 |
| 1876 } // namespace webrtc | 1732 } // namespace webrtc |
| OLD | NEW |