OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 <stdio.h> | 10 #include <stdio.h> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 size_t width, height; | 45 size_t width, height; |
46 int fps; | 46 int fps; |
47 } clip; | 47 } clip; |
48 bool screenshare; | 48 bool screenshare; |
49 int min_bitrate_bps; | 49 int min_bitrate_bps; |
50 int target_bitrate_bps; | 50 int target_bitrate_bps; |
51 int max_bitrate_bps; | 51 int max_bitrate_bps; |
52 double avg_psnr_threshold; | 52 double avg_psnr_threshold; |
53 double avg_ssim_threshold; | 53 double avg_ssim_threshold; |
54 int test_durations_secs; | 54 int test_durations_secs; |
55 std::string codec; | |
55 FakeNetworkPipe::Config link; | 56 FakeNetworkPipe::Config link; |
56 }; | 57 }; |
57 | 58 |
58 class FullStackTest : public test::CallTest { | 59 class FullStackTest : public test::CallTest { |
59 protected: | 60 protected: |
60 void RunTest(const FullStackTestParams& params); | 61 void RunTest(const FullStackTestParams& params); |
61 }; | 62 }; |
62 | 63 |
63 class VideoAnalyzer : public PacketReceiver, | 64 class VideoAnalyzer : public PacketReceiver, |
64 public newapi::Transport, | 65 public newapi::Transport, |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
200 | 201 |
201 bool IsTextureSupported() const override { return false; } | 202 bool IsTextureSupported() const override { return false; } |
202 | 203 |
203 void Wait() { | 204 void Wait() { |
204 // Frame comparisons can be very expensive. Wait for test to be done, but | 205 // Frame comparisons can be very expensive. Wait for test to be done, but |
205 // at time-out check if frames_processed is going up. If so, give it more | 206 // at time-out check if frames_processed is going up. If so, give it more |
206 // time, otherwise fail. Hopefully this will reduce test flakiness. | 207 // time, otherwise fail. Hopefully this will reduce test flakiness. |
207 | 208 |
208 int last_frames_processed = -1; | 209 int last_frames_processed = -1; |
209 EventTypeWrapper eventType; | 210 EventTypeWrapper eventType; |
210 while ((eventType = done_->Wait(FullStackTest::kDefaultTimeoutMs)) != | 211 #ifdef WEBRTC_ANDROID |
pbos-webrtc
2015/07/13 09:34:43
not lgtm, can you use kLongTimeoutMs for both inst
| |
211 kEventSignaled) { | 212 int factor = 2; |
213 #else | |
214 int factor = 1; | |
215 #endif | |
216 while ((eventType = done_->Wait( | |
217 factor * FullStackTest::kDefaultTimeoutMs)) != kEventSignaled) { | |
212 int frames_processed; | 218 int frames_processed; |
213 { | 219 { |
214 rtc::CritScope crit(&comparison_lock_); | 220 rtc::CritScope crit(&comparison_lock_); |
215 frames_processed = frames_processed_; | 221 frames_processed = frames_processed_; |
216 } | 222 } |
217 if (last_frames_processed == -1) { | 223 if (last_frames_processed == -1) { |
218 last_frames_processed = frames_processed; | 224 last_frames_processed = frames_processed; |
219 continue; | 225 continue; |
220 } | 226 } |
221 ASSERT_GT(frames_processed, last_frames_processed) | 227 ASSERT_GT(frames_processed, last_frames_processed) |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 params.test_durations_secs * params.clip.fps); | 440 params.test_durations_secs * params.clip.fps); |
435 | 441 |
436 CreateCalls(Call::Config(&analyzer), Call::Config(&recv_transport)); | 442 CreateCalls(Call::Config(&analyzer), Call::Config(&recv_transport)); |
437 | 443 |
438 analyzer.SetReceiver(receiver_call_->Receiver()); | 444 analyzer.SetReceiver(receiver_call_->Receiver()); |
439 send_transport.SetReceiver(&analyzer); | 445 send_transport.SetReceiver(&analyzer); |
440 recv_transport.SetReceiver(sender_call_->Receiver()); | 446 recv_transport.SetReceiver(sender_call_->Receiver()); |
441 | 447 |
442 CreateSendConfig(1); | 448 CreateSendConfig(1); |
443 | 449 |
444 rtc::scoped_ptr<VideoEncoder> encoder( | 450 rtc::scoped_ptr<VideoEncoder> encoder; |
445 VideoEncoder::Create(VideoEncoder::kVp8)); | 451 if (params.codec == "VP8") { |
446 send_config_.encoder_settings.encoder = encoder.get(); | 452 encoder = |
447 send_config_.encoder_settings.payload_name = "VP8"; | 453 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp8)); |
454 send_config_.encoder_settings.encoder = encoder.get(); | |
455 send_config_.encoder_settings.payload_name = "VP8"; | |
456 } else if (params.codec == "VP9") { | |
457 encoder = | |
458 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp9)); | |
459 send_config_.encoder_settings.encoder = encoder.get(); | |
460 send_config_.encoder_settings.payload_name = "VP9"; | |
461 } else { | |
462 RTC_NOTREACHED() << "Codec not supported!"; | |
463 return; | |
464 } | |
448 send_config_.encoder_settings.payload_type = 124; | 465 send_config_.encoder_settings.payload_type = 124; |
466 | |
449 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 467 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
450 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); | 468 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); |
451 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 469 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
452 | 470 |
453 VideoStream* stream = &encoder_config_.streams[0]; | 471 VideoStream* stream = &encoder_config_.streams[0]; |
454 stream->width = params.clip.width; | 472 stream->width = params.clip.width; |
455 stream->height = params.clip.height; | 473 stream->height = params.clip.height; |
456 stream->min_bitrate_bps = params.min_bitrate_bps; | 474 stream->min_bitrate_bps = params.min_bitrate_bps; |
457 stream->target_bitrate_bps = params.target_bitrate_bps; | 475 stream->target_bitrate_bps = params.target_bitrate_bps; |
458 stream->max_bitrate_bps = params.max_bitrate_bps; | 476 stream->max_bitrate_bps = params.max_bitrate_bps; |
459 stream->max_framerate = params.clip.fps; | 477 stream->max_framerate = params.clip.fps; |
460 | 478 |
479 VideoCodecVP8 vp8_settings; | |
480 VideoCodecVP9 vp9_settings; | |
461 if (params.screenshare) { | 481 if (params.screenshare) { |
462 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 482 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
463 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; | 483 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; |
464 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 484 if (params.codec == "VP8") { |
465 vp8_settings.denoisingOn = false; | 485 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
466 vp8_settings.frameDroppingOn = false; | 486 vp8_settings.denoisingOn = false; |
467 vp8_settings.numberOfTemporalLayers = 2; | 487 vp8_settings.frameDroppingOn = false; |
468 encoder_config_.encoder_specific_settings = &vp8_settings; | 488 vp8_settings.numberOfTemporalLayers = 2; |
489 encoder_config_.encoder_specific_settings = &vp8_settings; | |
490 } else if (params.codec == "VP9") { | |
491 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | |
492 vp9_settings.denoisingOn = false; | |
493 vp9_settings.frameDroppingOn = false; | |
494 vp9_settings.numberOfTemporalLayers = 2; | |
495 encoder_config_.encoder_specific_settings = &vp9_settings; | |
496 } | |
469 | 497 |
470 stream->temporal_layer_thresholds_bps.clear(); | 498 stream->temporal_layer_thresholds_bps.clear(); |
471 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); | 499 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); |
472 } | 500 } |
473 | 501 |
474 CreateMatchingReceiveConfigs(); | 502 CreateMatchingReceiveConfigs(); |
475 receive_configs_[0].renderer = &analyzer; | 503 receive_configs_[0].renderer = &analyzer; |
476 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 504 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
477 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; | 505 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; |
478 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = | 506 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 | 551 |
524 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { | 552 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { |
525 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", | 553 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", |
526 {"paris_qcif", 176, 144, 30}, | 554 {"paris_qcif", 176, 144, 30}, |
527 false, | 555 false, |
528 300000, | 556 300000, |
529 300000, | 557 300000, |
530 300000, | 558 300000, |
531 36.0, | 559 36.0, |
532 0.96, | 560 0.96, |
533 kFullStackTestDurationSecs}; | 561 kFullStackTestDurationSecs, |
562 "VP8"}; | |
534 RunTest(paris_qcif); | 563 RunTest(paris_qcif); |
535 } | 564 } |
536 | 565 |
537 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { | 566 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { |
538 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. | 567 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. |
539 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", | 568 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", |
540 {"foreman_cif", 352, 288, 30}, | 569 {"foreman_cif", 352, 288, 30}, |
541 false, | 570 false, |
542 700000, | 571 700000, |
543 700000, | 572 700000, |
544 700000, | 573 700000, |
545 0.0, | 574 0.0, |
546 0.0, | 575 0.0, |
547 kFullStackTestDurationSecs}; | 576 kFullStackTestDurationSecs, |
577 "VP8"}; | |
548 RunTest(foreman_cif); | 578 RunTest(foreman_cif); |
549 } | 579 } |
550 | 580 |
551 TEST_F(FullStackTest, ForemanCifPlr5) { | 581 TEST_F(FullStackTest, ForemanCifPlr5) { |
552 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", | 582 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", |
553 {"foreman_cif", 352, 288, 30}, | 583 {"foreman_cif", 352, 288, 30}, |
554 false, | 584 false, |
555 30000, | 585 30000, |
556 500000, | 586 500000, |
557 2000000, | 587 2000000, |
558 0.0, | 588 0.0, |
559 0.0, | 589 0.0, |
560 kFullStackTestDurationSecs}; | 590 kFullStackTestDurationSecs, |
591 "VP8"}; | |
561 foreman_cif.link.loss_percent = 5; | 592 foreman_cif.link.loss_percent = 5; |
562 foreman_cif.link.queue_delay_ms = 50; | 593 foreman_cif.link.queue_delay_ms = 50; |
563 RunTest(foreman_cif); | 594 RunTest(foreman_cif); |
564 } | 595 } |
565 | 596 |
566 TEST_F(FullStackTest, ForemanCif500kbps) { | 597 TEST_F(FullStackTest, ForemanCif500kbps) { |
567 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", | 598 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", |
568 {"foreman_cif", 352, 288, 30}, | 599 {"foreman_cif", 352, 288, 30}, |
569 false, | 600 false, |
570 30000, | 601 30000, |
571 500000, | 602 500000, |
572 2000000, | 603 2000000, |
573 0.0, | 604 0.0, |
574 0.0, | 605 0.0, |
575 kFullStackTestDurationSecs}; | 606 kFullStackTestDurationSecs, |
607 "VP8"}; | |
576 foreman_cif.link.queue_length_packets = 0; | 608 foreman_cif.link.queue_length_packets = 0; |
577 foreman_cif.link.queue_delay_ms = 0; | 609 foreman_cif.link.queue_delay_ms = 0; |
578 foreman_cif.link.link_capacity_kbps = 500; | 610 foreman_cif.link.link_capacity_kbps = 500; |
579 RunTest(foreman_cif); | 611 RunTest(foreman_cif); |
580 } | 612 } |
581 | 613 |
582 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { | 614 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { |
583 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", | 615 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", |
584 {"foreman_cif", 352, 288, 30}, | 616 {"foreman_cif", 352, 288, 30}, |
585 false, | 617 false, |
586 30000, | 618 30000, |
587 500000, | 619 500000, |
588 2000000, | 620 2000000, |
589 0.0, | 621 0.0, |
590 0.0, | 622 0.0, |
591 kFullStackTestDurationSecs}; | 623 kFullStackTestDurationSecs, |
624 "VP8"}; | |
592 foreman_cif.link.queue_length_packets = 32; | 625 foreman_cif.link.queue_length_packets = 32; |
593 foreman_cif.link.queue_delay_ms = 0; | 626 foreman_cif.link.queue_delay_ms = 0; |
594 foreman_cif.link.link_capacity_kbps = 500; | 627 foreman_cif.link.link_capacity_kbps = 500; |
595 RunTest(foreman_cif); | 628 RunTest(foreman_cif); |
596 } | 629 } |
597 | 630 |
598 TEST_F(FullStackTest, ForemanCif500kbps100ms) { | 631 TEST_F(FullStackTest, ForemanCif500kbps100ms) { |
599 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", | 632 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", |
600 {"foreman_cif", 352, 288, 30}, | 633 {"foreman_cif", 352, 288, 30}, |
601 false, | 634 false, |
602 30000, | 635 30000, |
603 500000, | 636 500000, |
604 2000000, | 637 2000000, |
605 0.0, | 638 0.0, |
606 0.0, | 639 0.0, |
607 kFullStackTestDurationSecs}; | 640 kFullStackTestDurationSecs, |
641 "VP8"}; | |
608 foreman_cif.link.queue_length_packets = 0; | 642 foreman_cif.link.queue_length_packets = 0; |
609 foreman_cif.link.queue_delay_ms = 100; | 643 foreman_cif.link.queue_delay_ms = 100; |
610 foreman_cif.link.link_capacity_kbps = 500; | 644 foreman_cif.link.link_capacity_kbps = 500; |
611 RunTest(foreman_cif); | 645 RunTest(foreman_cif); |
612 } | 646 } |
613 | 647 |
614 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { | 648 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { |
615 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", | 649 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", |
616 {"foreman_cif", 352, 288, 30}, | 650 {"foreman_cif", 352, 288, 30}, |
617 false, | 651 false, |
618 30000, | 652 30000, |
619 500000, | 653 500000, |
620 2000000, | 654 2000000, |
621 0.0, | 655 0.0, |
622 0.0, | 656 0.0, |
623 kFullStackTestDurationSecs}; | 657 kFullStackTestDurationSecs, |
658 "VP8"}; | |
624 foreman_cif.link.queue_length_packets = 32; | 659 foreman_cif.link.queue_length_packets = 32; |
625 foreman_cif.link.queue_delay_ms = 100; | 660 foreman_cif.link.queue_delay_ms = 100; |
626 foreman_cif.link.link_capacity_kbps = 500; | 661 foreman_cif.link.link_capacity_kbps = 500; |
627 RunTest(foreman_cif); | 662 RunTest(foreman_cif); |
628 } | 663 } |
629 | 664 |
630 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { | 665 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { |
631 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", | 666 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", |
632 {"foreman_cif", 352, 288, 30}, | 667 {"foreman_cif", 352, 288, 30}, |
633 false, | 668 false, |
634 30000, | 669 30000, |
635 2000000, | 670 2000000, |
636 2000000, | 671 2000000, |
637 0.0, | 672 0.0, |
638 0.0, | 673 0.0, |
639 kFullStackTestDurationSecs}; | 674 kFullStackTestDurationSecs, |
675 "VP8"}; | |
640 foreman_cif.link.queue_length_packets = 32; | 676 foreman_cif.link.queue_length_packets = 32; |
641 foreman_cif.link.queue_delay_ms = 100; | 677 foreman_cif.link.queue_delay_ms = 100; |
642 foreman_cif.link.link_capacity_kbps = 1000; | 678 foreman_cif.link.link_capacity_kbps = 1000; |
643 RunTest(foreman_cif); | 679 RunTest(foreman_cif); |
644 } | 680 } |
645 | 681 |
646 TEST_F(FullStackTest, ScreenshareSlides) { | 682 TEST_F(FullStackTest, ScreenshareSlidesVP8) { |
647 FullStackTestParams screenshare_params = { | 683 FullStackTestParams screenshare_params = { |
648 "screenshare_slides", | 684 "screenshare_slides", |
649 {"screenshare_slides", 1850, 1110, 5}, | 685 {"screenshare_slides", 1850, 1110, 5}, |
686 true, | |
687 50000, | |
688 200000, | |
689 2000000, | |
690 0.0, | |
691 0.0, | |
692 kFullStackTestDurationSecs, | |
693 "VP8"}; | |
694 RunTest(screenshare_params); | |
695 } | |
696 | |
697 TEST_F(FullStackTest, ScreenshareSlidesVP9) { | |
698 FullStackTestParams screenshare_params = { | |
699 "screenshare_slides", | |
700 {"screenshare_slides", 1850, 1110, 5}, | |
650 true, | 701 true, |
651 50000, | 702 50000, |
652 200000, | 703 200000, |
653 2000000, | 704 2000000, |
654 0.0, | 705 0.0, |
655 0.0, | 706 0.0, |
656 kFullStackTestDurationSecs}; | 707 kFullStackTestDurationSecs, |
708 "VP9"}; | |
657 RunTest(screenshare_params); | 709 RunTest(screenshare_params); |
658 } | 710 } |
659 } // namespace webrtc | 711 } // namespace webrtc |
OLD | NEW |