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(webrtc::VideoSendStream::Config config, | 105 FakeVideoSendStream(const webrtc::VideoSendStream::Config& config, |
106 webrtc::VideoEncoderConfig encoder_config); | 106 const webrtc::VideoEncoderConfig& encoder_config); |
107 const webrtc::VideoSendStream::Config& GetConfig() const; | 107 webrtc::VideoSendStream::Config GetConfig() const; |
108 const webrtc::VideoEncoderConfig& GetEncoderConfig() const; | 108 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(webrtc::VideoEncoderConfig config) override; | 131 void ReconfigureVideoEncoder( |
| 132 const webrtc::VideoEncoderConfig& config) override; |
132 webrtc::VideoCaptureInput* Input() override; | 133 webrtc::VideoCaptureInput* Input() override; |
133 | 134 |
134 bool sending_; | 135 bool sending_; |
135 webrtc::VideoSendStream::Config config_; | 136 webrtc::VideoSendStream::Config config_; |
136 webrtc::VideoEncoderConfig encoder_config_; | 137 webrtc::VideoEncoderConfig encoder_config_; |
137 bool codec_settings_set_; | 138 bool codec_settings_set_; |
138 union VpxSettings { | 139 union VpxSettings { |
139 webrtc::VideoCodecVP8 vp8; | 140 webrtc::VideoCodecVP8 vp8; |
140 webrtc::VideoCodecVP9 vp9; | 141 webrtc::VideoCodecVP9 vp9; |
141 } vpx_settings_; | 142 } vpx_settings_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 webrtc::AudioSendStream* CreateAudioSendStream( | 201 webrtc::AudioSendStream* CreateAudioSendStream( |
201 const webrtc::AudioSendStream::Config& config) override; | 202 const webrtc::AudioSendStream::Config& config) override; |
202 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; | 203 void DestroyAudioSendStream(webrtc::AudioSendStream* send_stream) override; |
203 | 204 |
204 webrtc::AudioReceiveStream* CreateAudioReceiveStream( | 205 webrtc::AudioReceiveStream* CreateAudioReceiveStream( |
205 const webrtc::AudioReceiveStream::Config& config) override; | 206 const webrtc::AudioReceiveStream::Config& config) override; |
206 void DestroyAudioReceiveStream( | 207 void DestroyAudioReceiveStream( |
207 webrtc::AudioReceiveStream* receive_stream) override; | 208 webrtc::AudioReceiveStream* receive_stream) override; |
208 | 209 |
209 webrtc::VideoSendStream* CreateVideoSendStream( | 210 webrtc::VideoSendStream* CreateVideoSendStream( |
210 webrtc::VideoSendStream::Config config, | 211 const webrtc::VideoSendStream::Config& config, |
211 webrtc::VideoEncoderConfig encoder_config) override; | 212 const webrtc::VideoEncoderConfig& encoder_config) override; |
212 void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override; | 213 void DestroyVideoSendStream(webrtc::VideoSendStream* send_stream) override; |
213 | 214 |
214 webrtc::VideoReceiveStream* CreateVideoReceiveStream( | 215 webrtc::VideoReceiveStream* CreateVideoReceiveStream( |
215 webrtc::VideoReceiveStream::Config config) override; | 216 webrtc::VideoReceiveStream::Config config) override; |
216 void DestroyVideoReceiveStream( | 217 void DestroyVideoReceiveStream( |
217 webrtc::VideoReceiveStream* receive_stream) override; | 218 webrtc::VideoReceiveStream* receive_stream) override; |
218 webrtc::PacketReceiver* Receiver() override; | 219 webrtc::PacketReceiver* Receiver() override; |
219 | 220 |
220 DeliveryStatus DeliverPacket(webrtc::MediaType media_type, | 221 DeliveryStatus DeliverPacket(webrtc::MediaType media_type, |
221 const uint8_t* packet, | 222 const uint8_t* packet, |
(...skipping 24 matching lines...) Expand all Loading... |
246 std::vector<FakeAudioSendStream*> audio_send_streams_; | 247 std::vector<FakeAudioSendStream*> audio_send_streams_; |
247 std::vector<FakeVideoReceiveStream*> video_receive_streams_; | 248 std::vector<FakeVideoReceiveStream*> video_receive_streams_; |
248 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; | 249 std::vector<FakeAudioReceiveStream*> audio_receive_streams_; |
249 | 250 |
250 int num_created_send_streams_; | 251 int num_created_send_streams_; |
251 int num_created_receive_streams_; | 252 int num_created_receive_streams_; |
252 }; | 253 }; |
253 | 254 |
254 } // namespace cricket | 255 } // namespace cricket |
255 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ | 256 #endif // TALK_MEDIA_WEBRTC_WEBRTCVIDEOENGINE2_UNITTEST_H_ |
OLD | NEW |