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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 void FakeAudioReceiveStream::SetGain(float gain) { | 97 void FakeAudioReceiveStream::SetGain(float gain) { |
98 gain_ = gain; | 98 gain_ = gain; |
99 } | 99 } |
100 | 100 |
101 FakeVideoSendStream::FakeVideoSendStream( | 101 FakeVideoSendStream::FakeVideoSendStream( |
102 webrtc::VideoSendStream::Config config, | 102 webrtc::VideoSendStream::Config config, |
103 webrtc::VideoEncoderConfig encoder_config) | 103 webrtc::VideoEncoderConfig encoder_config) |
104 : sending_(false), | 104 : sending_(false), |
105 config_(std::move(config)), | 105 config_(std::move(config)), |
106 codec_settings_set_(false), | 106 codec_settings_set_(false), |
| 107 resolution_scaling_enabled_(false), |
107 source_(nullptr), | 108 source_(nullptr), |
108 num_swapped_frames_(0) { | 109 num_swapped_frames_(0) { |
109 RTC_DCHECK(config.encoder_settings.encoder != NULL); | 110 RTC_DCHECK(config.encoder_settings.encoder != NULL); |
110 ReconfigureVideoEncoder(std::move(encoder_config)); | 111 ReconfigureVideoEncoder(std::move(encoder_config)); |
111 } | 112 } |
112 | 113 |
113 FakeVideoSendStream::~FakeVideoSendStream() { | 114 FakeVideoSendStream::~FakeVideoSendStream() { |
114 if (source_) | 115 if (source_) |
115 source_->RemoveSink(this); | 116 source_->RemoveSink(this); |
116 } | 117 } |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 227 |
227 void FakeVideoSendStream::Start() { | 228 void FakeVideoSendStream::Start() { |
228 sending_ = true; | 229 sending_ = true; |
229 } | 230 } |
230 | 231 |
231 void FakeVideoSendStream::Stop() { | 232 void FakeVideoSendStream::Stop() { |
232 sending_ = false; | 233 sending_ = false; |
233 } | 234 } |
234 | 235 |
235 void FakeVideoSendStream::SetSource( | 236 void FakeVideoSendStream::SetSource( |
236 rtc::VideoSourceInterface<webrtc::VideoFrame>* source) { | 237 rtc::VideoSourceInterface<webrtc::VideoFrame>* source, |
| 238 const webrtc::VideoSendStream::DegradationPreference& |
| 239 degradation_preference) { |
237 RTC_DCHECK(source != source_); | 240 RTC_DCHECK(source != source_); |
238 if (source_) | 241 if (source_) |
239 source_->RemoveSink(this); | 242 source_->RemoveSink(this); |
240 source_ = source; | 243 source_ = source; |
| 244 resolution_scaling_enabled_ = |
| 245 degradation_preference != |
| 246 webrtc::VideoSendStream::DegradationPreference::kMaintainResolution; |
241 if (source) | 247 if (source) |
242 source->AddOrUpdateSink(this, rtc::VideoSinkWants()); | 248 source->AddOrUpdateSink(this, resolution_scaling_enabled_ |
| 249 ? sink_wants_ |
| 250 : rtc::VideoSinkWants()); |
| 251 } |
| 252 |
| 253 void FakeVideoSendStream::InjectVideoSinkWants( |
| 254 const rtc::VideoSinkWants& wants) { |
| 255 sink_wants_ = wants; |
| 256 source_->AddOrUpdateSink(this, wants); |
243 } | 257 } |
244 | 258 |
245 FakeVideoReceiveStream::FakeVideoReceiveStream( | 259 FakeVideoReceiveStream::FakeVideoReceiveStream( |
246 webrtc::VideoReceiveStream::Config config) | 260 webrtc::VideoReceiveStream::Config config) |
247 : config_(std::move(config)), receiving_(false) {} | 261 : config_(std::move(config)), receiving_(false) {} |
248 | 262 |
249 const webrtc::VideoReceiveStream::Config& FakeVideoReceiveStream::GetConfig() { | 263 const webrtc::VideoReceiveStream::Config& FakeVideoReceiveStream::GetConfig() { |
250 return config_; | 264 return config_; |
251 } | 265 } |
252 | 266 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 } | 529 } |
516 | 530 |
517 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 531 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
518 last_sent_packet_ = sent_packet; | 532 last_sent_packet_ = sent_packet; |
519 if (sent_packet.packet_id >= 0) { | 533 if (sent_packet.packet_id >= 0) { |
520 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 534 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
521 } | 535 } |
522 } | 536 } |
523 | 537 |
524 } // namespace cricket | 538 } // namespace cricket |
OLD | NEW |