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 14 matching lines...) Expand all Loading... |
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 // Objects of this class are expected to be allocated and destroyed on the | 31 // Objects of this class are expected to be allocated and destroyed on the |
32 // same task-queue - the one that's passed in via the constructor. | 32 // same task-queue - the one that's passed in via the constructor. |
33 class DirectTransport : public Transport { | 33 class DirectTransport : public Transport { |
34 public: | 34 public: |
35 RTC_DEPRECATED DirectTransport( | |
36 Call* send_call, | |
37 const std::map<uint8_t, MediaType>& payload_type_map); | |
38 RTC_DEPRECATED DirectTransport( | |
39 const FakeNetworkPipe::Config& config, | |
40 Call* send_call, | |
41 const std::map<uint8_t, MediaType>& payload_type_map); | |
42 RTC_DEPRECATED DirectTransport( | |
43 const FakeNetworkPipe::Config& config, | |
44 Call* send_call, | |
45 std::unique_ptr<Demuxer> demuxer); | |
46 | |
47 // This deprecated variant always uses MediaType::VIDEO. | |
48 RTC_DEPRECATED explicit DirectTransport(Call* send_call) | |
49 : DirectTransport( | |
50 FakeNetworkPipe::Config(), | |
51 send_call, | |
52 std::unique_ptr<Demuxer>(new ForceDemuxer(MediaType::VIDEO))) {} | |
53 | |
54 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, | 35 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, |
55 Call* send_call, | 36 Call* send_call, |
56 const std::map<uint8_t, MediaType>& payload_type_map); | 37 const std::map<uint8_t, MediaType>& payload_type_map); |
57 | 38 |
58 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, | 39 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, |
59 const FakeNetworkPipe::Config& config, | 40 const FakeNetworkPipe::Config& config, |
60 Call* send_call, | 41 Call* send_call, |
61 const std::map<uint8_t, MediaType>& payload_type_map); | 42 const std::map<uint8_t, MediaType>& payload_type_map); |
62 | 43 |
63 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, | 44 DirectTransport(SingleThreadedTaskQueueForTesting* task_queue, |
(...skipping 11 matching lines...) Expand all Loading... |
75 virtual void SetReceiver(PacketReceiver* receiver); | 56 virtual void SetReceiver(PacketReceiver* receiver); |
76 | 57 |
77 bool SendRtp(const uint8_t* data, | 58 bool SendRtp(const uint8_t* data, |
78 size_t length, | 59 size_t length, |
79 const PacketOptions& options) override; | 60 const PacketOptions& options) override; |
80 bool SendRtcp(const uint8_t* data, size_t length) override; | 61 bool SendRtcp(const uint8_t* data, size_t length) override; |
81 | 62 |
82 int GetAverageDelayMs(); | 63 int GetAverageDelayMs(); |
83 | 64 |
84 private: | 65 private: |
85 // TODO(minyue): remove when the deprecated ctors of DirectTransport that | |
86 // create ForceDemuxer are removed. | |
87 class ForceDemuxer : public Demuxer { | |
88 public: | |
89 explicit ForceDemuxer(MediaType media_type); | |
90 void SetReceiver(PacketReceiver* receiver) override; | |
91 void DeliverPacket(const NetworkPacket* packet, | |
92 const PacketTime& packet_time) override; | |
93 | |
94 private: | |
95 const MediaType media_type_; | |
96 PacketReceiver* packet_receiver_; | |
97 RTC_DISALLOW_COPY_AND_ASSIGN(ForceDemuxer); | |
98 }; | |
99 | |
100 void SendPackets(); | 66 void SendPackets(); |
101 | 67 |
102 Call* const send_call_; | 68 Call* const send_call_; |
103 Clock* const clock_; | 69 Clock* const clock_; |
104 | 70 |
105 // TODO(eladalon): Make |task_queue_| const. | 71 // TODO(eladalon): Make |task_queue_| const. |
106 // https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 | 72 // https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 |
107 SingleThreadedTaskQueueForTesting* task_queue_; | 73 SingleThreadedTaskQueueForTesting* task_queue_; |
108 SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_ | 74 SingleThreadedTaskQueueForTesting::TaskId next_scheduled_task_ |
109 GUARDED_BY(&sequence_checker_); | 75 GUARDED_BY(&sequence_checker_); |
110 | 76 |
111 FakeNetworkPipe fake_network_; | 77 FakeNetworkPipe fake_network_; |
112 | 78 |
113 rtc::SequencedTaskChecker sequence_checker_; | 79 rtc::SequencedTaskChecker sequence_checker_; |
114 | |
115 // TODO(eladalon): https://bugs.chromium.org/p/webrtc/issues/detail?id=8125 | |
116 // Deprecated versions of the ctor don't get the task queue passed in from | |
117 // outside. We'll create one locally for them. This is deprecated, and will | |
118 // be removed as soon as the need for those ctors is removed. | |
119 std::unique_ptr<SingleThreadedTaskQueueForTesting> deprecated_task_queue_; | |
120 }; | 80 }; |
121 } // namespace test | 81 } // namespace test |
122 } // namespace webrtc | 82 } // namespace webrtc |
123 | 83 |
124 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ | 84 #endif // WEBRTC_TEST_DIRECT_TRANSPORT_H_ |
OLD | NEW |