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 #ifndef WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ | 10 #ifndef WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ |
11 #define WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ | 11 #define WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ |
12 | 12 |
13 #include <map> | 13 #include <map> |
14 #include <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/criticalsection.h" | 17 #include "webrtc/base/criticalsection.h" |
18 #include "webrtc/base/event.h" | 18 #include "webrtc/base/event.h" |
19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" | 19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" |
| 20 #include "webrtc/system_wrappers/include/field_trial.h" |
20 #include "webrtc/test/constants.h" | 21 #include "webrtc/test/constants.h" |
21 #include "webrtc/test/direct_transport.h" | 22 #include "webrtc/test/direct_transport.h" |
22 #include "webrtc/test/gtest.h" | 23 #include "webrtc/test/gtest.h" |
23 #include "webrtc/typedefs.h" | 24 #include "webrtc/typedefs.h" |
24 #include "webrtc/video_send_stream.h" | 25 #include "webrtc/video_send_stream.h" |
25 | 26 |
| 27 namespace { |
| 28 const int kShortTimeoutMs = 500; |
| 29 } |
| 30 |
26 namespace webrtc { | 31 namespace webrtc { |
27 namespace test { | 32 namespace test { |
28 | 33 |
29 class PacketTransport; | 34 class PacketTransport; |
30 | 35 |
31 class RtpRtcpObserver { | 36 class RtpRtcpObserver { |
32 public: | 37 public: |
33 enum Action { | 38 enum Action { |
34 SEND_PACKET, | 39 SEND_PACKET, |
35 DROP_PACKET, | 40 DROP_PACKET, |
36 }; | 41 }; |
37 | 42 |
38 virtual ~RtpRtcpObserver() {} | 43 virtual ~RtpRtcpObserver() {} |
39 | 44 |
40 virtual bool Wait() { return observation_complete_.Wait(timeout_ms_); } | 45 virtual bool Wait() { |
| 46 if (field_trial::FindFullName("WebRTC-QuickPerfTest") == "Enabled") { |
| 47 observation_complete_.Wait(kShortTimeoutMs); |
| 48 return true; |
| 49 } |
| 50 return observation_complete_.Wait(timeout_ms_); |
| 51 } |
41 | 52 |
42 virtual Action OnSendRtp(const uint8_t* packet, size_t length) { | 53 virtual Action OnSendRtp(const uint8_t* packet, size_t length) { |
43 return SEND_PACKET; | 54 return SEND_PACKET; |
44 } | 55 } |
45 | 56 |
46 virtual Action OnSendRtcp(const uint8_t* packet, size_t length) { | 57 virtual Action OnSendRtcp(const uint8_t* packet, size_t length) { |
47 return SEND_PACKET; | 58 return SEND_PACKET; |
48 } | 59 } |
49 | 60 |
50 virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) { | 61 virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 return true; // Will never happen, makes compiler happy. | 141 return true; // Will never happen, makes compiler happy. |
131 } | 142 } |
132 | 143 |
133 RtpRtcpObserver* const observer_; | 144 RtpRtcpObserver* const observer_; |
134 TransportType transport_type_; | 145 TransportType transport_type_; |
135 }; | 146 }; |
136 } // namespace test | 147 } // namespace test |
137 } // namespace webrtc | 148 } // namespace webrtc |
138 | 149 |
139 #endif // WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ | 150 #endif // WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ |
OLD | NEW |