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