1 /* 2 * Copyright (c) 2013 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 #ifndef WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_ 11 #define WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_ 12 13 #include <assert.h> 14 15 #include <deque> 16 17 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 18 #include "webrtc/system_wrappers/interface/event_wrapper.h" 19 #include "webrtc/system_wrappers/interface/scoped_ptr.h" 20 #include "webrtc/system_wrappers/interface/thread_wrapper.h" 21 #include "webrtc/test/fake_network_pipe.h" 22 #include "webrtc/transport.h" 23 24 namespace webrtc { 25 26 class Clock; 27 class PacketReceiver; 28 29 namespace test { 30 31 class DirectTransport : public newapi::Transport { 32 public: 33 DirectTransport(); 34 explicit DirectTransport(const FakeNetworkPipe::Config& config); 35 ~DirectTransport(); 36 37 void SetConfig(const FakeNetworkPipe::Config& config); 38 39 virtual void StopSending(); 40 virtual void SetReceiver(PacketReceiver* receiver); 41 42 virtual bool SendRtp(const uint8_t* data, size_t length) OVERRIDE; 43 virtual bool SendRtcp(const uint8_t* data, size_t length) OVERRIDE; 44 45 private: 46 static bool NetworkProcess(void* transport); 47 bool SendPackets(); 48 49 scoped_ptr<CriticalSectionWrapper> lock_; 50 scoped_ptr<EventWrapper> packet_event_; 51 scoped_ptr<ThreadWrapper> thread_; 52 Clock* const clock_; 53 54 bool shutting_down_; 55 56 FakeNetworkPipe fake_network_; 57 }; 58 } // namespace test 59 } // namespace webrtc 60 61 #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_ 62