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 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 webrtc::AudioReceiveStream::Config config_; | 93 webrtc::AudioReceiveStream::Config config_; |
94 webrtc::AudioReceiveStream::Stats stats_; | 94 webrtc::AudioReceiveStream::Stats stats_; |
95 int received_packets_ = 0; | 95 int received_packets_ = 0; |
96 std::unique_ptr<webrtc::AudioSinkInterface> sink_; | 96 std::unique_ptr<webrtc::AudioSinkInterface> sink_; |
97 float gain_ = 1.0f; | 97 float gain_ = 1.0f; |
98 rtc::Buffer last_packet_; | 98 rtc::Buffer last_packet_; |
99 bool started_ = false; | 99 bool started_ = false; |
100 }; | 100 }; |
101 | 101 |
102 class FakeVideoSendStream final | 102 class FakeVideoSendStream final : public webrtc::VideoSendStream, |
103 : public webrtc::VideoSendStream, | 103 public webrtc::VideoCaptureInput { |
104 public rtc::VideoSinkInterface<webrtc::VideoFrame> { | |
105 public: | 104 public: |
106 FakeVideoSendStream(webrtc::VideoSendStream::Config config, | 105 FakeVideoSendStream(webrtc::VideoSendStream::Config config, |
107 webrtc::VideoEncoderConfig encoder_config); | 106 webrtc::VideoEncoderConfig encoder_config); |
108 ~FakeVideoSendStream() override; | |
109 const webrtc::VideoSendStream::Config& GetConfig() const; | 107 const webrtc::VideoSendStream::Config& GetConfig() const; |
110 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; | 108 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; |
111 std::vector<webrtc::VideoStream> GetVideoStreams(); | 109 std::vector<webrtc::VideoStream> GetVideoStreams(); |
112 | 110 |
113 bool IsSending() const; | 111 bool IsSending() const; |
114 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; | 112 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; |
115 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; | 113 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; |
116 | 114 |
117 int GetNumberOfSwappedFrames() const; | 115 int GetNumberOfSwappedFrames() const; |
118 int GetLastWidth() const; | 116 int GetLastWidth() const; |
119 int GetLastHeight() const; | 117 int GetLastHeight() const; |
120 int64_t GetLastTimestamp() const; | 118 int64_t GetLastTimestamp() const; |
121 void SetStats(const webrtc::VideoSendStream::Stats& stats); | 119 void SetStats(const webrtc::VideoSendStream::Stats& stats); |
122 int num_encoder_reconfigurations() const { | 120 int num_encoder_reconfigurations() const { |
123 return num_encoder_reconfigurations_; | 121 return num_encoder_reconfigurations_; |
124 } | 122 } |
125 | 123 |
126 private: | 124 private: |
127 // rtc::VideoSinkInterface<VideoFrame> implementation. | 125 void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; |
128 void OnFrame(const webrtc::VideoFrame& frame) override; | |
129 | 126 |
130 // webrtc::VideoSendStream implementation. | 127 // webrtc::VideoSendStream implementation. |
131 void Start() override; | 128 void Start() override; |
132 void Stop() override; | 129 void Stop() override; |
133 void SetSource( | |
134 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) override; | |
135 webrtc::VideoSendStream::Stats GetStats() override; | 130 webrtc::VideoSendStream::Stats GetStats() override; |
136 void ReconfigureVideoEncoder(webrtc::VideoEncoderConfig config) override; | 131 void ReconfigureVideoEncoder(webrtc::VideoEncoderConfig config) override; |
| 132 webrtc::VideoCaptureInput* Input() override; |
137 | 133 |
138 bool sending_; | 134 bool sending_; |
139 webrtc::VideoSendStream::Config config_; | 135 webrtc::VideoSendStream::Config config_; |
140 webrtc::VideoEncoderConfig encoder_config_; | 136 webrtc::VideoEncoderConfig encoder_config_; |
141 bool codec_settings_set_; | 137 bool codec_settings_set_; |
142 union VpxSettings { | 138 union VpxSettings { |
143 webrtc::VideoCodecVP8 vp8; | 139 webrtc::VideoCodecVP8 vp8; |
144 webrtc::VideoCodecVP9 vp9; | 140 webrtc::VideoCodecVP9 vp9; |
145 } vpx_settings_; | 141 } vpx_settings_; |
146 rtc::VideoSourceInterface<webrtc::VideoFrame>* source_; | |
147 int num_swapped_frames_; | 142 int num_swapped_frames_; |
148 webrtc::VideoFrame last_frame_; | 143 webrtc::VideoFrame last_frame_; |
149 webrtc::VideoSendStream::Stats stats_; | 144 webrtc::VideoSendStream::Stats stats_; |
150 int num_encoder_reconfigurations_ = 0; | 145 int num_encoder_reconfigurations_ = 0; |
151 }; | 146 }; |
152 | 147 |
153 class FakeVideoReceiveStream final : public webrtc::VideoReceiveStream { | 148 class FakeVideoReceiveStream final : public webrtc::VideoReceiveStream { |
154 public: | 149 public: |
155 explicit FakeVideoReceiveStream(webrtc::VideoReceiveStream::Config config); | 150 explicit FakeVideoReceiveStream(webrtc::VideoReceiveStream::Config config); |
156 | 151 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 std::vector<FakeAudioSendStream*> audio_send_streams_; | 246 std::vector<FakeAudioSendStream*> audio_send_streams_; |
252 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 247 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
253 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 248 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
254 | 249 |
255 int num_created_send_streams_; | 250 int num_created_send_streams_; |
256 int num_created_receive_streams_; | 251 int num_created_receive_streams_; |
257 }; | 252 }; |
258 | 253 |
259 } // namespace cricket | 254 } // namespace cricket |
260 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 255 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |