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