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 <memory> | 23 #include <memory> |
| 24 #include <string> |
24 #include <vector> | 25 #include <vector> |
25 | 26 |
26 #include "webrtc/api/call/audio_receive_stream.h" | 27 #include "webrtc/api/call/audio_receive_stream.h" |
27 #include "webrtc/api/call/audio_send_stream.h" | 28 #include "webrtc/api/call/audio_send_stream.h" |
28 #include "webrtc/base/buffer.h" | 29 #include "webrtc/base/buffer.h" |
29 #include "webrtc/call.h" | 30 #include "webrtc/call.h" |
30 #include "webrtc/video_frame.h" | 31 #include "webrtc/video_frame.h" |
31 #include "webrtc/video_receive_stream.h" | 32 #include "webrtc/video_receive_stream.h" |
32 #include "webrtc/video_send_stream.h" | 33 #include "webrtc/video_send_stream.h" |
33 | 34 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 class FakeVideoSendStream final | 103 class FakeVideoSendStream final |
103 : public webrtc::VideoSendStream, | 104 : public webrtc::VideoSendStream, |
104 public rtc::VideoSinkInterface<webrtc::VideoFrame> { | 105 public rtc::VideoSinkInterface<webrtc::VideoFrame> { |
105 public: | 106 public: |
106 FakeVideoSendStream(webrtc::VideoSendStream::Config config, | 107 FakeVideoSendStream(webrtc::VideoSendStream::Config config, |
107 webrtc::VideoEncoderConfig encoder_config); | 108 webrtc::VideoEncoderConfig encoder_config); |
108 ~FakeVideoSendStream() override; | 109 ~FakeVideoSendStream() override; |
109 const webrtc::VideoSendStream::Config& GetConfig() const; | 110 const webrtc::VideoSendStream::Config& GetConfig() const; |
110 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; | 111 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; |
111 std::vector<webrtc::VideoStream> GetVideoStreams(); | 112 const std::vector<webrtc::VideoStream>& GetVideoStreams() const; |
112 | 113 |
113 bool IsSending() const; | 114 bool IsSending() const; |
114 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; | 115 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; |
115 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; | 116 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; |
116 | 117 |
117 int GetNumberOfSwappedFrames() const; | 118 int GetNumberOfSwappedFrames() const; |
118 int GetLastWidth() const; | 119 int GetLastWidth() const; |
119 int GetLastHeight() const; | 120 int GetLastHeight() const; |
120 int64_t GetLastTimestamp() const; | 121 int64_t GetLastTimestamp() const; |
121 void SetStats(const webrtc::VideoSendStream::Stats& stats); | 122 void SetStats(const webrtc::VideoSendStream::Stats& stats); |
122 int num_encoder_reconfigurations() const { | 123 int num_encoder_reconfigurations() const { |
123 return num_encoder_reconfigurations_; | 124 return num_encoder_reconfigurations_; |
124 } | 125 } |
125 | 126 |
126 private: | 127 private: |
127 // rtc::VideoSinkInterface<VideoFrame> implementation. | 128 // rtc::VideoSinkInterface<VideoFrame> implementation. |
128 void OnFrame(const webrtc::VideoFrame& frame) override; | 129 void OnFrame(const webrtc::VideoFrame& frame) override; |
129 | 130 |
130 // webrtc::VideoSendStream implementation. | 131 // webrtc::VideoSendStream implementation. |
131 void Start() override; | 132 void Start() override; |
132 void Stop() override; | 133 void Stop() override; |
133 void SetSource( | 134 void SetSource( |
134 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override; | 135 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override; |
135 webrtc::VideoSendStream::Stats GetStats() override; | 136 webrtc::VideoSendStream::Stats GetStats() override; |
136 void ReconfigureVideoEncoder(webrtc::VideoEncoderConfig config) override; | 137 void ReconfigureVideoEncoder(webrtc::VideoEncoderConfig config) override; |
137 | 138 |
138 bool sending_; | 139 bool sending_; |
139 webrtc::VideoSendStream::Config config_; | 140 webrtc::VideoSendStream::Config config_; |
140 webrtc::VideoEncoderConfig encoder_config_; | 141 webrtc::VideoEncoderConfig encoder_config_; |
| 142 std::vector<webrtc::VideoStream> video_streams_; |
141 bool codec_settings_set_; | 143 bool codec_settings_set_; |
142 union VpxSettings { | 144 union VpxSettings { |
143 webrtc::VideoCodecVP8 vp8; | 145 webrtc::VideoCodecVP8 vp8; |
144 webrtc::VideoCodecVP9 vp9; | 146 webrtc::VideoCodecVP9 vp9; |
145 } vpx_settings_; | 147 } vpx_settings_; |
146 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_; | 148 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_; |
147 int num_swapped_frames_; | 149 int num_swapped_frames_; |
148 webrtc::VideoFrame last_frame_; | 150 webrtc::VideoFrame last_frame_; |
149 webrtc::VideoSendStream::Stats stats_; | 151 webrtc::VideoSendStream::Stats stats_; |
150 int num_encoder_reconfigurations_ = 0; | 152 int num_encoder_reconfigurations_ = 0; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 std::vector<FakeVideoSendStream*> video_send_streams_; | 252 std::vector<FakeVideoSendStream*> video_send_streams_; |
251 std::vector<FakeAudioSendStream*> audio_send_streams_; | 253 std::vector<FakeAudioSendStream*> audio_send_streams_; |
252 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 254 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
253 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 255 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
254 | 256 |
255 int num_created_send_streams_; | 257 int num_created_send_streams_; |
256 int num_created_receive_streams_; | 258 int num_created_receive_streams_; |
257 }; | 259 }; |
258 | 260 |
259 } // namespace cricket | 261 } // namespace cricket |
260 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 262 #endif // WEBRTC_MEDIA_ENGINE_FAKEWEBRTCCALL_H_ |
OLD | NEW |