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

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

Issue 2071093002: Revert of Split IncomingVideoStream into two implementations, with smoothing and without. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 6 months 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
OLDNEW
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 <algorithm> 10 #include <algorithm>
(...skipping 2009 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 EXPECT_EQ( 2020 EXPECT_EQ(
2021 1, metrics::NumSamples("WebRTC.Video.UniqueNackRequestsSentInPercent")); 2021 1, metrics::NumSamples("WebRTC.Video.UniqueNackRequestsSentInPercent"));
2022 EXPECT_EQ(1, metrics::NumSamples( 2022 EXPECT_EQ(1, metrics::NumSamples(
2023 "WebRTC.Video.UniqueNackRequestsReceivedInPercent")); 2023 "WebRTC.Video.UniqueNackRequestsReceivedInPercent"));
2024 EXPECT_GT(metrics::MinSample("WebRTC.Video.NackPacketsSentPerMinute"), 0); 2024 EXPECT_GT(metrics::MinSample("WebRTC.Video.NackPacketsSentPerMinute"), 0);
2025 } 2025 }
2026 2026
2027 void EndToEndTest::VerifyHistogramStats(bool use_rtx, 2027 void EndToEndTest::VerifyHistogramStats(bool use_rtx,
2028 bool use_red, 2028 bool use_red,
2029 bool screenshare) { 2029 bool screenshare) {
2030 class StatsObserver : public test::EndToEndTest, 2030 class StatsObserver : public test::EndToEndTest {
2031 public rtc::VideoSinkInterface<VideoFrame> {
2032 public: 2031 public:
2033 StatsObserver(bool use_rtx, bool use_red, bool screenshare) 2032 StatsObserver(bool use_rtx, bool use_red, bool screenshare)
2034 : EndToEndTest(kLongTimeoutMs), 2033 : EndToEndTest(kLongTimeoutMs),
2035 use_rtx_(use_rtx), 2034 use_rtx_(use_rtx),
2036 use_red_(use_red), 2035 use_red_(use_red),
2037 screenshare_(screenshare), 2036 screenshare_(screenshare),
2038 // This test uses NACK, so to send FEC we can't use a fake encoder. 2037 // This test uses NACK, so to send FEC we can't use a fake encoder.
2039 vp8_encoder_( 2038 vp8_encoder_(
2040 use_red ? VideoEncoder::Create(VideoEncoder::EncoderType::kVp8) 2039 use_red ? VideoEncoder::Create(VideoEncoder::EncoderType::kVp8)
2041 : nullptr), 2040 : nullptr),
2042 sender_call_(nullptr), 2041 sender_call_(nullptr),
2043 receiver_call_(nullptr), 2042 receiver_call_(nullptr),
2044 start_runtime_ms_(-1) {} 2043 start_runtime_ms_(-1) {}
2045 2044
2046 private: 2045 private:
2047 void OnFrame(const VideoFrame& video_frame) override {}
2048
2049 Action OnSendRtp(const uint8_t* packet, size_t length) override { 2046 Action OnSendRtp(const uint8_t* packet, size_t length) override {
2050 if (MinMetricRunTimePassed()) 2047 if (MinMetricRunTimePassed())
2051 observation_complete_.Set(); 2048 observation_complete_.Set();
2052 2049
2053 return SEND_PACKET; 2050 return SEND_PACKET;
2054 } 2051 }
2055 2052
2056 bool MinMetricRunTimePassed() { 2053 bool MinMetricRunTimePassed() {
2057 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds(); 2054 int64_t now = Clock::GetRealTimeClock()->TimeInMilliseconds();
2058 if (start_runtime_ms_ == -1) { 2055 if (start_runtime_ms_ == -1) {
2059 start_runtime_ms_ = now; 2056 start_runtime_ms_ = now;
2060 return false; 2057 return false;
2061 } 2058 }
2062 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000; 2059 int64_t elapsed_sec = (now - start_runtime_ms_) / 1000;
2063 return elapsed_sec > metrics::kMinRunTimeInSeconds * 2; 2060 return elapsed_sec > metrics::kMinRunTimeInSeconds * 2;
2064 } 2061 }
2065 2062
2066 void ModifyVideoConfigs( 2063 void ModifyVideoConfigs(
2067 VideoSendStream::Config* send_config, 2064 VideoSendStream::Config* send_config,
2068 std::vector<VideoReceiveStream::Config>* receive_configs, 2065 std::vector<VideoReceiveStream::Config>* receive_configs,
2069 VideoEncoderConfig* encoder_config) override { 2066 VideoEncoderConfig* encoder_config) override {
2070 // NACK 2067 // NACK
2071 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 2068 send_config->rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
2072 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs; 2069 (*receive_configs)[0].rtp.nack.rtp_history_ms = kNackRtpHistoryMs;
2073 (*receive_configs)[0].renderer = this;
2074 // FEC 2070 // FEC
2075 if (use_red_) { 2071 if (use_red_) {
2076 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; 2072 send_config->rtp.fec.ulpfec_payload_type = kUlpfecPayloadType;
2077 send_config->rtp.fec.red_payload_type = kRedPayloadType; 2073 send_config->rtp.fec.red_payload_type = kRedPayloadType;
2078 send_config->encoder_settings.encoder = vp8_encoder_.get(); 2074 send_config->encoder_settings.encoder = vp8_encoder_.get();
2079 send_config->encoder_settings.payload_name = "VP8"; 2075 send_config->encoder_settings.payload_name = "VP8";
2080 (*receive_configs)[0].decoders[0].payload_name = "VP8"; 2076 (*receive_configs)[0].decoders[0].payload_name = "VP8";
2081 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType; 2077 (*receive_configs)[0].rtp.fec.red_payload_type = kRedPayloadType;
2082 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType; 2078 (*receive_configs)[0].rtp.fec.ulpfec_payload_type = kUlpfecPayloadType;
2083 } 2079 }
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2487 VideoSendStream* send_stream_; 2483 VideoSendStream* send_stream_;
2488 uint32_t bitrate_kbps_ GUARDED_BY(crit_); 2484 uint32_t bitrate_kbps_ GUARDED_BY(crit_);
2489 } test; 2485 } test;
2490 2486
2491 RunBaseTest(&test); 2487 RunBaseTest(&test);
2492 } 2488 }
2493 2489
2494 TEST_F(EndToEndTest, GetStats) { 2490 TEST_F(EndToEndTest, GetStats) {
2495 static const int kStartBitrateBps = 3000000; 2491 static const int kStartBitrateBps = 3000000;
2496 static const int kExpectedRenderDelayMs = 20; 2492 static const int kExpectedRenderDelayMs = 20;
2497
2498 class ReceiveStreamRenderer : public rtc::VideoSinkInterface<VideoFrame> {
2499 public:
2500 ReceiveStreamRenderer() {}
2501
2502 private:
2503 void OnFrame(const VideoFrame& video_frame) override {}
2504 };
2505
2506 class StatsObserver : public test::EndToEndTest, 2493 class StatsObserver : public test::EndToEndTest,
2507 public rtc::VideoSinkInterface<VideoFrame> { 2494 public rtc::VideoSinkInterface<VideoFrame> {
2508 public: 2495 public:
2509 StatsObserver() 2496 StatsObserver()
2510 : EndToEndTest(kLongTimeoutMs), 2497 : EndToEndTest(kLongTimeoutMs),
2511 encoder_(Clock::GetRealTimeClock(), 10), 2498 encoder_(Clock::GetRealTimeClock(), 10),
2512 send_stream_(nullptr), 2499 send_stream_(nullptr),
2513 expected_send_ssrcs_(), 2500 expected_send_ssrcs_(),
2514 check_stats_event_(false, false) {} 2501 check_stats_event_(false, false) {}
2515 2502
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 VideoEncoderConfig* encoder_config) override { 2683 VideoEncoderConfig* encoder_config) override {
2697 send_config->pre_encode_callback = this; // Used to inject delay. 2684 send_config->pre_encode_callback = this; // Used to inject delay.
2698 expected_cname_ = send_config->rtp.c_name = "SomeCName"; 2685 expected_cname_ = send_config->rtp.c_name = "SomeCName";
2699 2686
2700 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs; 2687 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs;
2701 for (size_t i = 0; i < ssrcs.size(); ++i) { 2688 for (size_t i = 0; i < ssrcs.size(); ++i) {
2702 expected_send_ssrcs_.insert(ssrcs[i]); 2689 expected_send_ssrcs_.insert(ssrcs[i]);
2703 expected_receive_ssrcs_.push_back( 2690 expected_receive_ssrcs_.push_back(
2704 (*receive_configs)[i].rtp.remote_ssrc); 2691 (*receive_configs)[i].rtp.remote_ssrc);
2705 (*receive_configs)[i].render_delay_ms = kExpectedRenderDelayMs; 2692 (*receive_configs)[i].render_delay_ms = kExpectedRenderDelayMs;
2706 (*receive_configs)[i].renderer = &receive_stream_renderer_;
2707 } 2693 }
2708 // Use a delayed encoder to make sure we see CpuOveruseMetrics stats that 2694 // Use a delayed encoder to make sure we see CpuOveruseMetrics stats that
2709 // are non-zero. 2695 // are non-zero.
2710 send_config->encoder_settings.encoder = &encoder_; 2696 send_config->encoder_settings.encoder = &encoder_;
2711 } 2697 }
2712 2698
2713 size_t GetNumVideoStreams() const override { return kNumSsrcs; } 2699 size_t GetNumVideoStreams() const override { return kNumSsrcs; }
2714 2700
2715 void OnVideoStreamsCreated( 2701 void OnVideoStreamsCreated(
2716 VideoSendStream* send_stream, 2702 VideoSendStream* send_stream,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 std::map<std::string, bool> receive_stats_filled_; 2752 std::map<std::string, bool> receive_stats_filled_;
2767 2753
2768 VideoSendStream* send_stream_; 2754 VideoSendStream* send_stream_;
2769 std::map<std::string, bool> send_stats_filled_; 2755 std::map<std::string, bool> send_stats_filled_;
2770 2756
2771 std::vector<uint32_t> expected_receive_ssrcs_; 2757 std::vector<uint32_t> expected_receive_ssrcs_;
2772 std::set<uint32_t> expected_send_ssrcs_; 2758 std::set<uint32_t> expected_send_ssrcs_;
2773 std::string expected_cname_; 2759 std::string expected_cname_;
2774 2760
2775 rtc::Event check_stats_event_; 2761 rtc::Event check_stats_event_;
2776 ReceiveStreamRenderer receive_stream_renderer_;
2777 } test; 2762 } test;
2778 2763
2779 RunBaseTest(&test); 2764 RunBaseTest(&test);
2780 } 2765 }
2781 2766
2782 TEST_F(EndToEndTest, ReceiverReferenceTimeReportEnabled) { 2767 TEST_F(EndToEndTest, ReceiverReferenceTimeReportEnabled) {
2783 TestXrReceiverReferenceTimeReport(true); 2768 TestXrReceiverReferenceTimeReport(true);
2784 } 2769 }
2785 2770
2786 TEST_F(EndToEndTest, ReceiverReferenceTimeReportDisabled) { 2771 TEST_F(EndToEndTest, ReceiverReferenceTimeReportDisabled) {
(...skipping 769 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 private: 3541 private:
3557 bool video_observed_; 3542 bool video_observed_;
3558 bool audio_observed_; 3543 bool audio_observed_;
3559 SequenceNumberUnwrapper unwrapper_; 3544 SequenceNumberUnwrapper unwrapper_;
3560 std::set<int64_t> received_packet_ids_; 3545 std::set<int64_t> received_packet_ids_;
3561 } test; 3546 } test;
3562 3547
3563 RunBaseTest(&test); 3548 RunBaseTest(&test);
3564 } 3549 }
3565 } // namespace webrtc 3550 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator_abs_send_time.cc ('k') | webrtc/video/video_receive_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698