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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 params.test_durations_secs * params.clip.fps); | 435 params.test_durations_secs * params.clip.fps); |
435 | 436 |
436 CreateCalls(Call::Config(&analyzer), Call::Config(&recv_transport)); | 437 CreateCalls(Call::Config(&analyzer), Call::Config(&recv_transport)); |
437 | 438 |
438 analyzer.SetReceiver(receiver_call_->Receiver()); | 439 analyzer.SetReceiver(receiver_call_->Receiver()); |
439 send_transport.SetReceiver(&analyzer); | 440 send_transport.SetReceiver(&analyzer); |
440 recv_transport.SetReceiver(sender_call_->Receiver()); | 441 recv_transport.SetReceiver(sender_call_->Receiver()); |
441 | 442 |
442 CreateSendConfig(1); | 443 CreateSendConfig(1); |
443 | 444 |
444 rtc::scoped_ptr<VideoEncoder> encoder( | 445 rtc::scoped_ptr<VideoEncoder> encoder; |
445 VideoEncoder::Create(VideoEncoder::kVp8)); | 446 if (params.codec == "VP8") { |
446 send_config_.encoder_settings.encoder = encoder.get(); | 447 encoder = |
447 send_config_.encoder_settings.payload_name = "VP8"; | 448 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp8)); |
448 send_config_.encoder_settings.payload_type = 124; | 449 send_config_.encoder_settings.encoder = encoder.get(); |
450 send_config_.encoder_settings.payload_name = "VP8"; | |
451 send_config_.encoder_settings.payload_type = | |
452 124; // this is VCM_I420_PAYLOAD_TYPE (?) | |
pbos-webrtc
2015/07/07 13:28:29
Remove comment.
| |
453 } else if (params.codec == "VP9") { | |
454 encoder = | |
455 rtc::scoped_ptr<VideoEncoder>(VideoEncoder::Create(VideoEncoder::kVp9)); | |
456 send_config_.encoder_settings.encoder = encoder.get(); | |
457 send_config_.encoder_settings.payload_name = "VP9"; | |
458 send_config_.encoder_settings.payload_type = | |
459 124; // should I put VCM_VP9_PAYLOAD_TYPE? | |
pbos-webrtc
2015/07/07 13:28:29
Remove comment, any payload_type is fine. If you w
| |
460 } else { | |
461 RTC_NOTREACHED() << "Codec not supported!"; | |
462 return; | |
463 } | |
464 | |
449 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 465 send_config_.rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
450 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); | 466 send_config_.rtp.rtx.ssrcs.push_back(kSendRtxSsrcs[0]); |
451 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; | 467 send_config_.rtp.rtx.payload_type = kSendRtxPayloadType; |
452 | 468 |
453 VideoStream* stream = &encoder_config_.streams[0]; | 469 VideoStream* stream = &encoder_config_.streams[0]; |
454 stream->width = params.clip.width; | 470 stream->width = params.clip.width; |
455 stream->height = params.clip.height; | 471 stream->height = params.clip.height; |
456 stream->min_bitrate_bps = params.min_bitrate_bps; | 472 stream->min_bitrate_bps = params.min_bitrate_bps; |
457 stream->target_bitrate_bps = params.target_bitrate_bps; | 473 stream->target_bitrate_bps = params.target_bitrate_bps; |
458 stream->max_bitrate_bps = params.max_bitrate_bps; | 474 stream->max_bitrate_bps = params.max_bitrate_bps; |
459 stream->max_framerate = params.clip.fps; | 475 stream->max_framerate = params.clip.fps; |
460 | 476 |
477 VideoCodecVP8 vp8_settings; | |
478 VideoCodecVP9 vp9_settings; | |
461 if (params.screenshare) { | 479 if (params.screenshare) { |
462 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; | 480 encoder_config_.content_type = VideoEncoderConfig::ContentType::kScreen; |
463 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; | 481 encoder_config_.min_transmit_bitrate_bps = 400 * 1000; |
464 VideoCodecVP8 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); | 482 if (params.codec == "VP8") { |
465 vp8_settings.denoisingOn = false; | 483 vp8_settings = VideoEncoder::GetDefaultVp8Settings(); |
466 vp8_settings.frameDroppingOn = false; | 484 vp8_settings.denoisingOn = false; |
467 vp8_settings.numberOfTemporalLayers = 2; | 485 vp8_settings.frameDroppingOn = false; |
468 encoder_config_.encoder_specific_settings = &vp8_settings; | 486 vp8_settings.numberOfTemporalLayers = 2; |
487 encoder_config_.encoder_specific_settings = &vp8_settings; | |
488 } else if (params.codec == "VP9") { | |
489 vp9_settings = VideoEncoder::GetDefaultVp9Settings(); | |
490 vp9_settings.denoisingOn = false; | |
491 vp9_settings.frameDroppingOn = false; | |
492 vp9_settings.numberOfTemporalLayers = 2; | |
493 encoder_config_.encoder_specific_settings = &vp9_settings; | |
494 } | |
469 | 495 |
470 stream->temporal_layer_thresholds_bps.clear(); | 496 stream->temporal_layer_thresholds_bps.clear(); |
471 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); | 497 stream->temporal_layer_thresholds_bps.push_back(stream->target_bitrate_bps); |
472 } | 498 } |
473 | 499 |
474 CreateMatchingReceiveConfigs(); | 500 CreateMatchingReceiveConfigs(); |
475 receive_configs_[0].renderer = &analyzer; | 501 receive_configs_[0].renderer = &analyzer; |
476 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; | 502 receive_configs_[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; |
477 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; | 503 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].ssrc = kSendRtxSsrcs[0]; |
478 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = | 504 receive_configs_[0].rtp.rtx[kSendRtxPayloadType].payload_type = |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
523 | 549 |
524 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { | 550 TEST_F(FullStackTest, ParisQcifWithoutPacketLoss) { |
525 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", | 551 FullStackTestParams paris_qcif = {"net_delay_0_0_plr_0", |
526 {"paris_qcif", 176, 144, 30}, | 552 {"paris_qcif", 176, 144, 30}, |
527 false, | 553 false, |
528 300000, | 554 300000, |
529 300000, | 555 300000, |
530 300000, | 556 300000, |
531 36.0, | 557 36.0, |
532 0.96, | 558 0.96, |
533 kFullStackTestDurationSecs}; | 559 kFullStackTestDurationSecs, |
560 "VP8"}; | |
534 RunTest(paris_qcif); | 561 RunTest(paris_qcif); |
535 } | 562 } |
536 | 563 |
537 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { | 564 TEST_F(FullStackTest, ForemanCifWithoutPacketLoss) { |
538 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. | 565 // TODO(pbos): Decide on psnr/ssim thresholds for foreman_cif. |
539 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", | 566 FullStackTestParams foreman_cif = {"foreman_cif_net_delay_0_0_plr_0", |
540 {"foreman_cif", 352, 288, 30}, | 567 {"foreman_cif", 352, 288, 30}, |
541 false, | 568 false, |
542 700000, | 569 700000, |
543 700000, | 570 700000, |
544 700000, | 571 700000, |
545 0.0, | 572 0.0, |
546 0.0, | 573 0.0, |
547 kFullStackTestDurationSecs}; | 574 kFullStackTestDurationSecs, |
575 "VP8"}; | |
548 RunTest(foreman_cif); | 576 RunTest(foreman_cif); |
549 } | 577 } |
550 | 578 |
551 TEST_F(FullStackTest, ForemanCifPlr5) { | 579 TEST_F(FullStackTest, ForemanCifPlr5) { |
552 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", | 580 FullStackTestParams foreman_cif = {"foreman_cif_delay_50_0_plr_5", |
553 {"foreman_cif", 352, 288, 30}, | 581 {"foreman_cif", 352, 288, 30}, |
554 false, | 582 false, |
555 30000, | 583 30000, |
556 500000, | 584 500000, |
557 2000000, | 585 2000000, |
558 0.0, | 586 0.0, |
559 0.0, | 587 0.0, |
560 kFullStackTestDurationSecs}; | 588 kFullStackTestDurationSecs, |
589 "VP8"}; | |
561 foreman_cif.link.loss_percent = 5; | 590 foreman_cif.link.loss_percent = 5; |
562 foreman_cif.link.queue_delay_ms = 50; | 591 foreman_cif.link.queue_delay_ms = 50; |
563 RunTest(foreman_cif); | 592 RunTest(foreman_cif); |
564 } | 593 } |
565 | 594 |
566 TEST_F(FullStackTest, ForemanCif500kbps) { | 595 TEST_F(FullStackTest, ForemanCif500kbps) { |
567 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", | 596 FullStackTestParams foreman_cif = {"foreman_cif_500kbps", |
568 {"foreman_cif", 352, 288, 30}, | 597 {"foreman_cif", 352, 288, 30}, |
569 false, | 598 false, |
570 30000, | 599 30000, |
571 500000, | 600 500000, |
572 2000000, | 601 2000000, |
573 0.0, | 602 0.0, |
574 0.0, | 603 0.0, |
575 kFullStackTestDurationSecs}; | 604 kFullStackTestDurationSecs, |
605 "VP8"}; | |
576 foreman_cif.link.queue_length_packets = 0; | 606 foreman_cif.link.queue_length_packets = 0; |
577 foreman_cif.link.queue_delay_ms = 0; | 607 foreman_cif.link.queue_delay_ms = 0; |
578 foreman_cif.link.link_capacity_kbps = 500; | 608 foreman_cif.link.link_capacity_kbps = 500; |
579 RunTest(foreman_cif); | 609 RunTest(foreman_cif); |
580 } | 610 } |
581 | 611 |
582 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { | 612 TEST_F(FullStackTest, ForemanCif500kbpsLimitedQueue) { |
583 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", | 613 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_32pkts_queue", |
584 {"foreman_cif", 352, 288, 30}, | 614 {"foreman_cif", 352, 288, 30}, |
585 false, | 615 false, |
586 30000, | 616 30000, |
587 500000, | 617 500000, |
588 2000000, | 618 2000000, |
589 0.0, | 619 0.0, |
590 0.0, | 620 0.0, |
591 kFullStackTestDurationSecs}; | 621 kFullStackTestDurationSecs, |
622 "VP8"}; | |
592 foreman_cif.link.queue_length_packets = 32; | 623 foreman_cif.link.queue_length_packets = 32; |
593 foreman_cif.link.queue_delay_ms = 0; | 624 foreman_cif.link.queue_delay_ms = 0; |
594 foreman_cif.link.link_capacity_kbps = 500; | 625 foreman_cif.link.link_capacity_kbps = 500; |
595 RunTest(foreman_cif); | 626 RunTest(foreman_cif); |
596 } | 627 } |
597 | 628 |
598 TEST_F(FullStackTest, ForemanCif500kbps100ms) { | 629 TEST_F(FullStackTest, ForemanCif500kbps100ms) { |
599 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", | 630 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms", |
600 {"foreman_cif", 352, 288, 30}, | 631 {"foreman_cif", 352, 288, 30}, |
601 false, | 632 false, |
602 30000, | 633 30000, |
603 500000, | 634 500000, |
604 2000000, | 635 2000000, |
605 0.0, | 636 0.0, |
606 0.0, | 637 0.0, |
607 kFullStackTestDurationSecs}; | 638 kFullStackTestDurationSecs, |
639 "VP8"}; | |
608 foreman_cif.link.queue_length_packets = 0; | 640 foreman_cif.link.queue_length_packets = 0; |
609 foreman_cif.link.queue_delay_ms = 100; | 641 foreman_cif.link.queue_delay_ms = 100; |
610 foreman_cif.link.link_capacity_kbps = 500; | 642 foreman_cif.link.link_capacity_kbps = 500; |
611 RunTest(foreman_cif); | 643 RunTest(foreman_cif); |
612 } | 644 } |
613 | 645 |
614 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { | 646 TEST_F(FullStackTest, ForemanCif500kbps100msLimitedQueue) { |
615 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", | 647 FullStackTestParams foreman_cif = {"foreman_cif_500kbps_100ms_32pkts_queue", |
616 {"foreman_cif", 352, 288, 30}, | 648 {"foreman_cif", 352, 288, 30}, |
617 false, | 649 false, |
618 30000, | 650 30000, |
619 500000, | 651 500000, |
620 2000000, | 652 2000000, |
621 0.0, | 653 0.0, |
622 0.0, | 654 0.0, |
623 kFullStackTestDurationSecs}; | 655 kFullStackTestDurationSecs, |
656 "VP8"}; | |
624 foreman_cif.link.queue_length_packets = 32; | 657 foreman_cif.link.queue_length_packets = 32; |
625 foreman_cif.link.queue_delay_ms = 100; | 658 foreman_cif.link.queue_delay_ms = 100; |
626 foreman_cif.link.link_capacity_kbps = 500; | 659 foreman_cif.link.link_capacity_kbps = 500; |
627 RunTest(foreman_cif); | 660 RunTest(foreman_cif); |
628 } | 661 } |
629 | 662 |
630 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { | 663 TEST_F(FullStackTest, ForemanCif1000kbps100msLimitedQueue) { |
631 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", | 664 FullStackTestParams foreman_cif = {"foreman_cif_1000kbps_100ms_32pkts_queue", |
632 {"foreman_cif", 352, 288, 30}, | 665 {"foreman_cif", 352, 288, 30}, |
633 false, | 666 false, |
634 30000, | 667 30000, |
635 2000000, | 668 2000000, |
636 2000000, | 669 2000000, |
637 0.0, | 670 0.0, |
638 0.0, | 671 0.0, |
639 kFullStackTestDurationSecs}; | 672 kFullStackTestDurationSecs, |
673 "VP8"}; | |
640 foreman_cif.link.queue_length_packets = 32; | 674 foreman_cif.link.queue_length_packets = 32; |
641 foreman_cif.link.queue_delay_ms = 100; | 675 foreman_cif.link.queue_delay_ms = 100; |
642 foreman_cif.link.link_capacity_kbps = 1000; | 676 foreman_cif.link.link_capacity_kbps = 1000; |
643 RunTest(foreman_cif); | 677 RunTest(foreman_cif); |
644 } | 678 } |
645 | 679 |
646 TEST_F(FullStackTest, ScreenshareSlides) { | 680 TEST_F(FullStackTest, ScreenshareSlidesVP8) { |
647 FullStackTestParams screenshare_params = { | 681 FullStackTestParams screenshare_params = { |
648 "screenshare_slides", | 682 "screenshare_slides", |
649 {"screenshare_slides", 1850, 1110, 5}, | 683 {"screenshare_slides", 1850, 1110, 5}, |
684 true, | |
685 50000, | |
686 200000, | |
687 2000000, | |
688 0.0, | |
689 0.0, | |
690 kFullStackTestDurationSecs, | |
691 "VP8"}; | |
692 RunTest(screenshare_params); | |
693 } | |
694 | |
695 TEST_F(FullStackTest, ScreenshareSlidesVP9) { | |
696 FullStackTestParams screenshare_params = { | |
697 "screenshare_slides", | |
698 {"screenshare_slides", 1850, 1110, 5}, | |
650 true, | 699 true, |
651 50000, | 700 50000, |
652 200000, | 701 200000, |
653 2000000, | 702 2000000, |
654 0.0, | 703 0.0, |
655 0.0, | 704 0.0, |
656 kFullStackTestDurationSecs}; | 705 kFullStackTestDurationSecs, |
706 "VP9"}; | |
657 RunTest(screenshare_params); | 707 RunTest(screenshare_params); |
658 } | 708 } |
659 } // namespace webrtc | 709 } // namespace webrtc |
OLD | NEW |