Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: webrtc/media/engine/fakewebrtccall.cc

Issue 2716643002: Add framerate to VideoSinkWants and ability to signal on overuse (Closed)
Patch Set: windows warning Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_enalbed_(false),
nisse-webrtc 2017/03/14 09:00:28 Spelling.
sprang_webrtc 2017/03/14 14:15:02 Done.
111 source_(nullptr), 112 source_(nullptr),
112 num_swapped_frames_(0) { 113 num_swapped_frames_(0) {
113 RTC_DCHECK(config.encoder_settings.encoder != NULL); 114 RTC_DCHECK(config.encoder_settings.encoder != NULL);
114 ReconfigureVideoEncoder(std::move(encoder_config)); 115 ReconfigureVideoEncoder(std::move(encoder_config));
115 } 116 }
116 117
117 FakeVideoSendStream::~FakeVideoSendStream() { 118 FakeVideoSendStream::~FakeVideoSendStream() {
118 if (source_) 119 if (source_)
119 source_->RemoveSink(this); 120 source_->RemoveSink(this);
120 } 121 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 246 }
246 247
247 void FakeVideoSendStream::SetSource( 248 void FakeVideoSendStream::SetSource(
248 rtc::VideoSourceInterface<webrtc::VideoFrame>* source, 249 rtc::VideoSourceInterface<webrtc::VideoFrame>* source,
249 const webrtc::VideoSendStream::DegradationPreference& 250 const webrtc::VideoSendStream::DegradationPreference&
250 degradation_preference) { 251 degradation_preference) {
251 RTC_DCHECK(source != source_); 252 RTC_DCHECK(source != source_);
252 if (source_) 253 if (source_)
253 source_->RemoveSink(this); 254 source_->RemoveSink(this);
254 source_ = source; 255 source_ = source;
255 resolution_scaling_enabled_ = 256 switch (degradation_preference) {
nisse-webrtc 2017/03/14 09:00:28 This is only ever called once in the object's life
sprang_webrtc 2017/03/14 14:15:02 Right, thanks. I misread this code.
256 degradation_preference != 257 case DegradationPreference::kMaintainFramerate:
257 webrtc::VideoSendStream::DegradationPreference::kMaintainResolution; 258 resolution_scaling_enabled_ = true;
259 break;
260 case DegradationPreference::kMaintainResolution:
261 framerate_scaling_enalbed_ = true;
262 break;
263 case DegradationPreference::kBalanced:
264 resolution_scaling_enabled_ = true;
265 framerate_scaling_enalbed_ = true;
266 break;
267 case DegradationPreference::kDegradationDisabled:
268 // No scaling enabled.
269 break;
270 }
258 if (source) 271 if (source)
259 source->AddOrUpdateSink(this, resolution_scaling_enabled_ 272 source->AddOrUpdateSink(this, resolution_scaling_enabled_
260 ? sink_wants_ 273 ? sink_wants_
261 : rtc::VideoSinkWants()); 274 : rtc::VideoSinkWants());
262 } 275 }
263 276
264 void FakeVideoSendStream::InjectVideoSinkWants( 277 void FakeVideoSendStream::InjectVideoSinkWants(
265 const rtc::VideoSinkWants& wants) { 278 const rtc::VideoSinkWants& wants) {
266 sink_wants_ = wants; 279 sink_wants_ = wants;
267 source_->AddOrUpdateSink(this, wants); 280 source_->AddOrUpdateSink(this, wants);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // TODO(brandtr): Implement when the stats have been designed. 339 // TODO(brandtr): Implement when the stats have been designed.
327 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { 340 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const {
328 return webrtc::FlexfecReceiveStream::Stats(); 341 return webrtc::FlexfecReceiveStream::Stats();
329 } 342 }
330 343
331 FakeCall::FakeCall(const webrtc::Call::Config& config) 344 FakeCall::FakeCall(const webrtc::Call::Config& config)
332 : config_(config), 345 : config_(config),
333 audio_network_state_(webrtc::kNetworkUp), 346 audio_network_state_(webrtc::kNetworkUp),
334 video_network_state_(webrtc::kNetworkUp), 347 video_network_state_(webrtc::kNetworkUp),
335 num_created_send_streams_(0), 348 num_created_send_streams_(0),
336 num_created_receive_streams_(0) {} 349 num_created_receive_streams_(0),
350 audio_transport_overhead_(0),
351 video_transport_overhead_(0) {}
337 352
338 FakeCall::~FakeCall() { 353 FakeCall::~FakeCall() {
339 EXPECT_EQ(0u, video_send_streams_.size()); 354 EXPECT_EQ(0u, video_send_streams_.size());
340 EXPECT_EQ(0u, audio_send_streams_.size()); 355 EXPECT_EQ(0u, audio_send_streams_.size());
341 EXPECT_EQ(0u, video_receive_streams_.size()); 356 EXPECT_EQ(0u, video_receive_streams_.size());
342 EXPECT_EQ(0u, audio_receive_streams_.size()); 357 EXPECT_EQ(0u, audio_receive_streams_.size());
343 } 358 }
344 359
345 webrtc::Call::Config FakeCall::GetConfig() const { 360 webrtc::Call::Config FakeCall::GetConfig() const {
346 return config_; 361 return config_;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 612 }
598 613
599 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 614 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
600 last_sent_packet_ = sent_packet; 615 last_sent_packet_ = sent_packet;
601 if (sent_packet.packet_id >= 0) { 616 if (sent_packet.packet_id >= 0) {
602 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 617 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
603 } 618 }
604 } 619 }
605 620
606 } // namespace cricket 621 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698