pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 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 | |
pbos@webrtc.org | bbb07e6 | 2013-08-05 12:01:36 +0000 | [diff] [blame] | 13 | #include <assert.h> |
| 14 | |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 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" |
stefan@webrtc.org | faada6e | 2013-12-18 20:28:25 +0000 | [diff] [blame^] | 21 | #include "webrtc/test/fake_network_pipe.h" |
pbos@webrtc.org | 16e03b7 | 2013-10-28 16:32:01 +0000 | [diff] [blame] | 22 | #include "webrtc/transport.h" |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 23 | |
| 24 | namespace webrtc { |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 25 | |
stefan@webrtc.org | b082ade | 2013-11-18 11:45:11 +0000 | [diff] [blame] | 26 | class Clock; |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 27 | class PacketReceiver; |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 28 | |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 29 | namespace test { |
| 30 | |
| 31 | class DirectTransport : public newapi::Transport { |
| 32 | public: |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 33 | DirectTransport(); |
stefan@webrtc.org | faada6e | 2013-12-18 20:28:25 +0000 | [diff] [blame^] | 34 | explicit DirectTransport(const FakeNetworkPipe::Config& config); |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 35 | ~DirectTransport(); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 36 | |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 37 | virtual void StopSending(); |
pbos@webrtc.org | 74fa489 | 2013-08-23 09:19:30 +0000 | [diff] [blame] | 38 | virtual void SetReceiver(PacketReceiver* receiver); |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 39 | |
pbos@webrtc.org | 27326b6 | 2013-11-20 12:17:04 +0000 | [diff] [blame] | 40 | virtual bool SendRtp(const uint8_t* data, size_t length) OVERRIDE; |
| 41 | virtual bool SendRtcp(const uint8_t* data, size_t length) OVERRIDE; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 42 | |
| 43 | private: |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 44 | static bool NetworkProcess(void* transport); |
| 45 | bool SendPackets(); |
| 46 | |
| 47 | scoped_ptr<CriticalSectionWrapper> lock_; |
| 48 | scoped_ptr<EventWrapper> packet_event_; |
| 49 | scoped_ptr<ThreadWrapper> thread_; |
stefan@webrtc.org | b082ade | 2013-11-18 11:45:11 +0000 | [diff] [blame] | 50 | Clock* clock_; |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 51 | |
pbos@webrtc.org | 468e19a | 2013-08-12 14:28:00 +0000 | [diff] [blame] | 52 | bool shutting_down_; |
| 53 | |
stefan@webrtc.org | faada6e | 2013-12-18 20:28:25 +0000 | [diff] [blame^] | 54 | FakeNetworkPipe fake_network_; |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 55 | }; |
pbos@webrtc.org | 9668467 | 2013-08-12 12:59:04 +0000 | [diff] [blame] | 56 | } // namespace test |
| 57 | } // namespace webrtc |
pbos@webrtc.org | 29d5839 | 2013-05-16 12:08:03 +0000 | [diff] [blame] | 58 | |
| 59 | #endif // WEBRTC_VIDEO_ENGINE_TEST_COMMON_DIRECT_TRANSPORT_H_ |