| 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 30 matching lines...) Expand all Loading... |
| 41 static const int kDefaultHeight = 180; | 41 static const int kDefaultHeight = 180; |
| 42 static const int kDefaultFramerate = 30; | 42 static const int kDefaultFramerate = 30; |
| 43 static const int kDefaultTimeoutMs; | 43 static const int kDefaultTimeoutMs; |
| 44 static const int kLongTimeoutMs; | 44 static const int kLongTimeoutMs; |
| 45 static const uint8_t kVideoSendPayloadType; | 45 static const uint8_t kVideoSendPayloadType; |
| 46 static const uint8_t kSendRtxPayloadType; | 46 static const uint8_t kSendRtxPayloadType; |
| 47 static const uint8_t kFakeVideoSendPayloadType; | 47 static const uint8_t kFakeVideoSendPayloadType; |
| 48 static const uint8_t kRedPayloadType; | 48 static const uint8_t kRedPayloadType; |
| 49 static const uint8_t kRtxRedPayloadType; | 49 static const uint8_t kRtxRedPayloadType; |
| 50 static const uint8_t kUlpfecPayloadType; | 50 static const uint8_t kUlpfecPayloadType; |
| 51 static const uint8_t kFlexfecPayloadType; |
| 51 static const uint8_t kAudioSendPayloadType; | 52 static const uint8_t kAudioSendPayloadType; |
| 52 static const uint32_t kSendRtxSsrcs[kNumSsrcs]; | 53 static const uint32_t kSendRtxSsrcs[kNumSsrcs]; |
| 53 static const uint32_t kVideoSendSsrcs[kNumSsrcs]; | 54 static const uint32_t kVideoSendSsrcs[kNumSsrcs]; |
| 54 static const uint32_t kAudioSendSsrc; | 55 static const uint32_t kAudioSendSsrc; |
| 56 static const uint32_t kFlexfecSendSsrc; |
| 55 static const uint32_t kReceiverLocalVideoSsrc; | 57 static const uint32_t kReceiverLocalVideoSsrc; |
| 56 static const uint32_t kReceiverLocalAudioSsrc; | 58 static const uint32_t kReceiverLocalAudioSsrc; |
| 59 static const uint32_t kReceiverLocalFlexfecSsrc; |
| 57 static const int kNackRtpHistoryMs; | 60 static const int kNackRtpHistoryMs; |
| 58 | 61 |
| 59 protected: | 62 protected: |
| 60 // 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 |
| 61 // 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 |
| 62 // APIs in the tests. | 65 // APIs in the tests. |
| 63 void RunBaseTest(BaseTest* test); | 66 void RunBaseTest(BaseTest* test); |
| 64 | 67 |
| 65 void CreateCalls(const Call::Config& sender_config, | 68 void CreateCalls(const Call::Config& sender_config, |
| 66 const Call::Config& receiver_config); | 69 const Call::Config& receiver_config); |
| 67 void CreateSenderCall(const Call::Config& config); | 70 void CreateSenderCall(const Call::Config& config); |
| 68 void CreateReceiverCall(const Call::Config& config); | 71 void CreateReceiverCall(const Call::Config& config); |
| 69 void DestroyCalls(); | 72 void DestroyCalls(); |
| 70 | 73 |
| 71 void CreateSendConfig(size_t num_video_streams, | 74 void CreateSendConfig(size_t num_video_streams, |
| 72 size_t num_audio_streams, | 75 size_t num_audio_streams, |
| 76 size_t num_flexfec_streams, |
| 73 Transport* send_transport); | 77 Transport* send_transport); |
| 74 void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport); | 78 void CreateMatchingReceiveConfigs(Transport* rtcp_send_transport); |
| 75 | 79 |
| 76 void CreateFrameGeneratorCapturerWithDrift(Clock* drift_clock, | 80 void CreateFrameGeneratorCapturerWithDrift(Clock* drift_clock, |
| 77 float speed, | 81 float speed, |
| 78 int framerate, | 82 int framerate, |
| 79 int width, | 83 int width, |
| 80 int height); | 84 int height); |
| 81 void CreateFrameGeneratorCapturer(int framerate, int width, int height); | 85 void CreateFrameGeneratorCapturer(int framerate, int width, int height); |
| 82 void CreateFakeAudioDevices(); | 86 void CreateFakeAudioDevices(); |
| 83 | 87 |
| 84 void CreateVideoStreams(); | 88 void CreateVideoStreams(); |
| 85 void CreateAudioStreams(); | 89 void CreateAudioStreams(); |
| 90 void CreateFlexfecStreams(); |
| 86 void Start(); | 91 void Start(); |
| 87 void Stop(); | 92 void Stop(); |
| 88 void DestroyStreams(); | 93 void DestroyStreams(); |
| 89 void SetFakeVideoCaptureRotation(VideoRotation rotation); | 94 void SetFakeVideoCaptureRotation(VideoRotation rotation); |
| 90 | 95 |
| 91 Clock* const clock_; | 96 Clock* const clock_; |
| 92 | 97 |
| 93 webrtc::RtcEventLogNullImpl event_log_; | 98 webrtc::RtcEventLogNullImpl event_log_; |
| 94 std::unique_ptr<Call> sender_call_; | 99 std::unique_ptr<Call> sender_call_; |
| 95 std::unique_ptr<PacketTransport> send_transport_; | 100 std::unique_ptr<PacketTransport> send_transport_; |
| 96 VideoSendStream::Config video_send_config_; | 101 VideoSendStream::Config video_send_config_; |
| 97 VideoEncoderConfig video_encoder_config_; | 102 VideoEncoderConfig video_encoder_config_; |
| 98 VideoSendStream* video_send_stream_; | 103 VideoSendStream* video_send_stream_; |
| 99 AudioSendStream::Config audio_send_config_; | 104 AudioSendStream::Config audio_send_config_; |
| 100 AudioSendStream* audio_send_stream_; | 105 AudioSendStream* audio_send_stream_; |
| 101 | 106 |
| 102 std::unique_ptr<Call> receiver_call_; | 107 std::unique_ptr<Call> receiver_call_; |
| 103 std::unique_ptr<PacketTransport> receive_transport_; | 108 std::unique_ptr<PacketTransport> receive_transport_; |
| 104 std::vector<VideoReceiveStream::Config> video_receive_configs_; | 109 std::vector<VideoReceiveStream::Config> video_receive_configs_; |
| 105 std::vector<VideoReceiveStream*> video_receive_streams_; | 110 std::vector<VideoReceiveStream*> video_receive_streams_; |
| 106 std::vector<AudioReceiveStream::Config> audio_receive_configs_; | 111 std::vector<AudioReceiveStream::Config> audio_receive_configs_; |
| 107 std::vector<AudioReceiveStream*> audio_receive_streams_; | 112 std::vector<AudioReceiveStream*> audio_receive_streams_; |
| 113 std::vector<FlexfecReceiveStream::Config> flexfec_receive_configs_; |
| 114 std::vector<FlexfecReceiveStream*> flexfec_receive_streams_; |
| 108 | 115 |
| 109 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; | 116 std::unique_ptr<test::FrameGeneratorCapturer> frame_generator_capturer_; |
| 110 test::FakeEncoder fake_encoder_; | 117 test::FakeEncoder fake_encoder_; |
| 111 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; | 118 std::vector<std::unique_ptr<VideoDecoder>> allocated_decoders_; |
| 112 size_t num_video_streams_; | 119 size_t num_video_streams_; |
| 113 size_t num_audio_streams_; | 120 size_t num_audio_streams_; |
| 121 size_t num_flexfec_streams_; |
| 114 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; | 122 rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_; |
| 115 test::FakeVideoRenderer fake_renderer_; | 123 test::FakeVideoRenderer fake_renderer_; |
| 116 | 124 |
| 117 private: | 125 private: |
| 118 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. | 126 // TODO(holmer): Remove once VoiceEngine is fully refactored to the new API. |
| 119 // These methods are used to set up legacy voice engines and channels which is | 127 // These methods are used to set up legacy voice engines and channels which is |
| 120 // necessary while voice engine is being refactored to the new stream API. | 128 // necessary while voice engine is being refactored to the new stream API. |
| 121 struct VoiceEngineState { | 129 struct VoiceEngineState { |
| 122 VoiceEngineState() | 130 VoiceEngineState() |
| 123 : voice_engine(nullptr), | 131 : voice_engine(nullptr), |
| (...skipping 19 matching lines...) Expand all Loading... |
| 143 class BaseTest : public RtpRtcpObserver { | 151 class BaseTest : public RtpRtcpObserver { |
| 144 public: | 152 public: |
| 145 explicit BaseTest(unsigned int timeout_ms); | 153 explicit BaseTest(unsigned int timeout_ms); |
| 146 virtual ~BaseTest(); | 154 virtual ~BaseTest(); |
| 147 | 155 |
| 148 virtual void PerformTest() = 0; | 156 virtual void PerformTest() = 0; |
| 149 virtual bool ShouldCreateReceivers() const = 0; | 157 virtual bool ShouldCreateReceivers() const = 0; |
| 150 | 158 |
| 151 virtual size_t GetNumVideoStreams() const; | 159 virtual size_t GetNumVideoStreams() const; |
| 152 virtual size_t GetNumAudioStreams() const; | 160 virtual size_t GetNumAudioStreams() const; |
| 161 virtual size_t GetNumFlexfecStreams() const; |
| 153 | 162 |
| 154 virtual Call::Config GetSenderCallConfig(); | 163 virtual Call::Config GetSenderCallConfig(); |
| 155 virtual Call::Config GetReceiverCallConfig(); | 164 virtual Call::Config GetReceiverCallConfig(); |
| 156 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); | 165 virtual void OnCallsCreated(Call* sender_call, Call* receiver_call); |
| 157 | 166 |
| 158 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); | 167 virtual test::PacketTransport* CreateSendTransport(Call* sender_call); |
| 159 virtual test::PacketTransport* CreateReceiveTransport(); | 168 virtual test::PacketTransport* CreateReceiveTransport(); |
| 160 | 169 |
| 161 virtual void ModifyVideoConfigs( | 170 virtual void ModifyVideoConfigs( |
| 162 VideoSendStream::Config* send_config, | 171 VideoSendStream::Config* send_config, |
| 163 std::vector<VideoReceiveStream::Config>* receive_configs, | 172 std::vector<VideoReceiveStream::Config>* receive_configs, |
| 164 VideoEncoderConfig* encoder_config); | 173 VideoEncoderConfig* encoder_config); |
| 165 virtual void ModifyVideoCaptureStartResolution(int* width, | 174 virtual void ModifyVideoCaptureStartResolution(int* width, |
| 166 int* heigt, | 175 int* heigt, |
| 167 int* frame_rate); | 176 int* frame_rate); |
| 168 virtual void OnVideoStreamsCreated( | 177 virtual void OnVideoStreamsCreated( |
| 169 VideoSendStream* send_stream, | 178 VideoSendStream* send_stream, |
| 170 const std::vector<VideoReceiveStream*>& receive_streams); | 179 const std::vector<VideoReceiveStream*>& receive_streams); |
| 171 | 180 |
| 172 virtual void ModifyAudioConfigs( | 181 virtual void ModifyAudioConfigs( |
| 173 AudioSendStream::Config* send_config, | 182 AudioSendStream::Config* send_config, |
| 174 std::vector<AudioReceiveStream::Config>* receive_configs); | 183 std::vector<AudioReceiveStream::Config>* receive_configs); |
| 175 virtual void OnAudioStreamsCreated( | 184 virtual void OnAudioStreamsCreated( |
| 176 AudioSendStream* send_stream, | 185 AudioSendStream* send_stream, |
| 177 const std::vector<AudioReceiveStream*>& receive_streams); | 186 const std::vector<AudioReceiveStream*>& receive_streams); |
| 178 | 187 |
| 188 virtual void ModifyFlexfecConfigs( |
| 189 std::vector<FlexfecReceiveStream::Config>* receive_configs); |
| 190 virtual void OnFlexfecStreamsCreated( |
| 191 const std::vector<FlexfecReceiveStream*>& receive_streams); |
| 192 |
| 179 virtual void OnFrameGeneratorCapturerCreated( | 193 virtual void OnFrameGeneratorCapturerCreated( |
| 180 FrameGeneratorCapturer* frame_generator_capturer); | 194 FrameGeneratorCapturer* frame_generator_capturer); |
| 181 | 195 |
| 182 webrtc::RtcEventLogNullImpl event_log_; | 196 webrtc::RtcEventLogNullImpl event_log_; |
| 183 }; | 197 }; |
| 184 | 198 |
| 185 class SendTest : public BaseTest { | 199 class SendTest : public BaseTest { |
| 186 public: | 200 public: |
| 187 explicit SendTest(unsigned int timeout_ms); | 201 explicit SendTest(unsigned int timeout_ms); |
| 188 | 202 |
| 189 bool ShouldCreateReceivers() const override; | 203 bool ShouldCreateReceivers() const override; |
| 190 }; | 204 }; |
| 191 | 205 |
| 192 class EndToEndTest : public BaseTest { | 206 class EndToEndTest : public BaseTest { |
| 193 public: | 207 public: |
| 194 explicit EndToEndTest(unsigned int timeout_ms); | 208 explicit EndToEndTest(unsigned int timeout_ms); |
| 195 | 209 |
| 196 bool ShouldCreateReceivers() const override; | 210 bool ShouldCreateReceivers() const override; |
| 197 }; | 211 }; |
| 198 | 212 |
| 199 } // namespace test | 213 } // namespace test |
| 200 } // namespace webrtc | 214 } // namespace webrtc |
| 201 | 215 |
| 202 #endif // WEBRTC_TEST_CALL_TEST_H_ | 216 #endif // WEBRTC_TEST_CALL_TEST_H_ |
| OLD | NEW |