Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 | 60 |
| 61 protected: | 61 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 { | |
|
stefan-webrtc
2017/03/29 12:27:25
It seems like PacketReceiver is the wrong type for
nisse-webrtc
2017/03/29 12:37:55
We can't, since this object is intended to be pass
stefan-webrtc
2017/03/30 06:47:11
Ah, ok. I guess we could if we changed the FakeNet
nisse-webrtc
2017/03/30 06:56:45
For now, I think it makes sense for most tests to
| |
| 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 | |
| 62 // RunBaseTest overwrites the audio_state and the voice_engine of the send and | 79 // RunBaseTest overwrites the audio_state and the voice_engine of the send and |
| 63 // receive Call configs to simplify test code and avoid having old VoiceEngine | 80 // receive Call configs to simplify test code and avoid having old VoiceEngine |
| 64 // APIs in the tests. | 81 // APIs in the tests. |
| 65 void RunBaseTest(BaseTest* test); | 82 void RunBaseTest(BaseTest* test); |
| 66 | 83 |
| 67 void CreateCalls(const Call::Config& sender_config, | 84 void CreateCalls(const Call::Config& sender_config, |
| 68 const Call::Config& receiver_config); | 85 const Call::Config& receiver_config); |
| 69 void CreateSenderCall(const Call::Config& config); | 86 void CreateSenderCall(const Call::Config& config); |
| 70 void CreateReceiverCall(const Call::Config& config); | 87 void CreateReceiverCall(const Call::Config& config); |
| 71 void DestroyCalls(); | 88 void DestroyCalls(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 117 | 134 |
| 118 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; | 135 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; |
| 119 test::FakeEncoder fake_encoder_; | 136 test::FakeEncoder fake_encoder_; |
| 120 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; | 137 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; |
| 121 size_t num_video_streams_; | 138 size_t num_video_streams_; |
| 122 size_t num_audio_streams_; | 139 size_t num_audio_streams_; |
| 123 size_t num_flexfec_streams_; | 140 size_t num_flexfec_streams_; |
| 124 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 141 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 125 test::FakeVideoRenderer fake_renderer_; | 142 test::FakeVideoRenderer fake_renderer_; |
| 126 | 143 |
| 144 PayloadDemuxer receive_demuxer_; | |
| 145 PayloadDemuxer send_demuxer_; | |
| 146 | |
| 127 private: | 147 private: |
| 128 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. | 148 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. |
| 129 // These methods are used to set up legacy voice engines and channels which is | 149 // These methods are used to set up legacy voice engines and channels which is |
| 130 // necessary while voice engine is being refactored to the new stream API. | 150 // necessary while voice engine is being refactored to the new stream API. |
| 131 struct VoiceEngineState { | 151 struct VoiceEngineState { |
| 132 VoiceEngineState() | 152 VoiceEngineState() |
| 133 : voice_engine(nullptr), | 153 : voice_engine(nullptr), |
| 134 base(nullptr), | 154 base(nullptr), |
| 135 channel_id(-1) {} | 155 channel_id(-1) {} |
| 136 | 156 |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 165 | 185 |
| 166 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); | 186 virtual std::unique_ptr<FakeAudioDevice::Capturer> CreateCapturer(); |
| 167 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); | 187 virtual std::unique_ptr<FakeAudioDevice::Renderer> CreateRenderer(); |
| 168 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, | 188 virtual void OnFakeAudioDevicesCreated(FakeAudioDevice* send_audio_device, |
| 169 FakeAudioDevice* recv_audio_device); | 189 FakeAudioDevice* recv_audio_device); |
| 170 | 190 |
| 171 virtual Call::Config GetSenderCallConfig(); | 191 virtual Call::Config GetSenderCallConfig(); |
| 172 virtual Call::Config GetReceiverCallConfig(); | 192 virtual Call::Config GetReceiverCallConfig(); |
| 173 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); | 193 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); |
| 174 | 194 |
| 195 // The default implementation creates MediaType::VIDEO transports. | |
| 175 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); | 196 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); |
| 176 virtual test::PacketTransport* CreateReceiveTransport(); | 197 virtual test::PacketTransport* CreateReceiveTransport(); |
| 177 | 198 |
| 178 virtual void ModifyVideoConfigs( | 199 virtual void ModifyVideoConfigs( |
| 179 VideoSendStream::Config* send_config, | 200 VideoSendStream::Config* send_config, |
| 180 std::vector<VideoReceiveStream::Config>* receive_configs, | 201 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 181 VideoEncoderConfig* encoder_config); | 202 VideoEncoderConfig* encoder_config); |
| 182 virtual void ModifyVideoCaptureStartResolution(int* width, | 203 virtual void ModifyVideoCaptureStartResolution(int* width, |
| 183 int* heigt, | 204 int* heigt, |
| 184 int* frame_rate); | 205 int* frame_rate); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 EndToEndTest(); | 239 EndToEndTest(); |
| 219 explicit EndToEndTest(unsigned int timeout_ms); | 240 explicit EndToEndTest(unsigned int timeout_ms); |
| 220 | 241 |
| 221 bool ShouldCreateReceivers() const override; | 242 bool ShouldCreateReceivers() const override; |
| 222 }; | 243 }; |
| 223 | 244 |
| 224 } // namespace test | 245 } // namespace test |
| 225 } // namespace webrtc | 246 } // namespace webrtc |
| 226 | 247 |
| 227 #endif // WEBRTC_TEST_CALL_TEST_H_ | 248 #endif // WEBRTC_TEST_CALL_TEST_H_ |
| OLD | NEW |