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

Side by Side Diff: webrtc/test/rtp_rtcp_observer.h

Issue 1487893004: Replace EventWrapper in video/, test/ and call/. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: add some back, EventTimerWrapper is in use Created 5 years 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
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 14 #include <vector>
15 15
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 #include "webrtc/base/criticalsection.h" 18 #include "webrtc/base/criticalsection.h"
19 #include "webrtc/base/event.h"
19 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.h" 20 #include "webrtc/modules/rtp_rtcp/include/rtp_header_parser.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/typedefs.h" 23 #include "webrtc/typedefs.h"
23 #include "webrtc/video_send_stream.h" 24 #include "webrtc/video_send_stream.h"
24 25
25 namespace webrtc { 26 namespace webrtc {
26 namespace test { 27 namespace test {
27 28
28 class PacketTransport; 29 class PacketTransport;
29 30
30 class RtpRtcpObserver { 31 class RtpRtcpObserver {
31 public: 32 public:
32 enum Action { 33 enum Action {
33 SEND_PACKET, 34 SEND_PACKET,
34 DROP_PACKET, 35 DROP_PACKET,
35 }; 36 };
36 37
37 virtual ~RtpRtcpObserver() {} 38 virtual ~RtpRtcpObserver() {}
38 39
39 virtual EventTypeWrapper Wait() { 40 virtual bool Wait() { return observation_complete_.Wait(timeout_ms_); }
40 EventTypeWrapper result = observation_complete_->Wait(timeout_ms_);
41 return result;
42 }
43 41
44 virtual Action OnSendRtp(const uint8_t* packet, size_t length) { 42 virtual Action OnSendRtp(const uint8_t* packet, size_t length) {
45 return SEND_PACKET; 43 return SEND_PACKET;
46 } 44 }
47 45
48 virtual Action OnSendRtcp(const uint8_t* packet, size_t length) { 46 virtual Action OnSendRtcp(const uint8_t* packet, size_t length) {
49 return SEND_PACKET; 47 return SEND_PACKET;
50 } 48 }
51 49
52 virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) { 50 virtual Action OnReceiveRtp(const uint8_t* packet, size_t length) {
53 return SEND_PACKET; 51 return SEND_PACKET;
54 } 52 }
55 53
56 virtual Action OnReceiveRtcp(const uint8_t* packet, size_t length) { 54 virtual Action OnReceiveRtcp(const uint8_t* packet, size_t length) {
57 return SEND_PACKET; 55 return SEND_PACKET;
58 } 56 }
59 57
60 protected: 58 protected:
61 explicit RtpRtcpObserver(unsigned int event_timeout_ms) 59 explicit RtpRtcpObserver(int event_timeout_ms)
62 : observation_complete_(EventWrapper::Create()), 60 : observation_complete_(false, false),
63 parser_(RtpHeaderParser::Create()), 61 parser_(RtpHeaderParser::Create()),
64 timeout_ms_(event_timeout_ms) { 62 timeout_ms_(event_timeout_ms) {
65 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset, 63 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransmissionTimeOffset,
66 kTOffsetExtensionId); 64 kTOffsetExtensionId);
67 parser_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime, 65 parser_->RegisterRtpHeaderExtension(kRtpExtensionAbsoluteSendTime,
68 kAbsSendTimeExtensionId); 66 kAbsSendTimeExtensionId);
69 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber, 67 parser_->RegisterRtpHeaderExtension(kRtpExtensionTransportSequenceNumber,
70 kTransportSequenceNumberExtensionId); 68 kTransportSequenceNumberExtensionId);
71 } 69 }
72 70
73 const rtc::scoped_ptr<EventWrapper> observation_complete_; 71 rtc::Event observation_complete_;
74 const rtc::scoped_ptr<RtpHeaderParser> parser_; 72 const rtc::scoped_ptr<RtpHeaderParser> parser_;
75 73
76 private: 74 private:
77 unsigned int timeout_ms_; 75 const int timeout_ms_;
78 }; 76 };
79 77
80 class PacketTransport : public test::DirectTransport { 78 class PacketTransport : public test::DirectTransport {
81 public: 79 public:
82 enum TransportType { kReceiver, kSender }; 80 enum TransportType { kReceiver, kSender };
83 81
84 PacketTransport(Call* send_call, 82 PacketTransport(Call* send_call,
85 RtpRtcpObserver* observer, 83 RtpRtcpObserver* observer,
86 TransportType transport_type, 84 TransportType transport_type,
87 const FakeNetworkPipe::Config& configuration) 85 const FakeNetworkPipe::Config& configuration)
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return true; // Will never happen, makes compiler happy. 130 return true; // Will never happen, makes compiler happy.
133 } 131 }
134 132
135 RtpRtcpObserver* const observer_; 133 RtpRtcpObserver* const observer_;
136 TransportType transport_type_; 134 TransportType transport_type_;
137 }; 135 };
138 } // namespace test 136 } // namespace test
139 } // namespace webrtc 137 } // namespace webrtc
140 138
141 #endif // WEBRTC_TEST_RTP_RTCP_OBSERVER_H_ 139 #endif // WEBRTC_TEST_RTP_RTCP_OBSERVER_H_
OLDNEW
« no previous file with comments | « webrtc/test/fake_network_pipe.h ('k') | webrtc/video/end_to_end_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698