| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | |
| 3 * | |
| 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 | |
| 6 * tree. An additional intellectual property rights grant can be found | |
| 7 * in the file PATENTS. All contributing project authors may | |
| 8 * be found in the AUTHORS file in the root of the source tree. | |
| 9 */ | |
| 10 | |
| 11 #ifndef WEBRTC_VIDEO_RAMPUP_TESTS_H_ | |
| 12 #define WEBRTC_VIDEO_RAMPUP_TESTS_H_ | |
| 13 | |
| 14 #include <map> | |
| 15 #include <string> | |
| 16 #include <vector> | |
| 17 | |
| 18 #include "webrtc/base/event.h" | |
| 19 #include "webrtc/base/scoped_ptr.h" | |
| 20 #include "webrtc/call.h" | |
| 21 #include "webrtc/call/transport_adapter.h" | |
| 22 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | |
| 23 #include "webrtc/test/call_test.h" | |
| 24 | |
| 25 namespace webrtc { | |
| 26 | |
| 27 static const int kTransmissionTimeOffsetExtensionId = 6; | |
| 28 static const int kAbsSendTimeExtensionId = 7; | |
| 29 static const int kTransportSequenceNumberExtensionId = 8; | |
| 30 static const unsigned int kSingleStreamTargetBps = 1000000; | |
| 31 | |
| 32 class Clock; | |
| 33 class PacketRouter; | |
| 34 class ReceiveStatistics; | |
| 35 class RtpHeaderParser; | |
| 36 class RTPPayloadRegistry; | |
| 37 class RtpRtcp; | |
| 38 | |
| 39 class RampUpTester : public test::EndToEndTest { | |
| 40 public: | |
| 41 RampUpTester(size_t num_streams, | |
| 42 unsigned int start_bitrate_bps, | |
| 43 const std::string& extension_type, | |
| 44 bool rtx, | |
| 45 bool red); | |
| 46 ~RampUpTester() override; | |
| 47 | |
| 48 void PerformTest() override; | |
| 49 | |
| 50 protected: | |
| 51 virtual bool PollStats(); | |
| 52 | |
| 53 void AccumulateStats(const VideoSendStream::StreamStats& stream, | |
| 54 size_t* total_packets_sent, | |
| 55 size_t* total_sent, | |
| 56 size_t* padding_sent, | |
| 57 size_t* media_sent) const; | |
| 58 | |
| 59 void ReportResult(const std::string& measurement, | |
| 60 size_t value, | |
| 61 const std::string& units) const; | |
| 62 void TriggerTestDone(); | |
| 63 | |
| 64 rtc::Event event_; | |
| 65 Clock* const clock_; | |
| 66 FakeNetworkPipe::Config forward_transport_config_; | |
| 67 const size_t num_streams_; | |
| 68 const bool rtx_; | |
| 69 const bool red_; | |
| 70 VideoSendStream* send_stream_; | |
| 71 test::PacketTransport* send_transport_; | |
| 72 | |
| 73 private: | |
| 74 typedef std::map<uint32_t, uint32_t> SsrcMap; | |
| 75 | |
| 76 Call::Config GetSenderCallConfig() override; | |
| 77 void OnStreamsCreated( | |
| 78 VideoSendStream* send_stream, | |
| 79 const std::vector<VideoReceiveStream*>& receive_streams) override; | |
| 80 void OnTransportsCreated(test::PacketTransport* send_transport, | |
| 81 test::PacketTransport* receive_transport) override; | |
| 82 size_t GetNumStreams() const; | |
| 83 void ModifyConfigs(VideoSendStream::Config* send_config, | |
| 84 std::vector<VideoReceiveStream::Config>* receive_configs, | |
| 85 VideoEncoderConfig* encoder_config) override; | |
| 86 void OnCallsCreated(Call* sender_call, Call* receiver_call) override; | |
| 87 | |
| 88 static bool BitrateStatsPollingThread(void* obj); | |
| 89 | |
| 90 const int start_bitrate_bps_; | |
| 91 bool start_bitrate_verified_; | |
| 92 int expected_bitrate_bps_; | |
| 93 int64_t test_start_ms_; | |
| 94 int64_t ramp_up_finished_ms_; | |
| 95 | |
| 96 const std::string extension_type_; | |
| 97 std::vector<uint32_t> ssrcs_; | |
| 98 std::vector<uint32_t> rtx_ssrcs_; | |
| 99 SsrcMap rtx_ssrc_map_; | |
| 100 | |
| 101 rtc::PlatformThread poller_thread_; | |
| 102 Call* sender_call_; | |
| 103 }; | |
| 104 | |
| 105 class RampUpDownUpTester : public RampUpTester { | |
| 106 public: | |
| 107 RampUpDownUpTester(size_t num_streams, | |
| 108 unsigned int start_bitrate_bps, | |
| 109 const std::string& extension_type, | |
| 110 bool rtx, | |
| 111 bool red); | |
| 112 ~RampUpDownUpTester() override; | |
| 113 | |
| 114 protected: | |
| 115 bool PollStats() override; | |
| 116 | |
| 117 private: | |
| 118 static const int kHighBandwidthLimitBps = 80000; | |
| 119 static const int kExpectedHighBitrateBps = 60000; | |
| 120 static const int kLowBandwidthLimitBps = 20000; | |
| 121 static const int kExpectedLowBitrateBps = 20000; | |
| 122 enum TestStates { kFirstRampup, kLowRate, kSecondRampup }; | |
| 123 | |
| 124 Call::Config GetReceiverCallConfig() override; | |
| 125 | |
| 126 std::string GetModifierString() const; | |
| 127 void EvolveTestState(int bitrate_bps, bool suspended); | |
| 128 | |
| 129 TestStates test_state_; | |
| 130 int64_t state_start_ms_; | |
| 131 int64_t interval_start_ms_; | |
| 132 int sent_bytes_; | |
| 133 }; | |
| 134 } // namespace webrtc | |
| 135 #endif // WEBRTC_VIDEO_RAMPUP_TESTS_H_ | |
| OLD | NEW |