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 |
11 #ifndef WEBRTC_VIDEO_RAMPUP_TESTS_H_ | 11 #ifndef WEBRTC_VIDEO_RAMPUP_TESTS_H_ |
12 #define WEBRTC_VIDEO_RAMPUP_TESTS_H_ | 12 #define WEBRTC_VIDEO_RAMPUP_TESTS_H_ |
13 | 13 |
14 #include <map> | 14 #include <map> |
15 #include <string> | 15 #include <string> |
16 #include <vector> | 16 #include <vector> |
17 | 17 |
18 #include "webrtc/base/scoped_ptr.h" | 18 #include "webrtc/base/scoped_ptr.h" |
19 #include "webrtc/call.h" | 19 #include "webrtc/call.h" |
20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" | 20 #include "webrtc/modules/remote_bitrate_estimator/include/remote_bitrate_estimat
or.h" |
21 #include "webrtc/system_wrappers/interface/event_wrapper.h" | 21 #include "webrtc/system_wrappers/interface/event_wrapper.h" |
22 #include "webrtc/test/call_test.h" | 22 #include "webrtc/test/call_test.h" |
23 #include "webrtc/video/transport_adapter.h" | 23 #include "webrtc/video/transport_adapter.h" |
24 | 24 |
25 namespace webrtc { | 25 namespace webrtc { |
26 | 26 |
27 static const int kTransmissionTimeOffsetExtensionId = 6; | 27 static const int kTransmissionTimeOffsetExtensionId = 6; |
28 static const int kAbsSendTimeExtensionId = 7; | 28 static const int kAbsSendTimeExtensionId = 7; |
29 static const int kTransportSequenceNumberExtensionId = 8; | |
30 static const unsigned int kSingleStreamTargetBps = 1000000; | 29 static const unsigned int kSingleStreamTargetBps = 1000000; |
31 | 30 |
32 class Clock; | 31 class Clock; |
33 class PacketRouter; | |
34 class ReceiveStatistics; | 32 class ReceiveStatistics; |
35 class RtpHeaderParser; | 33 class RtpHeaderParser; |
36 class RTPPayloadRegistry; | 34 class RTPPayloadRegistry; |
37 class RtpRtcp; | 35 class RtpRtcp; |
38 | 36 |
39 class StreamObserver : public newapi::Transport, public RemoteBitrateObserver { | 37 class StreamObserver : public newapi::Transport, public RemoteBitrateObserver { |
40 public: | 38 public: |
41 typedef std::map<uint32_t, int> BytesSentMap; | 39 typedef std::map<uint32_t, int> BytesSentMap; |
42 typedef std::map<uint32_t, uint32_t> SsrcMap; | 40 typedef std::map<uint32_t, uint32_t> SsrcMap; |
43 StreamObserver(const SsrcMap& rtx_media_ssrcs, | 41 StreamObserver(const SsrcMap& rtx_media_ssrcs, |
44 newapi::Transport* feedback_transport, | 42 newapi::Transport* feedback_transport, |
45 Clock* clock); | 43 Clock* clock); |
46 virtual ~StreamObserver(); | |
47 | 44 |
48 void set_expected_bitrate_bps(unsigned int expected_bitrate_bps); | 45 void set_expected_bitrate_bps(unsigned int expected_bitrate_bps); |
49 | 46 |
50 void set_start_bitrate_bps(unsigned int start_bitrate_bps); | 47 void set_start_bitrate_bps(unsigned int start_bitrate_bps); |
51 | 48 |
52 void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs, | 49 void OnReceiveBitrateChanged(const std::vector<unsigned int>& ssrcs, |
53 unsigned int bitrate) override; | 50 unsigned int bitrate) override; |
54 | 51 |
55 bool SendRtp(const uint8_t* packet, size_t length) override; | 52 bool SendRtp(const uint8_t* packet, size_t length) override; |
56 | 53 |
57 bool SendRtcp(const uint8_t* packet, size_t length) override; | 54 bool SendRtcp(const uint8_t* packet, size_t length) override; |
58 | 55 |
59 EventTypeWrapper Wait(); | 56 EventTypeWrapper Wait(); |
60 | 57 |
61 void SetRemoteBitrateEstimator(RemoteBitrateEstimator* rbe); | 58 void SetRemoteBitrateEstimator(RemoteBitrateEstimator* rbe); |
62 | 59 |
63 PacketRouter* GetPacketRouter(); | |
64 | |
65 private: | 60 private: |
66 void ReportResult(const std::string& measurement, | 61 void ReportResult(const std::string& measurement, |
67 size_t value, | 62 size_t value, |
68 const std::string& units); | 63 const std::string& units); |
69 void TriggerTestDone() EXCLUSIVE_LOCKS_REQUIRED(crit_); | 64 void TriggerTestDone() EXCLUSIVE_LOCKS_REQUIRED(crit_); |
70 | 65 |
71 Clock* const clock_; | 66 Clock* const clock_; |
72 const rtc::scoped_ptr<EventWrapper> test_done_; | 67 const rtc::scoped_ptr<EventWrapper> test_done_; |
73 const rtc::scoped_ptr<RtpHeaderParser> rtp_parser_; | 68 const rtc::scoped_ptr<RtpHeaderParser> rtp_parser_; |
74 rtc::scoped_ptr<RtpRtcp> rtp_rtcp_; | 69 rtc::scoped_ptr<RtpRtcp> rtp_rtcp_; |
75 rtc::scoped_ptr<PacketRouter> packet_router_; | |
76 internal::TransportAdapter feedback_transport_; | 70 internal::TransportAdapter feedback_transport_; |
77 const rtc::scoped_ptr<ReceiveStatistics> receive_stats_; | 71 const rtc::scoped_ptr<ReceiveStatistics> receive_stats_; |
78 const rtc::scoped_ptr<RTPPayloadRegistry> payload_registry_; | 72 const rtc::scoped_ptr<RTPPayloadRegistry> payload_registry_; |
79 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; | 73 rtc::scoped_ptr<RemoteBitrateEstimator> remote_bitrate_estimator_; |
80 | 74 |
81 rtc::CriticalSection crit_; | 75 rtc::CriticalSection crit_; |
82 unsigned int expected_bitrate_bps_ GUARDED_BY(crit_); | 76 unsigned int expected_bitrate_bps_ GUARDED_BY(crit_); |
83 unsigned int start_bitrate_bps_ GUARDED_BY(crit_); | 77 unsigned int start_bitrate_bps_ GUARDED_BY(crit_); |
84 SsrcMap rtx_media_ssrcs_ GUARDED_BY(crit_); | 78 SsrcMap rtx_media_ssrcs_ GUARDED_BY(crit_); |
85 size_t total_sent_ GUARDED_BY(crit_); | 79 size_t total_sent_ GUARDED_BY(crit_); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void RunRampUpTest(size_t num_streams, | 153 void RunRampUpTest(size_t num_streams, |
160 unsigned int start_bitrate_bps, | 154 unsigned int start_bitrate_bps, |
161 const std::string& extension_type, | 155 const std::string& extension_type, |
162 bool rtx, | 156 bool rtx, |
163 bool red); | 157 bool red); |
164 | 158 |
165 void RunRampUpDownUpTest(size_t number_of_streams, bool rtx, bool red); | 159 void RunRampUpDownUpTest(size_t number_of_streams, bool rtx, bool red); |
166 }; | 160 }; |
167 } // namespace webrtc | 161 } // namespace webrtc |
168 #endif // WEBRTC_VIDEO_RAMPUP_TESTS_H_ | 162 #endif // WEBRTC_VIDEO_RAMPUP_TESTS_H_ |
OLD | NEW |