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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 void FakeAudioReceiveStream::SetGain(float gain) { | 96 void FakeAudioReceiveStream::SetGain(float gain) { |
97 gain_ = gain; | 97 gain_ = gain; |
98 } | 98 } |
99 | 99 |
100 FakeVideoSendStream::FakeVideoSendStream( | 100 FakeVideoSendStream::FakeVideoSendStream( |
101 webrtc::VideoSendStream::Config config, | 101 webrtc::VideoSendStream::Config config, |
102 webrtc::VideoEncoderConfig encoder_config) | 102 webrtc::VideoEncoderConfig encoder_config) |
103 : sending_(false), | 103 : sending_(false), |
104 config_(std::move(config)), | 104 config_(std::move(config)), |
105 codec_settings_set_(false), | 105 codec_settings_set_(false), |
106 source_(nullptr), | |
107 num_swapped_frames_(0) { | 106 num_swapped_frames_(0) { |
108 RTC_DCHECK(config.encoder_settings.encoder != NULL); | 107 RTC_DCHECK(config.encoder_settings.encoder != NULL); |
109 ReconfigureVideoEncoder(std::move(encoder_config)); | 108 ReconfigureVideoEncoder(std::move(encoder_config)); |
110 } | 109 } |
111 | 110 |
112 FakeVideoSendStream::~FakeVideoSendStream() { | |
113 if (source_) | |
114 source_->RemoveSink(this); | |
115 } | |
116 | |
117 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { | 111 const webrtc::VideoSendStream::Config& FakeVideoSendStream::GetConfig() const { |
118 return config_; | 112 return config_; |
119 } | 113 } |
120 | 114 |
121 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() | 115 const webrtc::VideoEncoderConfig& FakeVideoSendStream::GetEncoderConfig() |
122 const { | 116 const { |
123 return encoder_config_; | 117 return encoder_config_; |
124 } | 118 } |
125 | 119 |
126 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { | 120 std::vector<webrtc::VideoStream> FakeVideoSendStream::GetVideoStreams() { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 155 |
162 int FakeVideoSendStream::GetLastHeight() const { | 156 int FakeVideoSendStream::GetLastHeight() const { |
163 return last_frame_.height(); | 157 return last_frame_.height(); |
164 } | 158 } |
165 | 159 |
166 int64_t FakeVideoSendStream::GetLastTimestamp() const { | 160 int64_t FakeVideoSendStream::GetLastTimestamp() const { |
167 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); | 161 RTC_DCHECK(last_frame_.ntp_time_ms() == 0); |
168 return last_frame_.render_time_ms(); | 162 return last_frame_.render_time_ms(); |
169 } | 163 } |
170 | 164 |
171 void FakeVideoSendStream::OnFrame(const webrtc::VideoFrame& frame) { | 165 void FakeVideoSendStream::IncomingCapturedFrame( |
| 166 const webrtc::VideoFrame& frame) { |
172 ++num_swapped_frames_; | 167 ++num_swapped_frames_; |
173 last_frame_.ShallowCopy(frame); | 168 last_frame_.ShallowCopy(frame); |
174 } | 169 } |
175 | 170 |
176 void FakeVideoSendStream::SetStats( | 171 void FakeVideoSendStream::SetStats( |
177 const webrtc::VideoSendStream::Stats& stats) { | 172 const webrtc::VideoSendStream::Stats& stats) { |
178 stats_ = stats; | 173 stats_ = stats; |
179 } | 174 } |
180 | 175 |
181 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { | 176 webrtc::VideoSendStream::Stats FakeVideoSendStream::GetStats() { |
(...skipping 20 matching lines...) Expand all Loading... |
202 } else { | 197 } else { |
203 ADD_FAILURE() << "Unsupported encoder payload: " | 198 ADD_FAILURE() << "Unsupported encoder payload: " |
204 << config_.encoder_settings.payload_name; | 199 << config_.encoder_settings.payload_name; |
205 } | 200 } |
206 } | 201 } |
207 encoder_config_ = std::move(config); | 202 encoder_config_ = std::move(config); |
208 codec_settings_set_ = config.encoder_specific_settings != NULL; | 203 codec_settings_set_ = config.encoder_specific_settings != NULL; |
209 ++num_encoder_reconfigurations_; | 204 ++num_encoder_reconfigurations_; |
210 } | 205 } |
211 | 206 |
| 207 webrtc::VideoCaptureInput* FakeVideoSendStream::Input() { |
| 208 return this; |
| 209 } |
| 210 |
212 void FakeVideoSendStream::Start() { | 211 void FakeVideoSendStream::Start() { |
213 sending_ = true; | 212 sending_ = true; |
214 } | 213 } |
215 | 214 |
216 void FakeVideoSendStream::Stop() { | 215 void FakeVideoSendStream::Stop() { |
217 sending_ = false; | 216 sending_ = false; |
218 } | 217 } |
219 | 218 |
220 void FakeVideoSendStream::SetSource( | |
221 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { | |
222 RTC_DCHECK(source != source_); | |
223 if (source_) | |
224 source_->RemoveSink(this); | |
225 source_ = source; | |
226 if (source) | |
227 source->AddOrUpdateSink(this, rtc::VideoSinkWants()); | |
228 } | |
229 | |
230 FakeVideoReceiveStream::FakeVideoReceiveStream( | 219 FakeVideoReceiveStream::FakeVideoReceiveStream( |
231 webrtc::VideoReceiveStream::Config config) | 220 webrtc::VideoReceiveStream::Config config) |
232 : config_(std::move(config)), receiving_(false) {} | 221 : config_(std::move(config)), receiving_(false) {} |
233 | 222 |
234 const webrtc::VideoReceiveStream::Config& FakeVideoReceiveStream::GetConfig() { | 223 const webrtc::VideoReceiveStream::Config& FakeVideoReceiveStream::GetConfig() { |
235 return config_; | 224 return config_; |
236 } | 225 } |
237 | 226 |
238 bool FakeVideoReceiveStream::IsReceiving() const { | 227 bool FakeVideoReceiveStream::IsReceiving() const { |
239 return receiving_; | 228 return receiving_; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 480 } |
492 | 481 |
493 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, | 482 bool FakeCall::StartEventLog(rtc::PlatformFile log_file, |
494 int64_t max_size_bytes) { | 483 int64_t max_size_bytes) { |
495 return false; | 484 return false; |
496 } | 485 } |
497 | 486 |
498 void FakeCall::StopEventLog() {} | 487 void FakeCall::StopEventLog() {} |
499 | 488 |
500 } // namespace cricket | 489 } // namespace cricket |
OLD | NEW |