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