Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: webrtc/video/video_quality_test.cc

Issue 2974903002: Add rtpdump and rtc log functionality to screenshare_loopback and video_loopback (Closed)
Patch Set: rebase Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "webrtc/system_wrappers/include/field_trial.h" 42 #include "webrtc/system_wrappers/include/field_trial.h"
43 #include "webrtc/test/gtest.h" 43 #include "webrtc/test/gtest.h"
44 #include "webrtc/test/layer_filtering_transport.h" 44 #include "webrtc/test/layer_filtering_transport.h"
45 #include "webrtc/test/run_loop.h" 45 #include "webrtc/test/run_loop.h"
46 #include "webrtc/test/statistics.h" 46 #include "webrtc/test/statistics.h"
47 #include "webrtc/test/testsupport/fileutils.h" 47 #include "webrtc/test/testsupport/fileutils.h"
48 #include "webrtc/test/vcm_capturer.h" 48 #include "webrtc/test/vcm_capturer.h"
49 #include "webrtc/test/video_renderer.h" 49 #include "webrtc/test/video_renderer.h"
50 #include "webrtc/voice_engine/include/voe_base.h" 50 #include "webrtc/voice_engine/include/voe_base.h"
51 51
52 #include "webrtc/test/rtp_file_writer.h"
53
52 namespace { 54 namespace {
53 55
54 constexpr int kSendStatsPollingIntervalMs = 1000; 56 constexpr int kSendStatsPollingIntervalMs = 1000;
55 57
56 constexpr size_t kMaxComparisons = 10; 58 constexpr size_t kMaxComparisons = 10;
57 constexpr char kSyncGroup[] = "av_sync"; 59 constexpr char kSyncGroup[] = "av_sync";
58 constexpr int kOpusMinBitrateBps = 6000; 60 constexpr int kOpusMinBitrateBps = 6000;
59 constexpr int kOpusBitrateFbBps = 32000; 61 constexpr int kOpusBitrateFbBps = 32000;
60 constexpr int kFramesSentInQuickTest = 1; 62 constexpr int kFramesSentInQuickTest = 1;
61 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000; 63 constexpr uint32_t kThumbnailSendSsrcStart = 0xE0000;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 double avg_ssim_threshold, 144 double avg_ssim_threshold,
143 int duration_frames, 145 int duration_frames,
144 FILE* graph_data_output_file, 146 FILE* graph_data_output_file,
145 const std::string& graph_title, 147 const std::string& graph_title,
146 uint32_t ssrc_to_analyze, 148 uint32_t ssrc_to_analyze,
147 uint32_t rtx_ssrc_to_analyze, 149 uint32_t rtx_ssrc_to_analyze,
148 size_t selected_stream, 150 size_t selected_stream,
149 int selected_sl, 151 int selected_sl,
150 int selected_tl, 152 int selected_tl,
151 bool is_quick_test_enabled, 153 bool is_quick_test_enabled,
152 Clock* clock) 154 Clock* clock,
155 std::string rtp_dump_name)
153 : transport_(transport), 156 : transport_(transport),
154 receiver_(nullptr), 157 receiver_(nullptr),
155 call_(nullptr), 158 call_(nullptr),
156 send_stream_(nullptr), 159 send_stream_(nullptr),
157 receive_stream_(nullptr), 160 receive_stream_(nullptr),
158 captured_frame_forwarder_(this, clock), 161 captured_frame_forwarder_(this, clock),
159 test_label_(test_label), 162 test_label_(test_label),
160 graph_data_output_file_(graph_data_output_file), 163 graph_data_output_file_(graph_data_output_file),
161 graph_title_(graph_title), 164 graph_title_(graph_title),
162 ssrc_to_analyze_(ssrc_to_analyze), 165 ssrc_to_analyze_(ssrc_to_analyze),
(...skipping 15 matching lines...) Expand all
178 total_media_bytes_(0), 181 total_media_bytes_(0),
179 first_sending_time_(0), 182 first_sending_time_(0),
180 last_sending_time_(0), 183 last_sending_time_(0),
181 cpu_time_(0), 184 cpu_time_(0),
182 wallclock_time_(0), 185 wallclock_time_(0),
183 avg_psnr_threshold_(avg_psnr_threshold), 186 avg_psnr_threshold_(avg_psnr_threshold),
184 avg_ssim_threshold_(avg_ssim_threshold), 187 avg_ssim_threshold_(avg_ssim_threshold),
185 is_quick_test_enabled_(is_quick_test_enabled), 188 is_quick_test_enabled_(is_quick_test_enabled),
186 stats_polling_thread_(&PollStatsThread, this, "StatsPoller"), 189 stats_polling_thread_(&PollStatsThread, this, "StatsPoller"),
187 comparison_available_event_(false, false), 190 comparison_available_event_(false, false),
188 done_(true, false) { 191 done_(true, false),
192 clock_(clock),
193 start_ms_(clock->TimeInMilliseconds()) {
189 // Create thread pool for CPU-expensive PSNR/SSIM calculations. 194 // Create thread pool for CPU-expensive PSNR/SSIM calculations.
190 195
191 // Try to use about as many threads as cores, but leave kMinCoresLeft alone, 196 // Try to use about as many threads as cores, but leave kMinCoresLeft alone,
192 // so that we don't accidentally starve "real" worker threads (codec etc). 197 // so that we don't accidentally starve "real" worker threads (codec etc).
193 // Also, don't allocate more than kMaxComparisonThreads, even if there are 198 // Also, don't allocate more than kMaxComparisonThreads, even if there are
194 // spare cores. 199 // spare cores.
195 200
196 uint32_t num_cores = CpuInfo::DetectNumberOfCores(); 201 uint32_t num_cores = CpuInfo::DetectNumberOfCores();
197 RTC_DCHECK_GE(num_cores, 1); 202 RTC_DCHECK_GE(num_cores, 1);
198 static const uint32_t kMinCoresLeft = 4; 203 static const uint32_t kMinCoresLeft = 4;
199 static const uint32_t kMaxComparisonThreads = 8; 204 static const uint32_t kMaxComparisonThreads = 8;
200 205
201 if (num_cores <= kMinCoresLeft) { 206 if (num_cores <= kMinCoresLeft) {
202 num_cores = 1; 207 num_cores = 1;
203 } else { 208 } else {
204 num_cores -= kMinCoresLeft; 209 num_cores -= kMinCoresLeft;
205 num_cores = std::min(num_cores, kMaxComparisonThreads); 210 num_cores = std::min(num_cores, kMaxComparisonThreads);
206 } 211 }
207 212
208 for (uint32_t i = 0; i < num_cores; ++i) { 213 for (uint32_t i = 0; i < num_cores; ++i) {
209 rtc::PlatformThread* thread = 214 rtc::PlatformThread* thread =
210 new rtc::PlatformThread(&FrameComparisonThread, this, "Analyzer"); 215 new rtc::PlatformThread(&FrameComparisonThread, this, "Analyzer");
211 thread->Start(); 216 thread->Start();
212 comparison_thread_pool_.push_back(thread); 217 comparison_thread_pool_.push_back(thread);
213 } 218 }
219
220 if (!rtp_dump_name.empty()) {
221 fprintf(stdout, "Writing rtp dump to %s\n", rtp_dump_name.c_str());
222 rtp_file_writer_.reset(test::RtpFileWriter::Create(
223 test::RtpFileWriter::kRtpDump, rtp_dump_name));
224 }
214 } 225 }
215 226
216 ~VideoAnalyzer() { 227 ~VideoAnalyzer() {
217 for (rtc::PlatformThread* thread : comparison_thread_pool_) { 228 for (rtc::PlatformThread* thread : comparison_thread_pool_) {
218 thread->Stop(); 229 thread->Stop();
219 delete thread; 230 delete thread;
220 } 231 }
221 } 232 }
222 233
223 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; } 234 virtual void SetReceiver(PacketReceiver* receiver) { receiver_ = receiver; }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 267
257 DeliveryStatus DeliverPacket(MediaType media_type, 268 DeliveryStatus DeliverPacket(MediaType media_type,
258 const uint8_t* packet, 269 const uint8_t* packet,
259 size_t length, 270 size_t length,
260 const PacketTime& packet_time) override { 271 const PacketTime& packet_time) override {
261 // Ignore timestamps of RTCP packets. They're not synchronized with 272 // Ignore timestamps of RTCP packets. They're not synchronized with
262 // RTP packet timestamps and so they would confuse wrap_handler_. 273 // RTP packet timestamps and so they would confuse wrap_handler_.
263 if (RtpHeaderParser::IsRtcp(packet, length)) { 274 if (RtpHeaderParser::IsRtcp(packet, length)) {
264 return receiver_->DeliverPacket(media_type, packet, length, packet_time); 275 return receiver_->DeliverPacket(media_type, packet, length, packet_time);
265 } 276 }
277
278 if (rtp_file_writer_) {
279 test::RtpPacket p;
280 memcpy(p.data, packet, length);
281 p.length = length;
282 p.original_length = length;
283 p.time_ms = clock_->TimeInMilliseconds() - start_ms_;
284 rtp_file_writer_->WritePacket(&p);
285 }
286
266 RtpUtility::RtpHeaderParser parser(packet, length); 287 RtpUtility::RtpHeaderParser parser(packet, length);
267 RTPHeader header; 288 RTPHeader header;
268 parser.Parse(&header); 289 parser.Parse(&header);
269 if (!IsFlexfec(header.payloadType) && 290 if (!IsFlexfec(header.payloadType) &&
270 (header.ssrc == ssrc_to_analyze_ || 291 (header.ssrc == ssrc_to_analyze_ ||
271 header.ssrc == rtx_ssrc_to_analyze_)) { 292 header.ssrc == rtx_ssrc_to_analyze_)) {
272 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps. 293 // Ignore FlexFEC timestamps, to avoid collisions with media timestamps.
273 // (FlexFEC and media are sent on different SSRCs, which have different 294 // (FlexFEC and media are sent on different SSRCs, which have different
274 // timestamps spaces.) 295 // timestamps spaces.)
275 // Also ignore packets from wrong SSRC, but include retransmits. 296 // Also ignore packets from wrong SSRC, but include retransmits.
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 const double avg_psnr_threshold_; 1070 const double avg_psnr_threshold_;
1050 const double avg_ssim_threshold_; 1071 const double avg_ssim_threshold_;
1051 bool is_quick_test_enabled_; 1072 bool is_quick_test_enabled_;
1052 1073
1053 rtc::CriticalSection comparison_lock_; 1074 rtc::CriticalSection comparison_lock_;
1054 std::vector<rtc::PlatformThread*> comparison_thread_pool_; 1075 std::vector<rtc::PlatformThread*> comparison_thread_pool_;
1055 rtc::PlatformThread stats_polling_thread_; 1076 rtc::PlatformThread stats_polling_thread_;
1056 rtc::Event comparison_available_event_; 1077 rtc::Event comparison_available_event_;
1057 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); 1078 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
1058 rtc::Event done_; 1079 rtc::Event done_;
1080
1081 std::unique_ptr<test::RtpFileWriter> rtp_file_writer_;
1082 Clock* const clock_;
1083 const int64_t start_ms_;
1059 }; 1084 };
1060 1085
1061 class Vp8EncoderFactory : public cricket::WebRtcVideoEncoderFactory { 1086 class Vp8EncoderFactory : public cricket::WebRtcVideoEncoderFactory {
1062 public: 1087 public:
1063 Vp8EncoderFactory() { 1088 Vp8EncoderFactory() {
1064 supported_codecs_.push_back(cricket::VideoCodec("VP8")); 1089 supported_codecs_.push_back(cricket::VideoCodec("VP8"));
1065 } 1090 }
1066 ~Vp8EncoderFactory() override { RTC_CHECK(live_encoders_.empty()); } 1091 ~Vp8EncoderFactory() override { RTC_CHECK(live_encoders_.empty()); }
1067 1092
1068 const std::vector<cricket::VideoCodec>& supported_codecs() const override { 1093 const std::vector<cricket::VideoCodec>& supported_codecs() const override {
(...skipping 26 matching lines...) Expand all
1095 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP8) == 1120 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP8) ==
1096 payload_type_map_.end()); 1121 payload_type_map_.end());
1097 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP9) == 1122 RTC_DCHECK(payload_type_map_.find(kPayloadTypeVP9) ==
1098 payload_type_map_.end()); 1123 payload_type_map_.end());
1099 payload_type_map_[kPayloadTypeH264] = webrtc::MediaType::VIDEO; 1124 payload_type_map_[kPayloadTypeH264] = webrtc::MediaType::VIDEO;
1100 payload_type_map_[kPayloadTypeVP8] = webrtc::MediaType::VIDEO; 1125 payload_type_map_[kPayloadTypeVP8] = webrtc::MediaType::VIDEO;
1101 payload_type_map_[kPayloadTypeVP9] = webrtc::MediaType::VIDEO; 1126 payload_type_map_[kPayloadTypeVP9] = webrtc::MediaType::VIDEO;
1102 } 1127 }
1103 1128
1104 VideoQualityTest::Params::Params() 1129 VideoQualityTest::Params::Params()
1105 : call({false, Call::Config::BitrateConfig()}), 1130 : call({false, Call::Config::BitrateConfig(), 0}),
1106 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, 1131 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false,
1107 false, "", ""}), 1132 false, ""}),
1108 audio({false, false, false}), 1133 audio({false, false, false}),
1109 screenshare({false, 10, 0}), 1134 screenshare({false, 10, 0}),
1110 analyzer({"", 0.0, 0.0, 0, "", ""}), 1135 analyzer({"", 0.0, 0.0, 0, "", ""}),
1111 pipe(), 1136 pipe(),
1112 logs(false),
1113 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}), 1137 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}),
1114 num_thumbnails(0) {} 1138 logging({false, "", "", ""}) {}
1115 1139
1116 VideoQualityTest::Params::~Params() = default; 1140 VideoQualityTest::Params::~Params() = default;
1117 1141
1118 void VideoQualityTest::TestBody() {} 1142 void VideoQualityTest::TestBody() {}
1119 1143
1120 std::string VideoQualityTest::GenerateGraphTitle() const { 1144 std::string VideoQualityTest::GenerateGraphTitle() const {
1121 std::stringstream ss; 1145 std::stringstream ss;
1122 ss << params_.video.codec; 1146 ss << params_.video.codec;
1123 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps"; 1147 ss << " (" << params_.video.target_bitrate_bps / 1000 << "kbps";
1124 ss << ", " << params_.video.fps << " FPS"; 1148 ss << ", " << params_.video.fps << " FPS";
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1170 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1); 1194 RTC_CHECK_GE(params_.ss.num_spatial_layers, 1);
1171 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers); 1195 RTC_CHECK_LE(params_.ss.selected_sl, params_.ss.num_spatial_layers);
1172 RTC_CHECK(params_.ss.spatial_layers.empty() || 1196 RTC_CHECK(params_.ss.spatial_layers.empty() ||
1173 params_.ss.spatial_layers.size() == 1197 params_.ss.spatial_layers.size() ==
1174 static_cast<size_t>(params_.ss.num_spatial_layers)); 1198 static_cast<size_t>(params_.ss.num_spatial_layers));
1175 if (params_.video.codec == "VP8") { 1199 if (params_.video.codec == "VP8") {
1176 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); 1200 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1);
1177 } else if (params_.video.codec == "VP9") { 1201 } else if (params_.video.codec == "VP9") {
1178 RTC_CHECK_EQ(params_.ss.streams.size(), 1); 1202 RTC_CHECK_EQ(params_.ss.streams.size(), 1);
1179 } 1203 }
1180 RTC_CHECK_GE(params_.num_thumbnails, 0); 1204 RTC_CHECK_GE(params_.call.num_thumbnails, 0);
1181 if (params_.num_thumbnails > 0) { 1205 if (params_.call.num_thumbnails > 0) {
1182 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1); 1206 RTC_CHECK_EQ(params_.ss.num_spatial_layers, 1);
1183 RTC_CHECK_EQ(params_.ss.streams.size(), 3); 1207 RTC_CHECK_EQ(params_.ss.streams.size(), 3);
1184 RTC_CHECK_EQ(params_.video.num_temporal_layers, 3); 1208 RTC_CHECK_EQ(params_.video.num_temporal_layers, 3);
1185 RTC_CHECK_EQ(params_.video.codec, "VP8"); 1209 RTC_CHECK_EQ(params_.video.codec, "VP8");
1186 } 1210 }
1187 } 1211 }
1188 1212
1189 // Static. 1213 // Static.
1190 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) { 1214 std::vector<int> VideoQualityTest::ParseCSV(const std::string& str) {
1191 // Parse comma separated nonnegative integers, where some elements may be 1215 // Parse comma separated nonnegative integers, where some elements may be
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
1324 SpatialLayer layer; 1348 SpatialLayer layer;
1325 layer.scaling_factor_num = v[0] == -1 ? 1 : v[0]; 1349 layer.scaling_factor_num = v[0] == -1 ? 1 : v[0];
1326 layer.scaling_factor_den = v[1] == -1 ? 1 : v[1]; 1350 layer.scaling_factor_den = v[1] == -1 ? 1 : v[1];
1327 layer.target_bitrate_bps = v[2]; 1351 layer.target_bitrate_bps = v[2];
1328 params->ss.spatial_layers.push_back(layer); 1352 params->ss.spatial_layers.push_back(layer);
1329 } 1353 }
1330 } 1354 }
1331 1355
1332 void VideoQualityTest::SetupVideo(Transport* send_transport, 1356 void VideoQualityTest::SetupVideo(Transport* send_transport,
1333 Transport* recv_transport) { 1357 Transport* recv_transport) {
1334 if (params_.logs) 1358 if (params_.logging.logs)
1335 trace_to_stderr_.reset(new test::TraceToStderr); 1359 trace_to_stderr_.reset(new test::TraceToStderr);
1336 1360
1337 size_t num_video_streams = params_.ss.streams.size(); 1361 size_t num_video_streams = params_.ss.streams.size();
1338 size_t num_flexfec_streams = params_.video.flexfec ? 1 : 0; 1362 size_t num_flexfec_streams = params_.video.flexfec ? 1 : 0;
1339 CreateSendConfig(num_video_streams, 0, num_flexfec_streams, send_transport); 1363 CreateSendConfig(num_video_streams, 0, num_flexfec_streams, send_transport);
1340 1364
1341 int payload_type; 1365 int payload_type;
1342 if (params_.video.codec == "H264") { 1366 if (params_.video.codec == "H264") {
1343 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264"))); 1367 video_encoder_.reset(H264Encoder::Create(cricket::VideoCodec("H264")));
1344 payload_type = kPayloadTypeH264; 1368 payload_type = kPayloadTypeH264;
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 video_send_config_.rtp.ulpfec.ulpfec_payload_type; 1514 video_send_config_.rtp.ulpfec.ulpfec_payload_type;
1491 video_receive_configs_[params_.ss.selected_stream] 1515 video_receive_configs_[params_.ss.selected_stream]
1492 .rtp.ulpfec.red_rtx_payload_type = 1516 .rtp.ulpfec.red_rtx_payload_type =
1493 video_send_config_.rtp.ulpfec.red_rtx_payload_type; 1517 video_send_config_.rtp.ulpfec.red_rtx_payload_type;
1494 } 1518 }
1495 } 1519 }
1496 } 1520 }
1497 1521
1498 void VideoQualityTest::SetupThumbnails(Transport* send_transport, 1522 void VideoQualityTest::SetupThumbnails(Transport* send_transport,
1499 Transport* recv_transport) { 1523 Transport* recv_transport) {
1500 for (int i = 0; i < params_.num_thumbnails; ++i) { 1524 for (int i = 0; i < params_.call.num_thumbnails; ++i) {
1501 thumbnail_encoders_.emplace_back(VP8Encoder::Create()); 1525 thumbnail_encoders_.emplace_back(VP8Encoder::Create());
1502 1526
1503 // Thumbnails will be send in the other way: from receiver_call to 1527 // Thumbnails will be send in the other way: from receiver_call to
1504 // sender_call. 1528 // sender_call.
1505 VideoSendStream::Config thumbnail_send_config(recv_transport); 1529 VideoSendStream::Config thumbnail_send_config(recv_transport);
1506 thumbnail_send_config.rtp.ssrcs.push_back(kThumbnailSendSsrcStart + i); 1530 thumbnail_send_config.rtp.ssrcs.push_back(kThumbnailSendSsrcStart + i);
1507 thumbnail_send_config.encoder_settings.encoder = 1531 thumbnail_send_config.encoder_settings.encoder =
1508 thumbnail_encoders_.back().get(); 1532 thumbnail_encoders_.back().get();
1509 thumbnail_send_config.encoder_settings.payload_name = params_.video.codec; 1533 thumbnail_send_config.encoder_settings.payload_name = params_.video.codec;
1510 thumbnail_send_config.encoder_settings.payload_type = kPayloadTypeVP8; 1534 thumbnail_send_config.encoder_settings.payload_type = kPayloadTypeVP8;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
1560 thumbnail_receive_config.rtp.rtx_payload_types[kPayloadTypeVP8] = 1584 thumbnail_receive_config.rtp.rtx_payload_types[kPayloadTypeVP8] =
1561 kSendRtxPayloadType; 1585 kSendRtxPayloadType;
1562 thumbnail_receive_config.rtp.transport_cc = params_.call.send_side_bwe; 1586 thumbnail_receive_config.rtp.transport_cc = params_.call.send_side_bwe;
1563 thumbnail_receive_config.rtp.remb = !params_.call.send_side_bwe; 1587 thumbnail_receive_config.rtp.remb = !params_.call.send_side_bwe;
1564 1588
1565 thumbnail_encoder_configs_.push_back(thumbnail_encoder_config.Copy()); 1589 thumbnail_encoder_configs_.push_back(thumbnail_encoder_config.Copy());
1566 thumbnail_send_configs_.push_back(thumbnail_send_config.Copy()); 1590 thumbnail_send_configs_.push_back(thumbnail_send_config.Copy());
1567 thumbnail_receive_configs_.push_back(thumbnail_receive_config.Copy()); 1591 thumbnail_receive_configs_.push_back(thumbnail_receive_config.Copy());
1568 } 1592 }
1569 1593
1570 for (int i = 0; i < params_.num_thumbnails; ++i) { 1594 for (int i = 0; i < params_.call.num_thumbnails; ++i) {
1571 thumbnail_send_streams_.push_back(receiver_call_->CreateVideoSendStream( 1595 thumbnail_send_streams_.push_back(receiver_call_->CreateVideoSendStream(
1572 thumbnail_send_configs_[i].Copy(), 1596 thumbnail_send_configs_[i].Copy(),
1573 thumbnail_encoder_configs_[i].Copy())); 1597 thumbnail_encoder_configs_[i].Copy()));
1574 thumbnail_receive_streams_.push_back(sender_call_->CreateVideoReceiveStream( 1598 thumbnail_receive_streams_.push_back(sender_call_->CreateVideoReceiveStream(
1575 thumbnail_receive_configs_[i].Copy())); 1599 thumbnail_receive_configs_[i].Copy()));
1576 } 1600 }
1577 } 1601 }
1578 1602
1579 void VideoQualityTest::DestroyThumbnailStreams() { 1603 void VideoQualityTest::DestroyThumbnailStreams() {
1580 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) 1604 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_)
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1712 1736
1713 FILE* graph_data_output_file = nullptr; 1737 FILE* graph_data_output_file = nullptr;
1714 if (!params_.analyzer.graph_data_output_filename.empty()) { 1738 if (!params_.analyzer.graph_data_output_filename.empty()) {
1715 graph_data_output_file = 1739 graph_data_output_file =
1716 fopen(params_.analyzer.graph_data_output_filename.c_str(), "w"); 1740 fopen(params_.analyzer.graph_data_output_filename.c_str(), "w");
1717 RTC_CHECK(graph_data_output_file) 1741 RTC_CHECK(graph_data_output_file)
1718 << "Can't open the file " << params_.analyzer.graph_data_output_filename 1742 << "Can't open the file " << params_.analyzer.graph_data_output_filename
1719 << "!"; 1743 << "!";
1720 } 1744 }
1721 1745
1746 if (!params.logging.rtc_event_log_name.empty()) {
1747 event_log_ = RtcEventLog::Create(clock_);
1748 bool event_log_started =
1749 event_log_->StartLogging(params.logging.rtc_event_log_name, -1);
1750 RTC_DCHECK(event_log_started);
1751 }
1752
1722 Call::Config call_config(event_log_.get()); 1753 Call::Config call_config(event_log_.get());
1723 call_config.bitrate_config = params.call.call_bitrate_config; 1754 call_config.bitrate_config = params.call.call_bitrate_config;
1724 CreateCalls(call_config, call_config); 1755 CreateCalls(call_config, call_config);
1725 1756
1726 test::LayerFilteringTransport send_transport( 1757 test::LayerFilteringTransport send_transport(
1727 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1758 params_.pipe, sender_call_.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1728 params_.video.selected_tl, params_.ss.selected_sl, payload_type_map_); 1759 params_.video.selected_tl, params_.ss.selected_sl, payload_type_map_);
1729 1760
1730 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get(), 1761 test::DirectTransport recv_transport(params_.pipe, receiver_call_.get(),
1731 payload_type_map_); 1762 payload_type_map_);
1732 1763
1733 std::string graph_title = params_.analyzer.graph_title; 1764 std::string graph_title = params_.analyzer.graph_title;
1734 if (graph_title.empty()) 1765 if (graph_title.empty())
1735 graph_title = VideoQualityTest::GenerateGraphTitle(); 1766 graph_title = VideoQualityTest::GenerateGraphTitle();
1736 1767
1737 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest"); 1768 bool is_quick_test_enabled = field_trial::IsEnabled("WebRTC-QuickPerfTest");
1738 VideoAnalyzer analyzer( 1769 VideoAnalyzer analyzer(
1739 &send_transport, params_.analyzer.test_label, 1770 &send_transport, params_.analyzer.test_label,
1740 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold, 1771 params_.analyzer.avg_psnr_threshold, params_.analyzer.avg_ssim_threshold,
1741 is_quick_test_enabled 1772 is_quick_test_enabled
1742 ? kFramesSentInQuickTest 1773 ? kFramesSentInQuickTest
1743 : params_.analyzer.test_durations_secs * params_.video.fps, 1774 : params_.analyzer.test_durations_secs * params_.video.fps,
1744 graph_data_output_file, graph_title, 1775 graph_data_output_file, graph_title,
1745 kVideoSendSsrcs[params_.ss.selected_stream], 1776 kVideoSendSsrcs[params_.ss.selected_stream],
1746 kSendRtxSsrcs[params_.ss.selected_stream], 1777 kSendRtxSsrcs[params_.ss.selected_stream],
1747 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl, 1778 static_cast<size_t>(params_.ss.selected_stream), params.ss.selected_sl,
1748 params_.video.selected_tl, is_quick_test_enabled, clock_); 1779 params_.video.selected_tl, is_quick_test_enabled, clock_,
1780 params_.logging.rtp_dump_name);
1749 analyzer.SetCall(sender_call_.get()); 1781 analyzer.SetCall(sender_call_.get());
1750 analyzer.SetReceiver(receiver_call_->Receiver()); 1782 analyzer.SetReceiver(receiver_call_->Receiver());
1751 send_transport.SetReceiver(&analyzer); 1783 send_transport.SetReceiver(&analyzer);
1752 recv_transport.SetReceiver(sender_call_->Receiver()); 1784 recv_transport.SetReceiver(sender_call_->Receiver());
1753 1785
1754 SetupVideo(&analyzer, &recv_transport); 1786 SetupVideo(&analyzer, &recv_transport);
1755 SetupThumbnails(&analyzer, &recv_transport); 1787 SetupThumbnails(&analyzer, &recv_transport);
1756 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; 1788 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer;
1757 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); 1789 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy();
1758 RTC_DCHECK(!video_send_config_.post_encode_callback); 1790 RTC_DCHECK(!video_send_config_.post_encode_callback);
1759 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); 1791 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy();
1760 1792
1761 SetupScreenshareOrSVC(); 1793 SetupScreenshareOrSVC();
1762 1794
1763 CreateFlexfecStreams(); 1795 CreateFlexfecStreams();
1764 CreateVideoStreams(); 1796 CreateVideoStreams();
1765 analyzer.SetSendStream(video_send_stream_); 1797 analyzer.SetSendStream(video_send_stream_);
1766 if (video_receive_streams_.size() == 1) 1798 if (video_receive_streams_.size() == 1)
1767 analyzer.SetReceiveStream(video_receive_streams_[0]); 1799 analyzer.SetReceiveStream(video_receive_streams_[0]);
1768 1800
1769 video_send_stream_->SetSource(analyzer.OutputInterface(), 1801 video_send_stream_->SetSource(analyzer.OutputInterface(),
1770 degradation_preference_); 1802 degradation_preference_);
1771 1803
1772 SetupThumbnailCapturers(params_.num_thumbnails); 1804 SetupThumbnailCapturers(params_.call.num_thumbnails);
1773 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) { 1805 for (size_t i = 0; i < thumbnail_send_streams_.size(); ++i) {
1774 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(), 1806 thumbnail_send_streams_[i]->SetSource(thumbnail_capturers_[i].get(),
1775 degradation_preference_); 1807 degradation_preference_);
1776 } 1808 }
1777 1809
1778 CreateCapturer(); 1810 CreateCapturer();
1779 1811
1780 analyzer.SetSource(video_capturer_.get(), params_.ss.infer_streams); 1812 analyzer.SetSource(video_capturer_.get(), params_.ss.infer_streams);
1781 1813
1782 StartEncodedFrameLogs(video_send_stream_); 1814 StartEncodedFrameLogs(video_send_stream_);
1783 StartEncodedFrameLogs(video_receive_streams_[0]); 1815 StartEncodedFrameLogs(video_receive_streams_[params_.ss.selected_stream]);
1784 video_send_stream_->Start(); 1816 video_send_stream_->Start();
1785 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) 1817 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_)
1786 thumbnail_send_stream->Start(); 1818 thumbnail_send_stream->Start();
1787 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1819 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1788 receive_stream->Start(); 1820 receive_stream->Start();
1789 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_) 1821 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_)
1790 receive_stream->Start(); 1822 receive_stream->Start();
1791 for (VideoReceiveStream* thumbnail_receive_stream : 1823 for (VideoReceiveStream* thumbnail_receive_stream :
1792 thumbnail_receive_streams_) 1824 thumbnail_receive_streams_)
1793 thumbnail_receive_stream->Start(); 1825 thumbnail_receive_stream->Start();
(...skipping 22 matching lines...) Expand all
1816 receive_stream->Stop(); 1848 receive_stream->Stop();
1817 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1849 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1818 receive_stream->Stop(); 1850 receive_stream->Stop();
1819 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_) 1851 for (VideoSendStream* thumbnail_send_stream : thumbnail_send_streams_)
1820 thumbnail_send_stream->Stop(); 1852 thumbnail_send_stream->Stop();
1821 video_send_stream_->Stop(); 1853 video_send_stream_->Stop();
1822 1854
1823 DestroyStreams(); 1855 DestroyStreams();
1824 DestroyThumbnailStreams(); 1856 DestroyThumbnailStreams();
1825 1857
1858 event_log_->StopLogging();
1826 if (graph_data_output_file) 1859 if (graph_data_output_file)
1827 fclose(graph_data_output_file); 1860 fclose(graph_data_output_file);
1828 } 1861 }
1829 1862
1830 void VideoQualityTest::SetupAudio(int send_channel_id, 1863 void VideoQualityTest::SetupAudio(int send_channel_id,
1831 int receive_channel_id, 1864 int receive_channel_id,
1832 Transport* transport, 1865 Transport* transport,
1833 AudioReceiveStream** audio_receive_stream) { 1866 AudioReceiveStream** audio_receive_stream) {
1834 audio_send_config_ = AudioSendStream::Config(transport); 1867 audio_send_config_ = AudioSendStream::Config(transport);
1835 audio_send_config_.voe_channel_id = send_channel_id; 1868 audio_send_config_.voe_channel_id = send_channel_id;
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
2024 } 2057 }
2025 2058
2026 send_transport.StopSending(); 2059 send_transport.StopSending();
2027 recv_transport.StopSending(); 2060 recv_transport.StopSending();
2028 2061
2029 if (params_.audio.enabled) 2062 if (params_.audio.enabled)
2030 DestroyVoiceEngine(&voe); 2063 DestroyVoiceEngine(&voe);
2031 } 2064 }
2032 2065
2033 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { 2066 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) {
2034 if (!params_.video.encoded_frame_base_path.empty()) { 2067 if (!params_.logging.encoded_frame_base_path.empty()) {
2035 std::ostringstream str; 2068 std::ostringstream str;
2036 str << send_logs_++; 2069 str << send_logs_++;
2037 std::string prefix = 2070 std::string prefix =
2038 params_.video.encoded_frame_base_path + "." + str.str() + ".send."; 2071 params_.logging.encoded_frame_base_path + "." + str.str() + ".send.";
2039 stream->EnableEncodedFrameRecording( 2072 stream->EnableEncodedFrameRecording(
2040 std::vector<rtc::PlatformFile>( 2073 std::vector<rtc::PlatformFile>(
2041 {rtc::CreatePlatformFile(prefix + "1.ivf"), 2074 {rtc::CreatePlatformFile(prefix + "1.ivf"),
2042 rtc::CreatePlatformFile(prefix + "2.ivf"), 2075 rtc::CreatePlatformFile(prefix + "2.ivf"),
2043 rtc::CreatePlatformFile(prefix + "3.ivf")}), 2076 rtc::CreatePlatformFile(prefix + "3.ivf")}),
2044 10000000); 2077 100000000);
2045 } 2078 }
2046 } 2079 }
2047 2080
2048 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) { 2081 void VideoQualityTest::StartEncodedFrameLogs(VideoReceiveStream* stream) {
2049 if (!params_.video.encoded_frame_base_path.empty()) { 2082 if (!params_.logging.encoded_frame_base_path.empty()) {
2050 std::ostringstream str; 2083 std::ostringstream str;
2051 str << receive_logs_++; 2084 str << receive_logs_++;
2052 std::string path = 2085 std::string path =
2053 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 2086 params_.logging.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
2054 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 2087 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
2055 10000000); 2088 100000000);
2056 } 2089 }
2057 } 2090 }
2058 } // namespace webrtc 2091 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/video/video_quality_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698