OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2011 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 12 matching lines...) Expand all Loading... |
23 #include "webrtc/system_wrappers/include/sleep.h" | 23 #include "webrtc/system_wrappers/include/sleep.h" |
24 #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixt
ure.h" | 24 #include "webrtc/voice_engine/test/auto_test/fixtures/before_initialization_fixt
ure.h" |
25 | 25 |
26 class TestErrorObserver; | 26 class TestErrorObserver; |
27 | 27 |
28 class LoopBackTransport : public webrtc::Transport { | 28 class LoopBackTransport : public webrtc::Transport { |
29 public: | 29 public: |
30 LoopBackTransport(webrtc::VoENetwork* voe_network, int channel) | 30 LoopBackTransport(webrtc::VoENetwork* voe_network, int channel) |
31 : crit_(webrtc::CriticalSectionWrapper::CreateCriticalSection()), | 31 : crit_(webrtc::CriticalSectionWrapper::CreateCriticalSection()), |
32 packet_event_(webrtc::EventWrapper::Create()), | 32 packet_event_(webrtc::EventWrapper::Create()), |
33 thread_(webrtc::PlatformThread::CreateThread(NetworkProcess, | 33 thread_(NetworkProcess, this, "LoopBackTransport"), |
34 this, | |
35 "LoopBackTransport")), | |
36 channel_(channel), | 34 channel_(channel), |
37 voe_network_(voe_network), | 35 voe_network_(voe_network), |
38 transmitted_packets_(0) { | 36 transmitted_packets_(0) { |
39 thread_->Start(); | 37 thread_.Start(); |
40 } | 38 } |
41 | 39 |
42 ~LoopBackTransport() { thread_->Stop(); } | 40 ~LoopBackTransport() { thread_.Stop(); } |
43 | 41 |
44 bool SendRtp(const uint8_t* data, | 42 bool SendRtp(const uint8_t* data, |
45 size_t len, | 43 size_t len, |
46 const webrtc::PacketOptions& options) override { | 44 const webrtc::PacketOptions& options) override { |
47 StorePacket(Packet::Rtp, data, len); | 45 StorePacket(Packet::Rtp, data, len); |
48 return true; | 46 return true; |
49 } | 47 } |
50 | 48 |
51 bool SendRtcp(const uint8_t* data, size_t len) override { | 49 bool SendRtcp(const uint8_t* data, size_t len) override { |
52 StorePacket(Packet::Rtcp, data, len); | 50 StorePacket(Packet::Rtcp, data, len); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 voe_network_->ReceivedRTCPPacket(channel, p.data, p.len); | 138 voe_network_->ReceivedRTCPPacket(channel, p.data, p.len); |
141 break; | 139 break; |
142 } | 140 } |
143 ++transmitted_packets_; | 141 ++transmitted_packets_; |
144 } | 142 } |
145 return true; | 143 return true; |
146 } | 144 } |
147 | 145 |
148 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> crit_; | 146 const rtc::scoped_ptr<webrtc::CriticalSectionWrapper> crit_; |
149 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; | 147 const rtc::scoped_ptr<webrtc::EventWrapper> packet_event_; |
150 const rtc::scoped_ptr<webrtc::PlatformThread> thread_; | 148 rtc::PlatformThread thread_; |
151 std::deque<Packet> packet_queue_ GUARDED_BY(crit_.get()); | 149 std::deque<Packet> packet_queue_ GUARDED_BY(crit_.get()); |
152 const int channel_; | 150 const int channel_; |
153 std::map<uint32_t, int> channels_ GUARDED_BY(crit_.get()); | 151 std::map<uint32_t, int> channels_ GUARDED_BY(crit_.get()); |
154 webrtc::VoENetwork* const voe_network_; | 152 webrtc::VoENetwork* const voe_network_; |
155 webrtc::Atomic32 transmitted_packets_; | 153 webrtc::Atomic32 transmitted_packets_; |
156 }; | 154 }; |
157 | 155 |
158 // This fixture initializes the voice engine in addition to the work | 156 // This fixture initializes the voice engine in addition to the work |
159 // done by the before-initialization fixture. It also registers an error | 157 // done by the before-initialization fixture. It also registers an error |
160 // observer which will fail tests on error callbacks. This fixture is | 158 // observer which will fail tests on error callbacks. This fixture is |
161 // useful to tests that want to run before we have started any form of | 159 // useful to tests that want to run before we have started any form of |
162 // streaming through the voice engine. | 160 // streaming through the voice engine. |
163 class AfterInitializationFixture : public BeforeInitializationFixture { | 161 class AfterInitializationFixture : public BeforeInitializationFixture { |
164 public: | 162 public: |
165 AfterInitializationFixture(); | 163 AfterInitializationFixture(); |
166 virtual ~AfterInitializationFixture(); | 164 virtual ~AfterInitializationFixture(); |
167 | 165 |
168 protected: | 166 protected: |
169 rtc::scoped_ptr<TestErrorObserver> error_observer_; | 167 rtc::scoped_ptr<TestErrorObserver> error_observer_; |
170 }; | 168 }; |
171 | 169 |
172 #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_ | 170 #endif // SRC_VOICE_ENGINE_MAIN_TEST_AUTO_TEST_STANDARD_TEST_BASE_AFTER_INIT_H_ |
OLD | NEW |