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

Side by Side Diff: webrtc/call/rampup_tests.h

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

Powered by Google App Engine
This is Rietveld 408576698