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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 : public webrtc::VideoSendStream, | 102 class FakeVideoSendStream final : public webrtc::VideoSendStream, |
103 public webrtc::VideoCaptureInput { | 103 public webrtc::VideoCaptureInput { |
104 public: | 104 public: |
105 FakeVideoSendStream(const webrtc::VideoSendStream::Config& config, | 105 FakeVideoSendStream(webrtc::VideoSendStream::Config config, |
106 const webrtc::VideoEncoderConfig& encoder_config); | 106 webrtc::VideoEncoderConfig encoder_config); |
107 webrtc::VideoSendStream::Config GetConfig() const; | 107 const webrtc::VideoSendStream::Config& GetConfig() const; |
108 webrtc::VideoEncoderConfig GetEncoderConfig() const; | 108 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; |
109 std::vector<webrtc::VideoStream> GetVideoStreams(); | 109 std::vector<webrtc::VideoStream> GetVideoStreams(); |
110 | 110 |
111 bool IsSending() const; | 111 bool IsSending() const; |
112 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; | 112 bool GetVp8Settings(webrtc::VideoCodecVP8* settings) const; |
113 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; | 113 bool GetVp9Settings(webrtc::VideoCodecVP9* settings) const; |
114 | 114 |
115 int GetNumberOfSwappedFrames() const; | 115 int GetNumberOfSwappedFrames() const; |
116 int GetLastWidth() const; | 116 int GetLastWidth() const; |
117 int GetLastHeight() const; | 117 int GetLastHeight() const; |
118 int64_t GetLastTimestamp() const; | 118 int64_t GetLastTimestamp() const; |
119 void SetStats(const webrtc::VideoSendStream::Stats& stats); | 119 void SetStats(const webrtc::VideoSendStream::Stats& stats); |
120 int num_encoder_reconfigurations() const { | 120 int num_encoder_reconfigurations() const { |
121 return num_encoder_reconfigurations_; | 121 return num_encoder_reconfigurations_; |
122 } | 122 } |
123 | 123 |
124 private: | 124 private: |
125 void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; | 125 void IncomingCapturedFrame(const webrtc::VideoFrame& frame) override; |
126 | 126 |
127 // webrtc::VideoSendStream implementation. | 127 // webrtc::VideoSendStream implementation. |
128 void Start() override; | 128 void Start() override; |
129 void Stop() override; | 129 void Stop() override; |
130 webrtc::VideoSendStream::Stats GetStats() override; | 130 webrtc::VideoSendStream::Stats GetStats() override; |
131 void ReconfigureVideoEncoder( | 131 void ReconfigureVideoEncoder(webrtc::VideoEncoderConfig config) override; |
132 const webrtc::VideoEncoderConfig& config) override; | |
133 webrtc::VideoCaptureInput* Input() override; | 132 webrtc::VideoCaptureInput* Input() override; |
134 | 133 |
135 bool sending_; | 134 bool sending_; |
136 webrtc::VideoSendStream::Config config_; | 135 webrtc::VideoSendStream::Config config_; |
137 webrtc::VideoEncoderConfig encoder_config_; | 136 webrtc::VideoEncoderConfig encoder_config_; |
138 bool codec_settings_set_; | 137 bool codec_settings_set_; |
139 union VpxSettings { | 138 union VpxSettings { |
140 webrtc::VideoCodecVP8 vp8; | 139 webrtc::VideoCodecVP8 vp8; |
141 webrtc::VideoCodecVP9 vp9; | 140 webrtc::VideoCodecVP9 vp9; |
142 } vpx_settings_; | 141 } vpx_settings_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 webrtc::AudioSendStream* CreateAudioSendStream( | 200 webrtc::AudioSendStream* CreateAudioSendStream( |
202 const webrtc::AudioSendStream::Config& config) override; | 201 const webrtc::AudioSendStream::Config& config) override; |
203 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; | 202 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; |
204 | 203 |
205 webrtc::AudioReceiveStream* CreateAudioReceiveStream( | 204 webrtc::AudioReceiveStream* CreateAudioReceiveStream( |
206 const webrtc::AudioReceiveStream::Config& config) override; | 205 const webrtc::AudioReceiveStream::Config& config) override; |
207 void DestroyAudioReceiveStream( | 206 void DestroyAudioReceiveStream( |
208 webrtc::AudioReceiveStream* receive_stream) override; | 207 webrtc::AudioReceiveStream* receive_stream) override; |
209 | 208 |
210 webrtc::VideoSendStream* CreateVideoSendStream( | 209 webrtc::VideoSendStream* CreateVideoSendStream( |
211 const webrtc::VideoSendStream::Config& config, | 210 webrtc::VideoSendStream::Config config, |
212 const webrtc::VideoEncoderConfig& encoder_config) override; | 211 webrtc::VideoEncoderConfig encoder_config) override; |
213 void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override; | 212 void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override; |
214 | 213 |
215 webrtc::VideoReceiveStream* CreateVideoReceiveStream( | 214 webrtc::VideoReceiveStream* CreateVideoReceiveStream( |
216 webrtc::VideoReceiveStream::Config config) override; | 215 webrtc::VideoReceiveStream::Config config) override; |
217 void DestroyVideoReceiveStream( | 216 void DestroyVideoReceiveStream( |
218 webrtc::VideoReceiveStream* receive_stream) override; | 217 webrtc::VideoReceiveStream* receive_stream) override; |
219 webrtc::PacketReceiver* Receiver() override; | 218 webrtc::PacketReceiver* Receiver() override; |
220 | 219 |
221 DeliveryStatus DeliverPacket(webrtc::MediaType media_type, | 220 DeliveryStatus DeliverPacket(webrtc::MediaType media_type, |
222 const uint8_t* packet, | 221 const uint8_t* packet, |
(...skipping 24 matching lines...) Expand all Loading... |
247 std::vector<FakeAudioSendStream*> audio_send_streams_; | 246 std::vector<FakeAudioSendStream*> audio_send_streams_; |
248 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 247 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
249 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 248 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
250 | 249 |
251 int num_created_send_streams_; | 250 int num_created_send_streams_; |
252 int num_created_receive_streams_; | 251 int num_created_receive_streams_; |
253 }; | 252 }; |
254 | 253 |
255 } // namespace cricket | 254 } // namespace cricket |
256 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 255 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |