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