You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

713 lines
20 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
  3. *
  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
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #include <stdio.h>
  11. #include <memory>
  12. #include <string>
  13. #include <vector>
  14. #include "absl/flags/flag.h"
  15. #include "absl/flags/parse.h"
  16. #include "absl/types/optional.h"
  17. #include "api/test/simulated_network.h"
  18. #include "api/test/video_quality_test_fixture.h"
  19. #include "api/transport/bitrate_settings.h"
  20. #include "api/video_codecs/video_codec.h"
  21. #include "rtc_base/checks.h"
  22. #include "rtc_base/logging.h"
  23. #include "rtc_base/string_encode.h"
  24. #include "system_wrappers/include/field_trial.h"
  25. #include "test/field_trial.h"
  26. #include "test/gtest.h"
  27. #include "test/run_test.h"
  28. #include "video/video_quality_test.h"
  29. // Flags for video.
  30. ABSL_FLAG(int, vwidth, 640, "Video width.");
  31. ABSL_FLAG(int, vheight, 480, "Video height.");
  32. ABSL_FLAG(int, vfps, 30, "Video frames per second.");
  33. ABSL_FLAG(int,
  34. capture_device_index,
  35. 0,
  36. "Capture device to select for video stream");
  37. ABSL_FLAG(int, vtarget_bitrate, 400, "Video stream target bitrate in kbps.");
  38. ABSL_FLAG(int, vmin_bitrate, 100, "Video stream min bitrate in kbps.");
  39. ABSL_FLAG(int, vmax_bitrate, 2000, "Video stream max bitrate in kbps.");
  40. ABSL_FLAG(bool,
  41. suspend_below_min_bitrate,
  42. false,
  43. "Suspends video below the configured min bitrate.");
  44. ABSL_FLAG(int,
  45. vnum_temporal_layers,
  46. 1,
  47. "Number of temporal layers for video. Set to 1-4 to override.");
  48. ABSL_FLAG(int, vnum_streams, 0, "Number of video streams to show or analyze.");
  49. ABSL_FLAG(int,
  50. vnum_spatial_layers,
  51. 1,
  52. "Number of video spatial layers to use.");
  53. ABSL_FLAG(int,
  54. vinter_layer_pred,
  55. 2,
  56. "Video inter-layer prediction mode. "
  57. "0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
  58. ABSL_FLAG(std::string,
  59. vstream0,
  60. "",
  61. "Comma separated values describing VideoStream for video stream #0.");
  62. ABSL_FLAG(std::string,
  63. vstream1,
  64. "",
  65. "Comma separated values describing VideoStream for video stream #1.");
  66. ABSL_FLAG(std::string,
  67. vsl0,
  68. "",
  69. "Comma separated values describing SpatialLayer for video layer #0.");
  70. ABSL_FLAG(std::string,
  71. vsl1,
  72. "",
  73. "Comma separated values describing SpatialLayer for video layer #1.");
  74. ABSL_FLAG(int,
  75. vselected_tl,
  76. -1,
  77. "Temporal layer to show or analyze for screenshare. -1 to disable "
  78. "filtering.");
  79. ABSL_FLAG(int,
  80. vselected_stream,
  81. 0,
  82. "ID of the stream to show or analyze for screenshare."
  83. "Set to the number of streams to show them all.");
  84. ABSL_FLAG(int,
  85. vselected_sl,
  86. -1,
  87. "Spatial layer to show or analyze for screenshare. -1 to disable "
  88. "filtering.");
  89. // Flags for screenshare.
  90. ABSL_FLAG(int,
  91. min_transmit_bitrate,
  92. 400,
  93. "Min transmit bitrate incl. padding for screenshare.");
  94. ABSL_FLAG(int, swidth, 1850, "Screenshare width (crops source).");
  95. ABSL_FLAG(int, sheight, 1110, "Screenshare height (crops source).");
  96. ABSL_FLAG(int, sfps, 5, "Frames per second for screenshare.");
  97. ABSL_FLAG(int,
  98. starget_bitrate,
  99. 100,
  100. "Screenshare stream target bitrate in kbps.");
  101. ABSL_FLAG(int, smin_bitrate, 100, "Screenshare stream min bitrate in kbps.");
  102. ABSL_FLAG(int, smax_bitrate, 2000, "Screenshare stream max bitrate in kbps.");
  103. ABSL_FLAG(int,
  104. snum_temporal_layers,
  105. 2,
  106. "Number of temporal layers to use in screenshare.");
  107. ABSL_FLAG(int,
  108. snum_streams,
  109. 0,
  110. "Number of screenshare streams to show or analyze.");
  111. ABSL_FLAG(int,
  112. snum_spatial_layers,
  113. 1,
  114. "Number of screenshare spatial layers to use.");
  115. ABSL_FLAG(int,
  116. sinter_layer_pred,
  117. 0,
  118. "Screenshare inter-layer prediction mode. "
  119. "0 - enabled, 1 - disabled, 2 - enabled only for key pictures.");
  120. ABSL_FLAG(
  121. std::string,
  122. sstream0,
  123. "",
  124. "Comma separated values describing VideoStream for screenshare stream #0.");
  125. ABSL_FLAG(
  126. std::string,
  127. sstream1,
  128. "",
  129. "Comma separated values describing VideoStream for screenshare stream #1.");
  130. ABSL_FLAG(
  131. std::string,
  132. ssl0,
  133. "",
  134. "Comma separated values describing SpatialLayer for screenshare layer #0.");
  135. ABSL_FLAG(
  136. std::string,
  137. ssl1,
  138. "",
  139. "Comma separated values describing SpatialLayer for screenshare layer #1.");
  140. ABSL_FLAG(int,
  141. sselected_tl,
  142. -1,
  143. "Temporal layer to show or analyze for screenshare. -1 to disable "
  144. "filtering.");
  145. ABSL_FLAG(int,
  146. sselected_stream,
  147. 0,
  148. "ID of the stream to show or analyze for screenshare."
  149. "Set to the number of streams to show them all.");
  150. ABSL_FLAG(int,
  151. sselected_sl,
  152. -1,
  153. "Spatial layer to show or analyze for screenshare. -1 to disable "
  154. "filtering.");
  155. ABSL_FLAG(bool,
  156. generate_slides,
  157. false,
  158. "Whether to use randomly generated slides or read them from files.");
  159. ABSL_FLAG(int,
  160. slide_change_interval,
  161. 10,
  162. "Interval (in seconds) between simulated slide changes.");
  163. ABSL_FLAG(
  164. int,
  165. scroll_duration,
  166. 0,
  167. "Duration (in seconds) during which a slide will be scrolled into place.");
  168. ABSL_FLAG(std::string,
  169. slides,
  170. "",
  171. "Comma-separated list of *.yuv files to display as slides.");
  172. // Flags common with screenshare and video loopback, with equal default values.
  173. ABSL_FLAG(int, start_bitrate, 600, "Call start bitrate in kbps.");
  174. ABSL_FLAG(std::string, codec, "VP8", "Video codec to use.");
  175. ABSL_FLAG(bool,
  176. analyze_video,
  177. false,
  178. "Analyze video stream (if --duration is present)");
  179. ABSL_FLAG(bool,
  180. analyze_screenshare,
  181. false,
  182. "Analyze screenshare stream (if --duration is present)");
  183. ABSL_FLAG(
  184. int,
  185. duration,
  186. 0,
  187. "Duration of the test in seconds. If 0, rendered will be shown instead.");
  188. ABSL_FLAG(std::string, output_filename, "", "Target graph data filename.");
  189. ABSL_FLAG(std::string,
  190. graph_title,
  191. "",
  192. "If empty, title will be generated automatically.");
  193. ABSL_FLAG(int, loss_percent, 0, "Percentage of packets randomly lost.");
  194. ABSL_FLAG(int,
  195. avg_burst_loss_length,
  196. -1,
  197. "Average burst length of lost packets.");
  198. ABSL_FLAG(int,
  199. link_capacity,
  200. 0,
  201. "Capacity (kbps) of the fake link. 0 means infinite.");
  202. ABSL_FLAG(int, queue_size, 0, "Size of the bottleneck link queue in packets.");
  203. ABSL_FLAG(int,
  204. avg_propagation_delay_ms,
  205. 0,
  206. "Average link propagation delay in ms.");
  207. ABSL_FLAG(std::string,
  208. rtc_event_log_name,
  209. "",
  210. "Filename for rtc event log. Two files "
  211. "with \"_send\" and \"_recv\" suffixes will be created. "
  212. "Works only when --duration is set.");
  213. ABSL_FLAG(std::string,
  214. rtp_dump_name,
  215. "",
  216. "Filename for dumped received RTP stream.");
  217. ABSL_FLAG(int,
  218. std_propagation_delay_ms,
  219. 0,
  220. "Link propagation delay standard deviation in ms.");
  221. ABSL_FLAG(std::string,
  222. encoded_frame_path,
  223. "",
  224. "The base path for encoded frame logs. Created files will have "
  225. "the form <encoded_frame_path>.<n>.(recv|send.<m>).ivf");
  226. ABSL_FLAG(bool, logs, false, "print logs to stderr");
  227. ABSL_FLAG(bool, send_side_bwe, true, "Use send-side bandwidth estimation");
  228. ABSL_FLAG(bool, generic_descriptor, false, "Use the generic frame descriptor.");
  229. ABSL_FLAG(bool, allow_reordering, false, "Allow packet reordering to occur");
  230. ABSL_FLAG(bool, use_ulpfec, false, "Use RED+ULPFEC forward error correction.");
  231. ABSL_FLAG(bool, use_flexfec, false, "Use FlexFEC forward error correction.");
  232. ABSL_FLAG(bool, audio, false, "Add audio stream");
  233. ABSL_FLAG(bool,
  234. audio_video_sync,
  235. false,
  236. "Sync audio and video stream (no effect if"
  237. " audio is false)");
  238. ABSL_FLAG(bool,
  239. audio_dtx,
  240. false,
  241. "Enable audio DTX (no effect if audio is false)");
  242. ABSL_FLAG(bool, video, true, "Add video stream");
  243. ABSL_FLAG(
  244. std::string,
  245. force_fieldtrials,
  246. "",
  247. "Field trials control experimental feature code which can be forced. "
  248. "E.g. running with --force_fieldtrials=WebRTC-FooFeature/Enable/"
  249. " will assign the group Enable to field trial WebRTC-FooFeature. Multiple "
  250. "trials are separated by \"/\"");
  251. // Video-specific flags.
  252. ABSL_FLAG(std::string,
  253. vclip,
  254. "",
  255. "Name of the clip to show. If empty, the camera is used. Use "
  256. "\"Generator\" for chroma generator.");
  257. namespace webrtc {
  258. namespace {
  259. InterLayerPredMode IntToInterLayerPredMode(int inter_layer_pred) {
  260. if (inter_layer_pred == 0) {
  261. return InterLayerPredMode::kOn;
  262. } else if (inter_layer_pred == 1) {
  263. return InterLayerPredMode::kOff;
  264. } else {
  265. RTC_DCHECK_EQ(inter_layer_pred, 2);
  266. return InterLayerPredMode::kOnKeyPic;
  267. }
  268. }
  269. size_t VideoWidth() {
  270. return static_cast<size_t>(absl::GetFlag(FLAGS_vwidth));
  271. }
  272. size_t VideoHeight() {
  273. return static_cast<size_t>(absl::GetFlag(FLAGS_vheight));
  274. }
  275. int VideoFps() {
  276. return absl::GetFlag(FLAGS_vfps);
  277. }
  278. size_t GetCaptureDevice() {
  279. return static_cast<size_t>(absl::GetFlag(FLAGS_capture_device_index));
  280. }
  281. int VideoTargetBitrateKbps() {
  282. return absl::GetFlag(FLAGS_vtarget_bitrate);
  283. }
  284. int VideoMinBitrateKbps() {
  285. return absl::GetFlag(FLAGS_vmin_bitrate);
  286. }
  287. int VideoMaxBitrateKbps() {
  288. return absl::GetFlag(FLAGS_vmax_bitrate);
  289. }
  290. int VideoNumTemporalLayers() {
  291. return absl::GetFlag(FLAGS_vnum_temporal_layers);
  292. }
  293. int VideoNumStreams() {
  294. return absl::GetFlag(FLAGS_vnum_streams);
  295. }
  296. int VideoNumSpatialLayers() {
  297. return absl::GetFlag(FLAGS_vnum_spatial_layers);
  298. }
  299. InterLayerPredMode VideoInterLayerPred() {
  300. return IntToInterLayerPredMode(absl::GetFlag(FLAGS_vinter_layer_pred));
  301. }
  302. std::string VideoStream0() {
  303. return absl::GetFlag(FLAGS_vstream0);
  304. }
  305. std::string VideoStream1() {
  306. return absl::GetFlag(FLAGS_vstream1);
  307. }
  308. std::string VideoSL0() {
  309. return absl::GetFlag(FLAGS_vsl0);
  310. }
  311. std::string VideoSL1() {
  312. return absl::GetFlag(FLAGS_vsl1);
  313. }
  314. int VideoSelectedTL() {
  315. return absl::GetFlag(FLAGS_vselected_tl);
  316. }
  317. int VideoSelectedStream() {
  318. return absl::GetFlag(FLAGS_vselected_stream);
  319. }
  320. int VideoSelectedSL() {
  321. return absl::GetFlag(FLAGS_vselected_sl);
  322. }
  323. int ScreenshareMinTransmitBitrateKbps() {
  324. return absl::GetFlag(FLAGS_min_transmit_bitrate);
  325. }
  326. size_t ScreenshareWidth() {
  327. return static_cast<size_t>(absl::GetFlag(FLAGS_swidth));
  328. }
  329. size_t ScreenshareHeight() {
  330. return static_cast<size_t>(absl::GetFlag(FLAGS_sheight));
  331. }
  332. int ScreenshareFps() {
  333. return absl::GetFlag(FLAGS_sfps);
  334. }
  335. int ScreenshareTargetBitrateKbps() {
  336. return absl::GetFlag(FLAGS_starget_bitrate);
  337. }
  338. int ScreenshareMinBitrateKbps() {
  339. return absl::GetFlag(FLAGS_smin_bitrate);
  340. }
  341. int ScreenshareMaxBitrateKbps() {
  342. return absl::GetFlag(FLAGS_smax_bitrate);
  343. }
  344. int ScreenshareNumTemporalLayers() {
  345. return absl::GetFlag(FLAGS_snum_temporal_layers);
  346. }
  347. int ScreenshareNumStreams() {
  348. return absl::GetFlag(FLAGS_snum_streams);
  349. }
  350. int ScreenshareNumSpatialLayers() {
  351. return absl::GetFlag(FLAGS_snum_spatial_layers);
  352. }
  353. InterLayerPredMode ScreenshareInterLayerPred() {
  354. return IntToInterLayerPredMode(absl::GetFlag(FLAGS_sinter_layer_pred));
  355. }
  356. std::string ScreenshareStream0() {
  357. return absl::GetFlag(FLAGS_sstream0);
  358. }
  359. std::string ScreenshareStream1() {
  360. return absl::GetFlag(FLAGS_sstream1);
  361. }
  362. std::string ScreenshareSL0() {
  363. return absl::GetFlag(FLAGS_ssl0);
  364. }
  365. std::string ScreenshareSL1() {
  366. return absl::GetFlag(FLAGS_ssl1);
  367. }
  368. int ScreenshareSelectedTL() {
  369. return absl::GetFlag(FLAGS_sselected_tl);
  370. }
  371. int ScreenshareSelectedStream() {
  372. return absl::GetFlag(FLAGS_sselected_stream);
  373. }
  374. int ScreenshareSelectedSL() {
  375. return absl::GetFlag(FLAGS_sselected_sl);
  376. }
  377. bool GenerateSlides() {
  378. return absl::GetFlag(FLAGS_generate_slides);
  379. }
  380. int SlideChangeInterval() {
  381. return absl::GetFlag(FLAGS_slide_change_interval);
  382. }
  383. int ScrollDuration() {
  384. return absl::GetFlag(FLAGS_scroll_duration);
  385. }
  386. std::vector<std::string> Slides() {
  387. std::vector<std::string> slides;
  388. std::string slides_list = absl::GetFlag(FLAGS_slides);
  389. rtc::tokenize(slides_list, ',', &slides);
  390. return slides;
  391. }
  392. int StartBitrateKbps() {
  393. return absl::GetFlag(FLAGS_start_bitrate);
  394. }
  395. std::string Codec() {
  396. return absl::GetFlag(FLAGS_codec);
  397. }
  398. bool AnalyzeVideo() {
  399. return absl::GetFlag(FLAGS_analyze_video);
  400. }
  401. bool AnalyzeScreenshare() {
  402. return absl::GetFlag(FLAGS_analyze_screenshare);
  403. }
  404. int DurationSecs() {
  405. return absl::GetFlag(FLAGS_duration);
  406. }
  407. std::string OutputFilename() {
  408. return absl::GetFlag(FLAGS_output_filename);
  409. }
  410. std::string GraphTitle() {
  411. return absl::GetFlag(FLAGS_graph_title);
  412. }
  413. int LossPercent() {
  414. return absl::GetFlag(FLAGS_loss_percent);
  415. }
  416. int AvgBurstLossLength() {
  417. return absl::GetFlag(FLAGS_avg_burst_loss_length);
  418. }
  419. int LinkCapacityKbps() {
  420. return absl::GetFlag(FLAGS_link_capacity);
  421. }
  422. int QueueSize() {
  423. return absl::GetFlag(FLAGS_queue_size);
  424. }
  425. int AvgPropagationDelayMs() {
  426. return absl::GetFlag(FLAGS_avg_propagation_delay_ms);
  427. }
  428. std::string RtcEventLogName() {
  429. return absl::GetFlag(FLAGS_rtc_event_log_name);
  430. }
  431. std::string RtpDumpName() {
  432. return absl::GetFlag(FLAGS_rtp_dump_name);
  433. }
  434. int StdPropagationDelayMs() {
  435. return absl::GetFlag(FLAGS_std_propagation_delay_ms);
  436. }
  437. std::string EncodedFramePath() {
  438. return absl::GetFlag(FLAGS_encoded_frame_path);
  439. }
  440. std::string VideoClip() {
  441. return absl::GetFlag(FLAGS_vclip);
  442. }
  443. } // namespace
  444. void Loopback() {
  445. int camera_idx, screenshare_idx;
  446. RTC_CHECK(!(AnalyzeScreenshare() && AnalyzeVideo()))
  447. << "Select only one of video or screenshare.";
  448. RTC_CHECK(!DurationSecs() || AnalyzeScreenshare() || AnalyzeVideo())
  449. << "If duration is set, exactly one of analyze_* flags should be set.";
  450. // Default: camera feed first, if nothing selected.
  451. if (AnalyzeVideo() || !AnalyzeScreenshare()) {
  452. camera_idx = 0;
  453. screenshare_idx = 1;
  454. } else {
  455. camera_idx = 1;
  456. screenshare_idx = 0;
  457. }
  458. BuiltInNetworkBehaviorConfig pipe_config;
  459. pipe_config.loss_percent = LossPercent();
  460. pipe_config.avg_burst_loss_length = AvgBurstLossLength();
  461. pipe_config.link_capacity_kbps = LinkCapacityKbps();
  462. pipe_config.queue_length_packets = QueueSize();
  463. pipe_config.queue_delay_ms = AvgPropagationDelayMs();
  464. pipe_config.delay_standard_deviation_ms = StdPropagationDelayMs();
  465. pipe_config.allow_reordering = absl::GetFlag(FLAGS_allow_reordering);
  466. BitrateConstraints call_bitrate_config;
  467. call_bitrate_config.min_bitrate_bps =
  468. (ScreenshareMinBitrateKbps() + VideoMinBitrateKbps()) * 1000;
  469. call_bitrate_config.start_bitrate_bps = StartBitrateKbps() * 1000;
  470. call_bitrate_config.max_bitrate_bps =
  471. (ScreenshareMaxBitrateKbps() + VideoMaxBitrateKbps()) * 1000;
  472. VideoQualityTest::Params params, camera_params, screenshare_params;
  473. params.call = {absl::GetFlag(FLAGS_send_side_bwe),
  474. absl::GetFlag(FLAGS_generic_descriptor), call_bitrate_config,
  475. 0};
  476. params.call.dual_video = true;
  477. params.video[screenshare_idx] = {true,
  478. ScreenshareWidth(),
  479. ScreenshareHeight(),
  480. ScreenshareFps(),
  481. ScreenshareMinBitrateKbps() * 1000,
  482. ScreenshareTargetBitrateKbps() * 1000,
  483. ScreenshareMaxBitrateKbps() * 1000,
  484. false,
  485. Codec(),
  486. ScreenshareNumTemporalLayers(),
  487. ScreenshareSelectedTL(),
  488. ScreenshareMinTransmitBitrateKbps() * 1000,
  489. false, // ULPFEC disabled.
  490. false, // FlexFEC disabled.
  491. false, // Automatic scaling disabled
  492. ""};
  493. params.video[camera_idx] = {absl::GetFlag(FLAGS_video),
  494. VideoWidth(),
  495. VideoHeight(),
  496. VideoFps(),
  497. VideoMinBitrateKbps() * 1000,
  498. VideoTargetBitrateKbps() * 1000,
  499. VideoMaxBitrateKbps() * 1000,
  500. absl::GetFlag(FLAGS_suspend_below_min_bitrate),
  501. Codec(),
  502. VideoNumTemporalLayers(),
  503. VideoSelectedTL(),
  504. 0, // No min transmit bitrate.
  505. absl::GetFlag(FLAGS_use_ulpfec),
  506. absl::GetFlag(FLAGS_use_flexfec),
  507. false,
  508. VideoClip(),
  509. GetCaptureDevice()};
  510. params.audio = {absl::GetFlag(FLAGS_audio),
  511. absl::GetFlag(FLAGS_audio_video_sync),
  512. absl::GetFlag(FLAGS_audio_dtx)};
  513. params.logging = {RtcEventLogName(), RtpDumpName(), EncodedFramePath()};
  514. params.analyzer = {"dual_streams", 0.0, 0.0, DurationSecs(),
  515. OutputFilename(), GraphTitle()};
  516. params.config = pipe_config;
  517. params.screenshare[camera_idx].enabled = false;
  518. params.screenshare[screenshare_idx] = {true, GenerateSlides(),
  519. SlideChangeInterval(),
  520. ScrollDuration(), Slides()};
  521. if (VideoNumStreams() > 1 && VideoStream0().empty() &&
  522. VideoStream1().empty()) {
  523. params.ss[camera_idx].infer_streams = true;
  524. }
  525. if (ScreenshareNumStreams() > 1 && ScreenshareStream0().empty() &&
  526. ScreenshareStream1().empty()) {
  527. params.ss[screenshare_idx].infer_streams = true;
  528. }
  529. std::vector<std::string> stream_descriptors;
  530. stream_descriptors.push_back(ScreenshareStream0());
  531. stream_descriptors.push_back(ScreenshareStream1());
  532. std::vector<std::string> SL_descriptors;
  533. SL_descriptors.push_back(ScreenshareSL0());
  534. SL_descriptors.push_back(ScreenshareSL1());
  535. VideoQualityTest::FillScalabilitySettings(
  536. &params, screenshare_idx, stream_descriptors, ScreenshareNumStreams(),
  537. ScreenshareSelectedStream(), ScreenshareNumSpatialLayers(),
  538. ScreenshareSelectedSL(), ScreenshareInterLayerPred(), SL_descriptors);
  539. stream_descriptors.clear();
  540. stream_descriptors.push_back(VideoStream0());
  541. stream_descriptors.push_back(VideoStream1());
  542. SL_descriptors.clear();
  543. SL_descriptors.push_back(VideoSL0());
  544. SL_descriptors.push_back(VideoSL1());
  545. VideoQualityTest::FillScalabilitySettings(
  546. &params, camera_idx, stream_descriptors, VideoNumStreams(),
  547. VideoSelectedStream(), VideoNumSpatialLayers(), VideoSelectedSL(),
  548. VideoInterLayerPred(), SL_descriptors);
  549. auto fixture = std::make_unique<VideoQualityTest>(nullptr);
  550. if (DurationSecs()) {
  551. fixture->RunWithAnalyzer(params);
  552. } else {
  553. fixture->RunWithRenderers(params);
  554. }
  555. }
  556. } // namespace webrtc
  557. int main(int argc, char* argv[]) {
  558. ::testing::InitGoogleTest(&argc, argv);
  559. absl::ParseCommandLine(argc, argv);
  560. rtc::LogMessage::SetLogToStderr(absl::GetFlag(FLAGS_logs));
  561. // InitFieldTrialsFromString stores the char*, so the char array must outlive
  562. // the application.
  563. const std::string field_trials = absl::GetFlag(FLAGS_force_fieldtrials);
  564. webrtc::field_trial::InitFieldTrialsFromString(field_trials.c_str());
  565. webrtc::test::RunTest(webrtc::Loopback);
  566. return 0;
  567. }