| 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 <algorithm> | 10 #include <algorithm> |
| (...skipping 2536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2547 RunBaseTest(&test); | 2547 RunBaseTest(&test); |
| 2548 } | 2548 } |
| 2549 | 2549 |
| 2550 TEST_F(EndToEndTest, GetStats) { | 2550 TEST_F(EndToEndTest, GetStats) { |
| 2551 static const int kStartBitrateBps = 3000000; | 2551 static const int kStartBitrateBps = 3000000; |
| 2552 static const int kExpectedRenderDelayMs = 20; | 2552 static const int kExpectedRenderDelayMs = 20; |
| 2553 class StatsObserver : public test::EndToEndTest, public I420FrameCallback { | 2553 class StatsObserver : public test::EndToEndTest, public I420FrameCallback { |
| 2554 public: | 2554 public: |
| 2555 StatsObserver() | 2555 StatsObserver() |
| 2556 : EndToEndTest(kLongTimeoutMs), | 2556 : EndToEndTest(kLongTimeoutMs), |
| 2557 encoder_(Clock::GetRealTimeClock(), 10), |
| 2557 send_stream_(nullptr), | 2558 send_stream_(nullptr), |
| 2558 expected_send_ssrcs_(), | 2559 expected_send_ssrcs_(), |
| 2559 check_stats_event_(false, false) {} | 2560 check_stats_event_(false, false) {} |
| 2560 | 2561 |
| 2561 private: | 2562 private: |
| 2562 Action OnSendRtp(const uint8_t* packet, size_t length) override { | 2563 Action OnSendRtp(const uint8_t* packet, size_t length) override { |
| 2563 check_stats_event_.Set(); | 2564 check_stats_event_.Set(); |
| 2564 return SEND_PACKET; | 2565 return SEND_PACKET; |
| 2565 } | 2566 } |
| 2566 | 2567 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2744 send_config->pre_encode_callback = this; // Used to inject delay. | 2745 send_config->pre_encode_callback = this; // Used to inject delay. |
| 2745 expected_cname_ = send_config->rtp.c_name = "SomeCName"; | 2746 expected_cname_ = send_config->rtp.c_name = "SomeCName"; |
| 2746 | 2747 |
| 2747 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs; | 2748 const std::vector<uint32_t>& ssrcs = send_config->rtp.ssrcs; |
| 2748 for (size_t i = 0; i < ssrcs.size(); ++i) { | 2749 for (size_t i = 0; i < ssrcs.size(); ++i) { |
| 2749 expected_send_ssrcs_.insert(ssrcs[i]); | 2750 expected_send_ssrcs_.insert(ssrcs[i]); |
| 2750 expected_receive_ssrcs_.push_back( | 2751 expected_receive_ssrcs_.push_back( |
| 2751 (*receive_configs)[i].rtp.remote_ssrc); | 2752 (*receive_configs)[i].rtp.remote_ssrc); |
| 2752 (*receive_configs)[i].render_delay_ms = kExpectedRenderDelayMs; | 2753 (*receive_configs)[i].render_delay_ms = kExpectedRenderDelayMs; |
| 2753 } | 2754 } |
| 2755 // Use a delayed encoder to make sure we see CpuOveruseMetrics stats that |
| 2756 // are non-zero. |
| 2757 send_config->encoder_settings.encoder = &encoder_; |
| 2754 } | 2758 } |
| 2755 | 2759 |
| 2756 size_t GetNumVideoStreams() const override { return kNumSsrcs; } | 2760 size_t GetNumVideoStreams() const override { return kNumSsrcs; } |
| 2757 | 2761 |
| 2758 void OnVideoStreamsCreated( | 2762 void OnVideoStreamsCreated( |
| 2759 VideoSendStream* send_stream, | 2763 VideoSendStream* send_stream, |
| 2760 const std::vector<VideoReceiveStream*>& receive_streams) override { | 2764 const std::vector<VideoReceiveStream*>& receive_streams) override { |
| 2761 send_stream_ = send_stream; | 2765 send_stream_ = send_stream; |
| 2762 receive_streams_ = receive_streams; | 2766 receive_streams_ = receive_streams; |
| 2763 } | 2767 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2797 for (std::map<std::string, bool>::const_iterator it = | 2801 for (std::map<std::string, bool>::const_iterator it = |
| 2798 send_stats_filled_.begin(); | 2802 send_stats_filled_.begin(); |
| 2799 it != send_stats_filled_.end(); | 2803 it != send_stats_filled_.end(); |
| 2800 ++it) { | 2804 ++it) { |
| 2801 if (!it->second) { | 2805 if (!it->second) { |
| 2802 ADD_FAILURE() << "Missing send stats: " << it->first; | 2806 ADD_FAILURE() << "Missing send stats: " << it->first; |
| 2803 } | 2807 } |
| 2804 } | 2808 } |
| 2805 } | 2809 } |
| 2806 | 2810 |
| 2811 test::DelayedEncoder encoder_; |
| 2807 std::vector<VideoReceiveStream*> receive_streams_; | 2812 std::vector<VideoReceiveStream*> receive_streams_; |
| 2808 std::map<std::string, bool> receive_stats_filled_; | 2813 std::map<std::string, bool> receive_stats_filled_; |
| 2809 | 2814 |
| 2810 VideoSendStream* send_stream_; | 2815 VideoSendStream* send_stream_; |
| 2811 std::map<std::string, bool> send_stats_filled_; | 2816 std::map<std::string, bool> send_stats_filled_; |
| 2812 | 2817 |
| 2813 std::vector<uint32_t> expected_receive_ssrcs_; | 2818 std::vector<uint32_t> expected_receive_ssrcs_; |
| 2814 std::set<uint32_t> expected_send_ssrcs_; | 2819 std::set<uint32_t> expected_send_ssrcs_; |
| 2815 std::string expected_cname_; | 2820 std::string expected_cname_; |
| 2816 | 2821 |
| (...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3514 private: | 3519 private: |
| 3515 bool video_observed_; | 3520 bool video_observed_; |
| 3516 bool audio_observed_; | 3521 bool audio_observed_; |
| 3517 SequenceNumberUnwrapper unwrapper_; | 3522 SequenceNumberUnwrapper unwrapper_; |
| 3518 std::set<int64_t> received_packet_ids_; | 3523 std::set<int64_t> received_packet_ids_; |
| 3519 } test; | 3524 } test; |
| 3520 | 3525 |
| 3521 RunBaseTest(&test); | 3526 RunBaseTest(&test); |
| 3522 } | 3527 } |
| 3523 } // namespace webrtc | 3528 } // namespace webrtc |
| OLD | NEW |