OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 | 10 |
11 // This file contains fake implementations, for use in unit tests, of the | 11 // This file contains fake implementations, for use in unit tests, of the |
12 // following classes: | 12 // following classes: |
13 // | 13 // |
14 // webrtc::Call | 14 // webrtc::Call |
15 // webrtc::AudioSendStream | 15 // webrtc::AudioSendStream |
16 // webrtc::AudioReceiveStream | 16 // webrtc::AudioReceiveStream |
17 // webrtc::VideoSendStream | 17 // webrtc::VideoSendStream |
18 // webrtc::VideoReceiveStream | 18 // webrtc::VideoReceiveStream |
19 | 19 |
20 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ | 20 #ifndef WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ |
21 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ | 21 #define WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ |
22 | 22 |
| 23 #include <list> |
23 #include <memory> | 24 #include <memory> |
24 #include <string> | 25 #include <string> |
25 #include <vector> | 26 #include <vector> |
26 | 27 |
27 #include "webrtc/api/call/audio_receive_stream.h" | 28 #include "webrtc/api/call/audio_receive_stream.h" |
28 #include "webrtc/api/call/audio_send_stream.h" | 29 #include "webrtc/api/call/audio_send_stream.h" |
29 #include "webrtc/base/buffer.h" | 30 #include "webrtc/base/buffer.h" |
30 #include "webrtc/call.h" | 31 #include "webrtc/call.h" |
31 #include "webrtc/video_frame.h" | 32 #include "webrtc/video_frame.h" |
32 #include "webrtc/video_receive_stream.h" | 33 #include "webrtc/video_receive_stream.h" |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 void Start() override; | 190 void Start() override; |
190 void Stop() override; | 191 void Stop() override; |
191 | 192 |
192 webrtc::VideoReceiveStream::Stats GetStats() const override; | 193 webrtc::VideoReceiveStream::Stats GetStats() const override; |
193 | 194 |
194 webrtc::VideoReceiveStream::Config config_; | 195 webrtc::VideoReceiveStream::Config config_; |
195 bool receiving_; | 196 bool receiving_; |
196 webrtc::VideoReceiveStream::Stats stats_; | 197 webrtc::VideoReceiveStream::Stats stats_; |
197 }; | 198 }; |
198 | 199 |
| 200 class FakeFlexfecReceiveStream final : public webrtc::FlexfecReceiveStream { |
| 201 public: |
| 202 explicit FakeFlexfecReceiveStream( |
| 203 const webrtc::FlexfecReceiveStream::Config& config); |
| 204 |
| 205 const webrtc::FlexfecReceiveStream::Config& GetConfig() const; |
| 206 |
| 207 private: |
| 208 // webrtc::FlexfecReceiveStream implementation. |
| 209 void Start() override; |
| 210 void Stop() override; |
| 211 |
| 212 webrtc::FlexfecReceiveStream::Stats GetStats() const override; |
| 213 |
| 214 webrtc::FlexfecReceiveStream::Config config_; |
| 215 bool receiving_; |
| 216 }; |
| 217 |
199 class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { | 218 class FakeCall final : public webrtc::Call, public webrtc::PacketReceiver { |
200 public: | 219 public: |
201 explicit FakeCall(const webrtc::Call::Config& config); | 220 explicit FakeCall(const webrtc::Call::Config& config); |
202 ~FakeCall() override; | 221 ~FakeCall() override; |
203 | 222 |
204 webrtc::Call::Config GetConfig() const; | 223 webrtc::Call::Config GetConfig() const; |
205 const std::vector<FakeVideoSendStream*>& GetVideoSendStreams(); | 224 const std::vector<FakeVideoSendStream*>& GetVideoSendStreams(); |
206 const std::vector<FakeVideoReceiveStream*>& GetVideoReceiveStreams(); | 225 const std::vector<FakeVideoReceiveStream*>& GetVideoReceiveStreams(); |
207 | 226 |
208 const std::vector<FakeAudioSendStream*>& GetAudioSendStreams(); | 227 const std::vector<FakeAudioSendStream*>& GetAudioSendStreams(); |
209 const FakeAudioSendStream* GetAudioSendStream(uint32_t ssrc); | 228 const FakeAudioSendStream* GetAudioSendStream(uint32_t ssrc); |
210 const std::vector<FakeAudioReceiveStream*>& GetAudioReceiveStreams(); | 229 const std::vector<FakeAudioReceiveStream*>& GetAudioReceiveStreams(); |
211 const FakeAudioReceiveStream* GetAudioReceiveStream(uint32_t ssrc); | 230 const FakeAudioReceiveStream* GetAudioReceiveStream(uint32_t ssrc); |
212 | 231 |
| 232 const std::list<FakeFlexfecReceiveStream>& GetFlexfecReceiveStreams(); |
| 233 |
213 rtc::SentPacket last_sent_packet() const { return last_sent_packet_; } | 234 rtc::SentPacket last_sent_packet() const { return last_sent_packet_; } |
214 | 235 |
215 // This is useful if we care about the last media packet (with id populated) | 236 // This is useful if we care about the last media packet (with id populated) |
216 // but not the last ICE packet (with -1 ID). | 237 // but not the last ICE packet (with -1 ID). |
217 int last_sent_nonnegative_packet_id() const { | 238 int last_sent_nonnegative_packet_id() const { |
218 return last_sent_nonnegative_packet_id_; | 239 return last_sent_nonnegative_packet_id_; |
219 } | 240 } |
220 | 241 |
221 webrtc::NetworkState GetNetworkState(webrtc::MediaType media) const; | 242 webrtc::NetworkState GetNetworkState(webrtc::MediaType media) const; |
222 int GetNumCreatedSendStreams() const; | 243 int GetNumCreatedSendStreams() const; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 webrtc::Call::Config config_; | 291 webrtc::Call::Config config_; |
271 webrtc::NetworkState audio_network_state_; | 292 webrtc::NetworkState audio_network_state_; |
272 webrtc::NetworkState video_network_state_; | 293 webrtc::NetworkState video_network_state_; |
273 rtc::SentPacket last_sent_packet_; | 294 rtc::SentPacket last_sent_packet_; |
274 int last_sent_nonnegative_packet_id_ = -1; | 295 int last_sent_nonnegative_packet_id_ = -1; |
275 webrtc::Call::Stats stats_; | 296 webrtc::Call::Stats stats_; |
276 std::vector<FakeVideoSendStream*> video_send_streams_; | 297 std::vector<FakeVideoSendStream*> video_send_streams_; |
277 std::vector<FakeAudioSendStream*> audio_send_streams_; | 298 std::vector<FakeAudioSendStream*> audio_send_streams_; |
278 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 299 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
279 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 300 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
| 301 std::list<FakeFlexfecReceiveStream> flexfec_receive_streams_; |
280 | 302 |
281 int num_created_send_streams_; | 303 int num_created_send_streams_; |
282 int num_created_receive_streams_; | 304 int num_created_receive_streams_; |
283 | 305 |
284 int audio_transport_overhead_; | 306 int audio_transport_overhead_; |
285 int video_transport_overhead_; | 307 int video_transport_overhead_; |
286 }; | 308 }; |
287 | 309 |
288 } // namespace cricket | 310 } // namespace cricket |
289 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ | 311 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ |
OLD | NEW |