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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 gain_ = gain; | 101 gain_ = gain; |
102 } | 102 } |
103 | 103 |
104 FakeVideoSendStream::FakeVideoSendStream( | 104 FakeVideoSendStream::FakeVideoSendStream( |
105 webrtc::VideoSendStream::Config config, | 105 webrtc::VideoSendStream::Config config, |
106 webrtc::VideoEncoderConfig encoder_config) | 106 webrtc::VideoEncoderConfig encoder_config) |
107 : sending_(false), | 107 : sending_(false), |
108 config_(std::move(config)), | 108 config_(std::move(config)), |
109 codec_settings_set_(false), | 109 codec_settings_set_(false), |
110 resolution_scaling_enabled_(false), | 110 resolution_scaling_enabled_(false), |
111 framerate_scaling_enabled_(false), | |
112 source_(nullptr), | 111 source_(nullptr), |
113 num_swapped_frames_(0) { | 112 num_swapped_frames_(0) { |
114 RTC_DCHECK(config.encoder_settings.encoder != NULL); | 113 RTC_DCHECK(config.encoder_settings.encoder != NULL); |
115 ReconfigureVideoEncoder(std::move(encoder_config)); | 114 ReconfigureVideoEncoder(std::move(encoder_config)); |
116 } | 115 } |
117 | 116 |
118 FakeVideoSendStream::~FakeVideoSendStream() { | 117 FakeVideoSendStream::~FakeVideoSendStream() { |
119 if (source_) | 118 if (source_) |
120 source_->RemoveSink(this); | 119 source_->RemoveSink(this); |
121 } | 120 } |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 } | 245 } |
247 | 246 |
248 void FakeVideoSendStream::SetSource( | 247 void FakeVideoSendStream::SetSource( |
249 rtc::VideoSourceInterface<webrtc::VideoFrame>* source, | 248 rtc::VideoSourceInterface<webrtc::VideoFrame>* source, |
250 const webrtc::VideoSendStream::DegradationPreference& | 249 const webrtc::VideoSendStream::DegradationPreference& |
251 degradation_preference) { | 250 degradation_preference) { |
252 RTC_DCHECK(source != source_); | 251 RTC_DCHECK(source != source_); |
253 if (source_) | 252 if (source_) |
254 source_->RemoveSink(this); | 253 source_->RemoveSink(this); |
255 source_ = source; | 254 source_ = source; |
256 switch (degradation_preference) { | 255 resolution_scaling_enabled_ = |
257 case DegradationPreference::kMaintainFramerate: | 256 degradation_preference != |
258 resolution_scaling_enabled_ = true; | 257 webrtc::VideoSendStream::DegradationPreference::kMaintainResolution; |
259 framerate_scaling_enabled_ = false; | |
260 break; | |
261 case DegradationPreference::kMaintainResolution: | |
262 resolution_scaling_enabled_ = false; | |
263 framerate_scaling_enabled_ = true; | |
264 break; | |
265 case DegradationPreference::kBalanced: | |
266 resolution_scaling_enabled_ = true; | |
267 framerate_scaling_enabled_ = true; | |
268 break; | |
269 case DegradationPreference::kDegradationDisabled: | |
270 resolution_scaling_enabled_ = false; | |
271 framerate_scaling_enabled_ = false; | |
272 break; | |
273 } | |
274 if (source) | 258 if (source) |
275 source->AddOrUpdateSink(this, resolution_scaling_enabled_ | 259 source->AddOrUpdateSink(this, resolution_scaling_enabled_ |
276 ? sink_wants_ | 260 ? sink_wants_ |
277 : rtc::VideoSinkWants()); | 261 : rtc::VideoSinkWants()); |
278 } | 262 } |
279 | 263 |
280 void FakeVideoSendStream::InjectVideoSinkWants( | 264 void FakeVideoSendStream::InjectVideoSinkWants( |
281 const rtc::VideoSinkWants& wants) { | 265 const rtc::VideoSinkWants& wants) { |
282 sink_wants_ = wants; | 266 sink_wants_ = wants; |
283 source_->AddOrUpdateSink(this, wants); | 267 source_->AddOrUpdateSink(this, wants); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 // TODO(brandtr): Implement when the stats have been designed. | 326 // TODO(brandtr): Implement when the stats have been designed. |
343 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { | 327 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { |
344 return webrtc::FlexfecReceiveStream::Stats(); | 328 return webrtc::FlexfecReceiveStream::Stats(); |
345 } | 329 } |
346 | 330 |
347 FakeCall::FakeCall(const webrtc::Call::Config& config) | 331 FakeCall::FakeCall(const webrtc::Call::Config& config) |
348 : config_(config), | 332 : config_(config), |
349 audio_network_state_(webrtc::kNetworkUp), | 333 audio_network_state_(webrtc::kNetworkUp), |
350 video_network_state_(webrtc::kNetworkUp), | 334 video_network_state_(webrtc::kNetworkUp), |
351 num_created_send_streams_(0), | 335 num_created_send_streams_(0), |
352 num_created_receive_streams_(0), | 336 num_created_receive_streams_(0) {} |
353 audio_transport_overhead_(0), | |
354 video_transport_overhead_(0) {} | |
355 | 337 |
356 FakeCall::~FakeCall() { | 338 FakeCall::~FakeCall() { |
357 EXPECT_EQ(0u, video_send_streams_.size()); | 339 EXPECT_EQ(0u, video_send_streams_.size()); |
358 EXPECT_EQ(0u, audio_send_streams_.size()); | 340 EXPECT_EQ(0u, audio_send_streams_.size()); |
359 EXPECT_EQ(0u, video_receive_streams_.size()); | 341 EXPECT_EQ(0u, video_receive_streams_.size()); |
360 EXPECT_EQ(0u, audio_receive_streams_.size()); | 342 EXPECT_EQ(0u, audio_receive_streams_.size()); |
361 } | 343 } |
362 | 344 |
363 webrtc::Call::Config FakeCall::GetConfig() const { | 345 webrtc::Call::Config FakeCall::GetConfig() const { |
364 return config_; | 346 return config_; |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
615 } | 597 } |
616 | 598 |
617 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { | 599 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { |
618 last_sent_packet_ = sent_packet; | 600 last_sent_packet_ = sent_packet; |
619 if (sent_packet.packet_id >= 0) { | 601 if (sent_packet.packet_id >= 0) { |
620 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; | 602 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; |
621 } | 603 } |
622 } | 604 } |
623 | 605 |
624 } // namespace cricket | 606 } // namespace cricket |
OLD | NEW |