OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 | 10 |
(...skipping 15 matching lines...) Expand all Loading... |
26 static const int kAbsSendTimeExtensionId = 7; | 26 static const int kAbsSendTimeExtensionId = 7; |
27 static const int kTransportSequenceNumberExtensionId = 8; | 27 static const int kTransportSequenceNumberExtensionId = 8; |
28 static const unsigned int kSingleStreamTargetBps = 1000000; | 28 static const unsigned int kSingleStreamTargetBps = 1000000; |
29 | 29 |
30 class Clock; | 30 class Clock; |
31 | 31 |
32 class RampUpTester : public test::EndToEndTest { | 32 class RampUpTester : public test::EndToEndTest { |
33 public: | 33 public: |
34 RampUpTester(size_t num_video_streams, | 34 RampUpTester(size_t num_video_streams, |
35 size_t num_audio_streams, | 35 size_t num_audio_streams, |
36 size_t num_flexfec_streams, | |
37 unsigned int start_bitrate_bps, | 36 unsigned int start_bitrate_bps, |
38 int64_t min_run_time_ms, | 37 int64_t min_run_time_ms, |
39 const std::string& extension_type, | 38 const std::string& extension_type, |
40 bool rtx, | 39 bool rtx, |
41 bool red, | 40 bool red, |
42 bool report_perf_stats); | 41 bool report_perf_stats); |
43 ~RampUpTester() override; | 42 ~RampUpTester() override; |
44 | 43 |
45 size_t GetNumVideoStreams() const override; | 44 size_t GetNumVideoStreams() const override; |
46 size_t GetNumAudioStreams() const override; | 45 size_t GetNumAudioStreams() const override; |
47 size_t GetNumFlexfecStreams() const override; | |
48 | 46 |
49 void PerformTest() override; | 47 void PerformTest() override; |
50 | 48 |
51 protected: | 49 protected: |
52 virtual bool PollStats(); | 50 virtual bool PollStats(); |
53 | 51 |
54 void AccumulateStats(const VideoSendStream::StreamStats& stream, | 52 void AccumulateStats(const VideoSendStream::StreamStats& stream, |
55 size_t* total_packets_sent, | 53 size_t* total_packets_sent, |
56 size_t* total_sent, | 54 size_t* total_sent, |
57 size_t* padding_sent, | 55 size_t* padding_sent, |
58 size_t* media_sent) const; | 56 size_t* media_sent) const; |
59 | 57 |
60 void ReportResult(const std::string& measurement, | 58 void ReportResult(const std::string& measurement, |
61 size_t value, | 59 size_t value, |
62 const std::string& units) const; | 60 const std::string& units) const; |
63 void TriggerTestDone(); | 61 void TriggerTestDone(); |
64 | 62 |
65 webrtc::RtcEventLogNullImpl event_log_; | 63 webrtc::RtcEventLogNullImpl event_log_; |
66 rtc::Event event_; | 64 rtc::Event event_; |
67 Clock* const clock_; | 65 Clock* const clock_; |
68 FakeNetworkPipe::Config forward_transport_config_; | 66 FakeNetworkPipe::Config forward_transport_config_; |
69 const size_t num_video_streams_; | 67 const size_t num_video_streams_; |
70 const size_t num_audio_streams_; | 68 const size_t num_audio_streams_; |
71 const size_t num_flexfec_streams_; | |
72 const bool rtx_; | 69 const bool rtx_; |
73 const bool red_; | 70 const bool red_; |
74 Call* sender_call_; | 71 Call* sender_call_; |
75 VideoSendStream* send_stream_; | 72 VideoSendStream* send_stream_; |
76 test::PacketTransport* send_transport_; | 73 test::PacketTransport* send_transport_; |
77 | 74 |
78 private: | 75 private: |
79 typedef std::map<uint32_t, uint32_t> SsrcMap; | 76 typedef std::map<uint32_t, uint32_t> SsrcMap; |
80 class VideoStreamFactory; | 77 class VideoStreamFactory; |
81 | 78 |
82 Call::Config GetSenderCallConfig() override; | 79 Call::Config GetSenderCallConfig() override; |
83 void OnVideoStreamsCreated( | 80 void OnVideoStreamsCreated( |
84 VideoSendStream* send_stream, | 81 VideoSendStream* send_stream, |
85 const std::vector<VideoReceiveStream*>& receive_streams) override; | 82 const std::vector<VideoReceiveStream*>& receive_streams) override; |
86 test::PacketTransport* CreateSendTransport(Call* sender_call) override; | 83 test::PacketTransport* CreateSendTransport(Call* sender_call) override; |
87 void ModifyVideoConfigs( | 84 void ModifyVideoConfigs( |
88 VideoSendStream::Config* send_config, | 85 VideoSendStream::Config* send_config, |
89 std::vector<VideoReceiveStream::Config>* receive_configs, | 86 std::vector<VideoReceiveStream::Config>* receive_configs, |
90 VideoEncoderConfig* encoder_config) override; | 87 VideoEncoderConfig* encoder_config) override; |
91 void ModifyAudioConfigs( | 88 void ModifyAudioConfigs( |
92 AudioSendStream::Config* send_config, | 89 AudioSendStream::Config* send_config, |
93 std::vector<AudioReceiveStream::Config>* receive_configs) override; | 90 std::vector<AudioReceiveStream::Config>* receive_configs) override; |
94 void ModifyFlexfecConfigs( | |
95 std::vector<FlexfecReceiveStream::Config>* receive_configs) override; | |
96 void OnCallsCreated(Call* sender_call, Call* receiver_call) override; | 91 void OnCallsCreated(Call* sender_call, Call* receiver_call) override; |
97 | 92 |
98 static bool BitrateStatsPollingThread(void* obj); | 93 static bool BitrateStatsPollingThread(void* obj); |
99 | 94 |
100 const int start_bitrate_bps_; | 95 const int start_bitrate_bps_; |
101 const int64_t min_run_time_ms_; | 96 const int64_t min_run_time_ms_; |
102 const bool report_perf_stats_; | 97 const bool report_perf_stats_; |
103 int expected_bitrate_bps_; | 98 int expected_bitrate_bps_; |
104 int64_t test_start_ms_; | 99 int64_t test_start_ms_; |
105 int64_t ramp_up_finished_ms_; | 100 int64_t ramp_up_finished_ms_; |
106 | 101 |
107 const std::string extension_type_; | 102 const std::string extension_type_; |
108 std::vector<uint32_t> video_ssrcs_; | 103 std::vector<uint32_t> video_ssrcs_; |
109 std::vector<uint32_t> video_rtx_ssrcs_; | 104 std::vector<uint32_t> video_rtx_ssrcs_; |
110 std::vector<uint32_t> audio_ssrcs_; | 105 std::vector<uint32_t> audio_ssrcs_; |
111 | 106 |
112 rtc::PlatformThread poller_thread_; | 107 rtc::PlatformThread poller_thread_; |
113 }; | 108 }; |
114 | 109 |
115 class RampUpDownUpTester : public RampUpTester { | 110 class RampUpDownUpTester : public RampUpTester { |
116 public: | 111 public: |
117 RampUpDownUpTester(size_t num_video_streams, | 112 RampUpDownUpTester(size_t num_video_streams, |
118 size_t num_audio_streams, | 113 size_t num_audio_streams, |
119 size_t num_flexfec_streams, | |
120 unsigned int start_bitrate_bps, | 114 unsigned int start_bitrate_bps, |
121 const std::string& extension_type, | 115 const std::string& extension_type, |
122 bool rtx, | 116 bool rtx, |
123 bool red, | 117 bool red); |
124 const std::vector<int>& loss_rates); | |
125 ~RampUpDownUpTester() override; | 118 ~RampUpDownUpTester() override; |
126 | 119 |
127 protected: | 120 protected: |
128 bool PollStats() override; | 121 bool PollStats() override; |
129 | 122 |
130 private: | 123 private: |
131 enum TestStates { | 124 enum TestStates { kFirstRampup, kLowRate, kSecondRampup }; |
132 kFirstRampup = 0, | |
133 kLowRate, | |
134 kSecondRampup, | |
135 kTestEnd, | |
136 kTransitionToNextState, | |
137 }; | |
138 | 125 |
139 Call::Config GetReceiverCallConfig() override; | 126 Call::Config GetReceiverCallConfig() override; |
140 | 127 |
141 std::string GetModifierString() const; | 128 std::string GetModifierString() const; |
142 int GetExpectedHighBitrate() const; | 129 int GetExpectedHighBitrate() const; |
143 int GetHighLinkCapacity() const; | 130 int GetHighLinkCapacity() const; |
144 size_t GetFecBytes() const; | |
145 bool ExpectingFec() const; | |
146 void EvolveTestState(int bitrate_bps, bool suspended); | 131 void EvolveTestState(int bitrate_bps, bool suspended); |
147 | 132 |
148 const std::vector<int> link_rates_; | |
149 TestStates test_state_; | 133 TestStates test_state_; |
150 TestStates next_state_; | |
151 int64_t state_start_ms_; | 134 int64_t state_start_ms_; |
152 int64_t interval_start_ms_; | 135 int64_t interval_start_ms_; |
153 int sent_bytes_; | 136 int sent_bytes_; |
154 std::vector<int> loss_rates_; | |
155 }; | 137 }; |
156 } // namespace webrtc | 138 } // namespace webrtc |
157 #endif // WEBRTC_CALL_RAMPUP_TESTS_H_ | 139 #endif // WEBRTC_CALL_RAMPUP_TESTS_H_ |
OLD | NEW |