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

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

Issue 2500373002: Configure FlexFEC in VideoQualityTest. (Closed)
Patch Set: Actually create FlexfecReceiveStream in RunWithRenderers. Created 4 years, 1 month 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 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_); 810 std::deque<FrameComparison> comparisons_ GUARDED_BY(comparison_lock_);
811 rtc::Event done_; 811 rtc::Event done_;
812 }; 812 };
813 813
814 VideoQualityTest::VideoQualityTest() 814 VideoQualityTest::VideoQualityTest()
815 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {} 815 : clock_(Clock::GetRealTimeClock()), receive_logs_(0), send_logs_(0) {}
816 816
817 VideoQualityTest::Params::Params() 817 VideoQualityTest::Params::Params()
818 : call({false, Call::Config::BitrateConfig()}), 818 : call({false, Call::Config::BitrateConfig()}),
819 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false, 819 video({false, 640, 480, 30, 50, 800, 800, false, "VP8", 1, -1, 0, false,
820 "", ""}), 820 false, "", ""}),
821 audio({false, false}), 821 audio({false, false}),
822 screenshare({false, 10, 0}), 822 screenshare({false, 10, 0}),
823 analyzer({"", 0.0, 0.0, 0, "", ""}), 823 analyzer({"", 0.0, 0.0, 0, "", ""}),
824 pipe(), 824 pipe(),
825 logs(false), 825 logs(false),
826 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}) {} 826 ss({std::vector<VideoStream>(), 0, 0, -1, std::vector<SpatialLayer>()}) {}
827 827
828 VideoQualityTest::Params::~Params() = default; 828 VideoQualityTest::Params::~Params() = default;
829 829
830 void VideoQualityTest::TestBody() {} 830 void VideoQualityTest::TestBody() {}
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 RtpExtension(RtpExtension::kTransportSequenceNumberUri, 1031 RtpExtension(RtpExtension::kTransportSequenceNumberUri,
1032 test::kTransportSequenceNumberExtensionId)); 1032 test::kTransportSequenceNumberExtensionId));
1033 } else { 1033 } else {
1034 video_send_config_.rtp.extensions.push_back(RtpExtension( 1034 video_send_config_.rtp.extensions.push_back(RtpExtension(
1035 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId)); 1035 RtpExtension::kAbsSendTimeUri, test::kAbsSendTimeExtensionId));
1036 } 1036 }
1037 1037
1038 video_encoder_config_.min_transmit_bitrate_bps = 1038 video_encoder_config_.min_transmit_bitrate_bps =
1039 params_.video.min_transmit_bps; 1039 params_.video.min_transmit_bps;
1040 1040
1041 video_send_config_.suspend_below_min_bitrate =
1042 params_.video.suspend_below_min_bitrate;
1043
1041 video_encoder_config_.number_of_streams = params_.ss.streams.size(); 1044 video_encoder_config_.number_of_streams = params_.ss.streams.size();
1042 video_encoder_config_.max_bitrate_bps = 0; 1045 video_encoder_config_.max_bitrate_bps = 0;
1043 for (size_t i = 0; i < params_.ss.streams.size(); ++i) { 1046 for (size_t i = 0; i < params_.ss.streams.size(); ++i) {
1044 video_encoder_config_.max_bitrate_bps += 1047 video_encoder_config_.max_bitrate_bps +=
1045 params_.ss.streams[i].max_bitrate_bps; 1048 params_.ss.streams[i].max_bitrate_bps;
1046 } 1049 }
1047 video_encoder_config_.video_stream_factory = 1050 video_encoder_config_.video_stream_factory =
1048 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams); 1051 new rtc::RefCountedObject<VideoStreamFactory>(params_.ss.streams);
1049 1052
1050 video_encoder_config_.spatial_layers = params_.ss.spatial_layers; 1053 video_encoder_config_.spatial_layers = params_.ss.spatial_layers;
1051 1054
1052 CreateMatchingReceiveConfigs(recv_transport); 1055 CreateMatchingReceiveConfigs(recv_transport);
1053 1056
1054 for (size_t i = 0; i < num_streams; ++i) { 1057 for (size_t i = 0; i < num_streams; ++i) {
1055 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 1058 video_receive_configs_[i].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
1056 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i]; 1059 video_receive_configs_[i].rtp.rtx[payload_type].ssrc = kSendRtxSsrcs[i];
1057 video_receive_configs_[i].rtp.rtx[payload_type].payload_type = 1060 video_receive_configs_[i].rtp.rtx[payload_type].payload_type =
1058 kSendRtxPayloadType; 1061 kSendRtxPayloadType;
1059 video_receive_configs_[i].rtp.transport_cc = params_.call.send_side_bwe; 1062 video_receive_configs_[i].rtp.transport_cc = params_.call.send_side_bwe;
1060 } 1063 }
1064
1065 if (params_.video.flexfec) {
1066 video_send_config_.rtp.flexfec.flexfec_payload_type = kFlexfecPayloadType;
1067 video_send_config_.rtp.flexfec.flexfec_ssrc = kFlexfecSendSsrc;
1068 video_send_config_.rtp.flexfec.protected_media_ssrcs = {
1069 kVideoSendSsrcs[params_.ss.selected_stream]};
1070
1071 FlexfecReceiveStream::Config flexfec_receive_config;
1072 flexfec_receive_config.flexfec_payload_type =
1073 video_send_config_.rtp.flexfec.flexfec_payload_type;
1074 flexfec_receive_config.flexfec_ssrc =
1075 video_send_config_.rtp.flexfec.flexfec_ssrc;
1076 flexfec_receive_config.protected_media_ssrcs =
1077 video_send_config_.rtp.flexfec.protected_media_ssrcs;
1078 flexfec_receive_configs_.push_back(flexfec_receive_config);
1079 }
1080
1081 if (params_.video.ulpfec) {
1082 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType;
1083 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
1084 video_send_config_.rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType;
1085
1086 video_receive_configs_[params_.ss.selected_stream]
1087 .rtp.ulpfec.red_payload_type =
1088 video_send_config_.rtp.ulpfec.red_payload_type;
1089 video_receive_configs_[params_.ss.selected_stream]
1090 .rtp.ulpfec.ulpfec_payload_type =
1091 video_send_config_.rtp.ulpfec.ulpfec_payload_type;
1092 video_receive_configs_[params_.ss.selected_stream]
1093 .rtp.ulpfec.red_rtx_payload_type =
1094 video_send_config_.rtp.ulpfec.red_rtx_payload_type;
1095 }
1061 } 1096 }
1062 1097
1063 void VideoQualityTest::SetupScreenshare() { 1098 void VideoQualityTest::SetupScreenshare() {
1064 RTC_CHECK(params_.screenshare.enabled); 1099 RTC_CHECK(params_.screenshare.enabled);
1065 1100
1066 // Fill out codec settings. 1101 // Fill out codec settings.
1067 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; 1102 video_encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen;
1068 if (params_.video.codec == "VP8") { 1103 if (params_.video.codec == "VP8") {
1069 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); 1104 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings();
1070 vp8_settings.denoisingOn = false; 1105 vp8_settings.denoisingOn = false;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1208 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer; 1243 video_receive_configs_[params_.ss.selected_stream].renderer = &analyzer;
1209 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy(); 1244 video_send_config_.pre_encode_callback = analyzer.pre_encode_proxy();
1210 for (auto& config : video_receive_configs_) 1245 for (auto& config : video_receive_configs_)
1211 config.pre_decode_callback = &analyzer; 1246 config.pre_decode_callback = &analyzer;
1212 RTC_DCHECK(!video_send_config_.post_encode_callback); 1247 RTC_DCHECK(!video_send_config_.post_encode_callback);
1213 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy(); 1248 video_send_config_.post_encode_callback = analyzer.encode_timing_proxy();
1214 1249
1215 if (params_.screenshare.enabled) 1250 if (params_.screenshare.enabled)
1216 SetupScreenshare(); 1251 SetupScreenshare();
1217 1252
1253 CreateFlexfecStreams();
1218 CreateVideoStreams(); 1254 CreateVideoStreams();
1219 analyzer.SetSendStream(video_send_stream_); 1255 analyzer.SetSendStream(video_send_stream_);
1220 video_send_stream_->SetSource( 1256 video_send_stream_->SetSource(
1221 analyzer.OutputInterface(), 1257 analyzer.OutputInterface(),
1222 VideoSendStream::DegradationPreference::kBalanced); 1258 VideoSendStream::DegradationPreference::kBalanced);
1223 1259
1224 CreateCapturer(); 1260 CreateCapturer();
1225 rtc::VideoSinkWants wants; 1261 rtc::VideoSinkWants wants;
1226 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants); 1262 video_capturer_->AddOrUpdateSink(analyzer.InputInterface(), wants);
1227 1263
1228 StartEncodedFrameLogs(video_send_stream_); 1264 StartEncodedFrameLogs(video_send_stream_);
1229 StartEncodedFrameLogs(video_receive_streams_[0]); 1265 StartEncodedFrameLogs(video_receive_streams_[0]);
1230 video_send_stream_->Start(); 1266 video_send_stream_->Start();
1231 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1267 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1232 receive_stream->Start(); 1268 receive_stream->Start();
1269 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_)
1270 receive_stream->Start();
1233 video_capturer_->Start(); 1271 video_capturer_->Start();
1234 1272
1235 analyzer.Wait(); 1273 analyzer.Wait();
1236 1274
1237 send_transport.StopSending(); 1275 send_transport.StopSending();
1238 recv_transport.StopSending(); 1276 recv_transport.StopSending();
1239 1277
1240 video_capturer_->Stop(); 1278 video_capturer_->Stop();
1279 for (FlexfecReceiveStream* receive_stream : flexfec_receive_streams_)
1280 receive_stream->Stop();
1241 for (VideoReceiveStream* receive_stream : video_receive_streams_) 1281 for (VideoReceiveStream* receive_stream : video_receive_streams_)
1242 receive_stream->Stop(); 1282 receive_stream->Stop();
1243 video_send_stream_->Stop(); 1283 video_send_stream_->Stop();
1244 1284
1245 DestroyStreams(); 1285 DestroyStreams();
1246 1286
1247 if (graph_data_output_file) 1287 if (graph_data_output_file)
1248 fclose(graph_data_output_file); 1288 fclose(graph_data_output_file);
1249 } 1289 }
1250 1290
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 // calls. 1350 // calls.
1311 test::LayerFilteringTransport transport( 1351 test::LayerFilteringTransport transport(
1312 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9, 1352 params.pipe, call.get(), kPayloadTypeVP8, kPayloadTypeVP9,
1313 params.video.selected_tl, params_.ss.selected_sl); 1353 params.video.selected_tl, params_.ss.selected_sl);
1314 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at 1354 // TODO(ivica): Use two calls to be able to merge with RunWithAnalyzer or at
1315 // least share as much code as possible. That way this test would also match 1355 // least share as much code as possible. That way this test would also match
1316 // the full stack tests better. 1356 // the full stack tests better.
1317 transport.SetReceiver(call->Receiver()); 1357 transport.SetReceiver(call->Receiver());
1318 1358
1319 VideoReceiveStream* video_receive_stream = nullptr; 1359 VideoReceiveStream* video_receive_stream = nullptr;
1360 FlexfecReceiveStream* flexfec_receive_stream = nullptr;
1320 std::unique_ptr<test::VideoRenderer> local_preview; 1361 std::unique_ptr<test::VideoRenderer> local_preview;
1321 std::unique_ptr<test::VideoRenderer> loopback_video; 1362 std::unique_ptr<test::VideoRenderer> loopback_video;
1322 if (params_.video.enabled) { 1363 if (params_.video.enabled) {
1323 // Create video renderers. 1364 // Create video renderers.
1324 local_preview.reset(test::VideoRenderer::Create( 1365 local_preview.reset(test::VideoRenderer::Create(
1325 "Local Preview", params_.video.width, params_.video.height)); 1366 "Local Preview", params_.video.width, params_.video.height));
1326 1367
1327 size_t stream_id = params_.ss.selected_stream; 1368 size_t stream_id = params_.ss.selected_stream;
1328 std::string title = "Loopback Video"; 1369 std::string title = "Loopback Video";
1329 if (params_.ss.streams.size() > 1) { 1370 if (params_.ss.streams.size() > 1) {
1330 std::ostringstream s; 1371 std::ostringstream s;
1331 s << stream_id; 1372 s << stream_id;
1332 title += " - Stream #" + s.str(); 1373 title += " - Stream #" + s.str();
1333 } 1374 }
1334 1375
1335 loopback_video.reset(test::VideoRenderer::Create( 1376 loopback_video.reset(test::VideoRenderer::Create(
1336 title.c_str(), params_.ss.streams[stream_id].width, 1377 title.c_str(), params_.ss.streams[stream_id].width,
1337 params_.ss.streams[stream_id].height)); 1378 params_.ss.streams[stream_id].height));
1338 1379
1339 SetupVideo(&transport, &transport); 1380 SetupVideo(&transport, &transport);
1340
1341 // TODO(minyue): maybe move the following to SetupVideo() to make code
1342 // cleaner. Currently, RunWithRenderers() and RunWithAnalyzer() differ in
1343 // the way they treat FEC etc., which makes it complicated to put these
1344 // additional video setup into SetupVideo().
1345 video_send_config_.pre_encode_callback = local_preview.get(); 1381 video_send_config_.pre_encode_callback = local_preview.get();
1346 video_receive_configs_[stream_id].renderer = loopback_video.get(); 1382 video_receive_configs_[stream_id].renderer = loopback_video.get();
1347 if (params_.audio.enabled && params_.audio.sync_video) 1383 if (params_.audio.enabled && params_.audio.sync_video)
1348 video_receive_configs_[stream_id].sync_group = kSyncGroup; 1384 video_receive_configs_[stream_id].sync_group = kSyncGroup;
1349 1385
1350 video_send_config_.suspend_below_min_bitrate =
1351 params_.video.suspend_below_min_bitrate;
1352
1353 if (params.video.fec) {
1354 video_send_config_.rtp.ulpfec.red_payload_type = kRedPayloadType;
1355 video_send_config_.rtp.ulpfec.ulpfec_payload_type = kUlpfecPayloadType;
1356 video_send_config_.rtp.ulpfec.red_rtx_payload_type = kRtxRedPayloadType;
1357 video_receive_configs_[stream_id].rtp.ulpfec.red_payload_type =
1358 kRedPayloadType;
1359 video_receive_configs_[stream_id].rtp.ulpfec.ulpfec_payload_type =
1360 kUlpfecPayloadType;
1361 video_receive_configs_[stream_id].rtp.ulpfec.red_rtx_payload_type =
1362 kRtxRedPayloadType;
1363 }
1364
1365 if (params_.screenshare.enabled) 1386 if (params_.screenshare.enabled)
1366 SetupScreenshare(); 1387 SetupScreenshare();
1367 1388
1368 video_send_stream_ = call->CreateVideoSendStream( 1389 video_send_stream_ = call->CreateVideoSendStream(
1369 video_send_config_.Copy(), video_encoder_config_.Copy()); 1390 video_send_config_.Copy(), video_encoder_config_.Copy());
1391 if (params_.video.flexfec) {
1392 RTC_DCHECK(!flexfec_receive_configs_.empty());
1393 flexfec_receive_stream =
1394 call->CreateFlexfecReceiveStream(flexfec_receive_configs_[0]);
1395 }
1370 video_receive_stream = call->CreateVideoReceiveStream( 1396 video_receive_stream = call->CreateVideoReceiveStream(
1371 video_receive_configs_[stream_id].Copy()); 1397 video_receive_configs_[stream_id].Copy());
1372 CreateCapturer(); 1398 CreateCapturer();
1373 video_send_stream_->SetSource( 1399 video_send_stream_->SetSource(
1374 video_capturer_.get(), 1400 video_capturer_.get(),
1375 VideoSendStream::DegradationPreference::kBalanced); 1401 VideoSendStream::DegradationPreference::kBalanced);
1376 } 1402 }
1377 1403
1378 AudioReceiveStream* audio_receive_stream = nullptr; 1404 AudioReceiveStream* audio_receive_stream = nullptr;
1379 if (params_.audio.enabled) { 1405 if (params_.audio.enabled) {
1380 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(), 1406 SetupAudio(voe.send_channel_id, voe.receive_channel_id, call.get(),
1381 &transport, &audio_receive_stream); 1407 &transport, &audio_receive_stream);
1382 } 1408 }
1383 1409
1384 StartEncodedFrameLogs(video_receive_stream); 1410 StartEncodedFrameLogs(video_receive_stream);
1385 StartEncodedFrameLogs(video_send_stream_); 1411 StartEncodedFrameLogs(video_send_stream_);
1386 1412
1387 // Start sending and receiving video. 1413 // Start sending and receiving video.
1388 if (params_.video.enabled) { 1414 if (params_.video.enabled) {
1415 if (flexfec_receive_stream)
1416 flexfec_receive_stream->Start();
1389 video_receive_stream->Start(); 1417 video_receive_stream->Start();
1390 video_send_stream_->Start(); 1418 video_send_stream_->Start();
1391 video_capturer_->Start(); 1419 video_capturer_->Start();
1392 } 1420 }
1393 1421
1394 if (params_.audio.enabled) { 1422 if (params_.audio.enabled) {
1395 // Start receiving audio. 1423 // Start receiving audio.
1396 audio_receive_stream->Start(); 1424 audio_receive_stream->Start();
1397 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id)); 1425 EXPECT_EQ(0, voe.base->StartPlayout(voe.receive_channel_id));
1398 1426
(...skipping 14 matching lines...) Expand all
1413 audio_receive_stream->Stop(); 1441 audio_receive_stream->Stop();
1414 call->DestroyAudioSendStream(audio_send_stream_); 1442 call->DestroyAudioSendStream(audio_send_stream_);
1415 call->DestroyAudioReceiveStream(audio_receive_stream); 1443 call->DestroyAudioReceiveStream(audio_receive_stream);
1416 } 1444 }
1417 1445
1418 // Stop receiving and sending video. 1446 // Stop receiving and sending video.
1419 if (params_.video.enabled) { 1447 if (params_.video.enabled) {
1420 video_capturer_->Stop(); 1448 video_capturer_->Stop();
1421 video_send_stream_->Stop(); 1449 video_send_stream_->Stop();
1422 video_receive_stream->Stop(); 1450 video_receive_stream->Stop();
1451 if (flexfec_receive_stream) {
1452 flexfec_receive_stream->Stop();
1453 call->DestroyFlexfecReceiveStream(flexfec_receive_stream);
1454 }
1423 call->DestroyVideoReceiveStream(video_receive_stream); 1455 call->DestroyVideoReceiveStream(video_receive_stream);
1424 call->DestroyVideoSendStream(video_send_stream_); 1456 call->DestroyVideoSendStream(video_send_stream_);
1425 } 1457 }
1426 1458
1427 transport.StopSending(); 1459 transport.StopSending();
1428 if (params_.audio.enabled) 1460 if (params_.audio.enabled)
1429 DestroyVoiceEngine(&voe); 1461 DestroyVoiceEngine(&voe);
1430 } 1462 }
1431 1463
1432 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) { 1464 void VideoQualityTest::StartEncodedFrameLogs(VideoSendStream* stream) {
(...skipping 15 matching lines...) Expand all
1448 std::ostringstream str; 1480 std::ostringstream str;
1449 str << receive_logs_++; 1481 str << receive_logs_++;
1450 std::string path = 1482 std::string path =
1451 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf"; 1483 params_.video.encoded_frame_base_path + "." + str.str() + ".recv.ivf";
1452 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path), 1484 stream->EnableEncodedFrameRecording(rtc::CreatePlatformFile(path),
1453 10000000); 1485 10000000);
1454 } 1486 }
1455 } 1487 }
1456 1488
1457 } // namespace webrtc 1489 } // 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