OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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_CALL_TEST_H_ | 10 #ifndef WEBRTC_TEST_CALL_TEST_H_ |
(...skipping 39 matching lines...) Loading... |
50 static const uint8_t kUlpfecPayloadType; | 50 static const uint8_t kUlpfecPayloadType; |
51 static const uint8_t kFlexfecPayloadType; | 51 static const uint8_t kFlexfecPayloadType; |
52 static const uint8_t kAudioSendPayloadType; | 52 static const uint8_t kAudioSendPayloadType; |
53 static const uint32_t kSendRtxSsrcs[kNumSsrcs]; | 53 static const uint32_t kSendRtxSsrcs[kNumSsrcs]; |
54 static const uint32_t kVideoSendSsrcs[kNumSsrcs]; | 54 static const uint32_t kVideoSendSsrcs[kNumSsrcs]; |
55 static const uint32_t kAudioSendSsrc; | 55 static const uint32_t kAudioSendSsrc; |
56 static const uint32_t kFlexfecSendSsrc; | 56 static const uint32_t kFlexfecSendSsrc; |
57 static const uint32_t kReceiverLocalVideoSsrc; | 57 static const uint32_t kReceiverLocalVideoSsrc; |
58 static const uint32_t kReceiverLocalAudioSsrc; | 58 static const uint32_t kReceiverLocalAudioSsrc; |
59 static const int kNackRtpHistoryMs; | 59 static const int kNackRtpHistoryMs; |
| 60 static const std::map<uint8_t, MediaType> payload_type_map_; |
60 | 61 |
61 protected: | 62 protected: |
62 // Needed for tests sending both audio and video on the same | |
63 // FakeNetworkPipe. We then need to set correct MediaType based on | |
64 // packet payload type, before passing the packet on to Call. | |
65 class PayloadDemuxer : public PacketReceiver { | |
66 public: | |
67 PayloadDemuxer() = default; | |
68 | |
69 void SetReceiver(PacketReceiver* receiver); | |
70 DeliveryStatus DeliverPacket(MediaType media_type, | |
71 const uint8_t* packet, | |
72 size_t length, | |
73 const PacketTime& packet_time) override; | |
74 | |
75 private: | |
76 PacketReceiver* receiver_ = nullptr; | |
77 }; | |
78 | |
79 // RunBaseTest overwrites the audio_state and the voice_engine of the send and | 63 // RunBaseTest overwrites the audio_state and the voice_engine of the send and |
80 // receive Call configs to simplify test code and avoid having old VoiceEngine | 64 // receive Call configs to simplify test code and avoid having old VoiceEngine |
81 // APIs in the tests. | 65 // APIs in the tests. |
82 void RunBaseTest(BaseTest* test); | 66 void RunBaseTest(BaseTest* test); |
83 | 67 |
84 void CreateCalls(const Call::Config& sender_config, | 68 void CreateCalls(const Call::Config& sender_config, |
85 const Call::Config& receiver_config); | 69 const Call::Config& receiver_config); |
86 void CreateSenderCall(const Call::Config& config); | 70 void CreateSenderCall(const Call::Config& config); |
87 void CreateReceiverCall(const Call::Config& config); | 71 void CreateReceiverCall(const Call::Config& config); |
88 void DestroyCalls(); | 72 void DestroyCalls(); |
(...skipping 45 matching lines...) Loading... |
134 | 118 |
135 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; | 119 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; |
136 test::FakeEncoder fake_encoder_; | 120 test::FakeEncoder fake_encoder_; |
137 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; | 121 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; |
138 size_t num_video_streams_; | 122 size_t num_video_streams_; |
139 size_t num_audio_streams_; | 123 size_t num_audio_streams_; |
140 size_t num_flexfec_streams_; | 124 size_t num_flexfec_streams_; |
141 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 125 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
142 test::FakeVideoRenderer fake_renderer_; | 126 test::FakeVideoRenderer fake_renderer_; |
143 | 127 |
144 PayloadDemuxer receive_demuxer_; | |
145 PayloadDemuxer send_demuxer_; | |
146 | |
147 private: | 128 private: |
148 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. | 129 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. |
149 // These methods are used to set up legacy voice engines and channels which is | 130 // These methods are used to set up legacy voice engines and channels which is |
150 // necessary while voice engine is being refactored to the new stream API. | 131 // necessary while voice engine is being refactored to the new stream API. |
151 struct VoiceEngineState { | 132 struct VoiceEngineState { |
152 VoiceEngineState() | 133 VoiceEngineState() |
153 : voice_engine(nullptr), | 134 : voice_engine(nullptr), |
154 base(nullptr), | 135 base(nullptr), |
155 channel_id(-1) {} | 136 channel_id(-1) {} |
156 | 137 |
(...skipping 28 matching lines...) Loading... |
185 | 166 |
186 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); | 167 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); |
187 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); | 168 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); |
188 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, | 169 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, |
189 FakeAudioDevice* recv_audio_device); | 170 FakeAudioDevice* recv_audio_device); |
190 | 171 |
191 virtual Call::Config GetSenderCallConfig(); | 172 virtual Call::Config GetSenderCallConfig(); |
192 virtual Call::Config GetReceiverCallConfig(); | 173 virtual Call::Config GetReceiverCallConfig(); |
193 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); | 174 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); |
194 | 175 |
195 // Returns VIDEO for video-only tests, AUDIO for audio-only tests, | |
196 // and ANY for tests sending audio and video over the same | |
197 // transport. | |
198 virtual MediaType SelectMediaType(); | |
199 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); | 176 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); |
200 virtual test::PacketTransport* CreateReceiveTransport(); | 177 virtual test::PacketTransport* CreateReceiveTransport(); |
201 | 178 |
202 virtual void ModifyVideoConfigs( | 179 virtual void ModifyVideoConfigs( |
203 VideoSendStream::Config* send_config, | 180 VideoSendStream::Config* send_config, |
204 std::vector<VideoReceiveStream::Config>* receive_configs, | 181 std::vector<VideoReceiveStream::Config>* receive_configs, |
205 VideoEncoderConfig* encoder_config); | 182 VideoEncoderConfig* encoder_config); |
206 virtual void ModifyVideoCaptureStartResolution(int* width, | 183 virtual void ModifyVideoCaptureStartResolution(int* width, |
207 int* heigt, | 184 int* heigt, |
208 int* frame_rate); | 185 int* frame_rate); |
(...skipping 33 matching lines...) Loading... |
242 EndToEndTest(); | 219 EndToEndTest(); |
243 explicit EndToEndTest(unsigned int timeout_ms); | 220 explicit EndToEndTest(unsigned int timeout_ms); |
244 | 221 |
245 bool ShouldCreateReceivers() const override; | 222 bool ShouldCreateReceivers() const override; |
246 }; | 223 }; |
247 | 224 |
248 } // namespace test | 225 } // namespace test |
249 } // namespace webrtc | 226 } // namespace webrtc |
250 | 227 |
251 #endif // WEBRTC_TEST_CALL_TEST_H_ | 228 #endif // WEBRTC_TEST_CALL_TEST_H_ |
OLD | NEW |