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_TEST_DIRECT_TRANSPORT_H_ | 10 #ifndef WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
(...skipping 12 matching lines...) Expand all Loading... | |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 | 25 |
26 class Clock; | 26 class Clock; |
27 class PacketReceiver; | 27 class PacketReceiver; |
28 | 28 |
29 namespace test { | 29 namespace test { |
30 | 30 |
31 class DirectTransport : public Transport { | 31 class DirectTransport : public Transport { |
32 public: | 32 public: |
33 DirectTransport(Call* send_call, MediaType media_type); | 33 DirectTransport(Call* send_call, |
34 DirectTransport(const FakeNetworkPipe::Config& config, Call* send_call, | 34 const std::map<uint8_t, MediaType>& payload_type_map); |
35 MediaType media_type); | 35 DirectTransport(const FakeNetworkPipe::Config& config, |
36 Call* send_call, | |
37 const std::map<uint8_t, MediaType>& payload_type_map); | |
38 DirectTransport(const FakeNetworkPipe::Config& config, | |
39 Call* send_call, | |
40 std::unique_ptr<Demuxer> demuxer); | |
41 | |
42 // These deprecated variants always use ForceDemuxer. | |
43 RTC_DEPRECATED DirectTransport(Call* send_call, MediaType media_type) | |
44 : DirectTransport( | |
minyue-webrtc
2017/04/10 21:36:37
android bots do not allow a deprecated ctor calls
| |
45 FakeNetworkPipe::Config(), | |
46 send_call, | |
47 std::unique_ptr<Demuxer>(new ForceDemuxer(media_type))) {} | |
48 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config, | |
49 Call* send_call, | |
50 MediaType media_type) | |
51 : DirectTransport( | |
52 config, | |
53 send_call, | |
54 std::unique_ptr<Demuxer>(new ForceDemuxer(media_type))) {} | |
55 | |
36 // These deprecated variants always use MediaType::VIDEO. | 56 // These deprecated variants always use MediaType::VIDEO. |
37 RTC_DEPRECATED explicit DirectTransport(Call* send_call) | 57 RTC_DEPRECATED explicit DirectTransport(Call* send_call) |
38 : DirectTransport(send_call, MediaType::VIDEO) {} | 58 : DirectTransport( |
59 FakeNetworkPipe::Config(), | |
60 send_call, | |
61 std::unique_ptr<Demuxer>(new ForceDemuxer(MediaType::VIDEO))) {} | |
39 | 62 |
40 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config, | 63 RTC_DEPRECATED DirectTransport(const FakeNetworkPipe::Config& config, |
41 Call* send_call) | 64 Call* send_call) |
42 : DirectTransport(config, send_call, MediaType::VIDEO) {} | 65 : DirectTransport( |
66 config, | |
67 send_call, | |
68 std::unique_ptr<Demuxer>(new ForceDemuxer(MediaType::VIDEO))) {} | |
43 | 69 |
44 ~DirectTransport(); | 70 ~DirectTransport(); |
45 | 71 |
46 void SetConfig(const FakeNetworkPipe::Config& config); | 72 void SetConfig(const FakeNetworkPipe::Config& config); |
47 | 73 |
48 virtual void StopSending(); | 74 virtual void StopSending(); |
49 // TODO(holmer): Look into moving this to the constructor. | 75 // TODO(holmer): Look into moving this to the constructor. |
50 virtual void SetReceiver(PacketReceiver* receiver); | 76 virtual void SetReceiver(PacketReceiver* receiver); |
51 | 77 |
52 bool SendRtp(const uint8_t* data, | 78 bool SendRtp(const uint8_t* data, |
53 size_t length, | 79 size_t length, |
54 const PacketOptions& options) override; | 80 const PacketOptions& options) override; |
55 bool SendRtcp(const uint8_t* data, size_t length) override; | 81 bool SendRtcp(const uint8_t* data, size_t length) override; |
56 | 82 |
57 int GetAverageDelayMs(); | 83 int GetAverageDelayMs(); |
58 | 84 |
59 private: | 85 private: |
86 // TODO(minyue): remove when the deprecated ctors of DirectTransport that | |
87 // create ForceDemuxer are removed. | |
88 class ForceDemuxer : public Demuxer { | |
89 public: | |
90 explicit ForceDemuxer(MediaType media_type); | |
91 void SetReceiver(PacketReceiver* receiver) override; | |
92 void DeliverPacket(const NetworkPacket* packet, | |
93 const PacketTime& packet_time) override; | |
94 | |
95 private: | |
96 const MediaType media_type_; | |
97 PacketReceiver* packet_receiver_; | |
98 RTC_DISALLOW_COPY_AND_ASSIGN(ForceDemuxer); | |
99 }; | |
100 | |
60 static bool NetworkProcess(void* transport); | 101 static bool NetworkProcess(void* transport); |
61 bool SendPackets(); | 102 bool SendPackets(); |
62 | 103 |
63 rtc::CriticalSection lock_; | 104 rtc::CriticalSection lock_; |
64 Call* const send_call_; | 105 Call* const send_call_; |
65 rtc::Event packet_event_; | 106 rtc::Event packet_event_; |
66 rtc::PlatformThread thread_; | 107 rtc::PlatformThread thread_; |
67 Clock* const clock_; | 108 Clock* const clock_; |
68 | 109 |
69 bool shutting_down_; | 110 bool shutting_down_; |
70 | 111 |
71 FakeNetworkPipe fake_network_; | 112 FakeNetworkPipe fake_network_; |
72 }; | 113 }; |
73 } // namespace test | 114 } // namespace test |
74 } // namespace webrtc | 115 } // namespace webrtc |
75 | 116 |
76 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ | 117 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
OLD | NEW |