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