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

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

Issue 2716643002: Add framerate to VideoSinkWants and ability to signal on overuse (Closed)
Patch Set: Comments 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
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvideoengine2.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_enabled_(false),
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) {
256 degradation_preference != 257 case DegradationPreference::kMaintainFramerate:
257 webrtc::VideoSendStream::DegradationPreference::kMaintainResolution; 258 resolution_scaling_enabled_ = true;
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 }
258 if (source) 274 if (source)
259 source->AddOrUpdateSink(this, resolution_scaling_enabled_ 275 source->AddOrUpdateSink(this, resolution_scaling_enabled_
260 ? sink_wants_ 276 ? sink_wants_
261 : rtc::VideoSinkWants()); 277 : rtc::VideoSinkWants());
262 } 278 }
263 279
264 void FakeVideoSendStream::InjectVideoSinkWants( 280 void FakeVideoSendStream::InjectVideoSinkWants(
265 const rtc::VideoSinkWants& wants) { 281 const rtc::VideoSinkWants& wants) {
266 sink_wants_ = wants; 282 sink_wants_ = wants;
267 source_->AddOrUpdateSink(this, wants); 283 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. 342 // TODO(brandtr): Implement when the stats have been designed.
327 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const { 343 webrtc::FlexfecReceiveStream::Stats FakeFlexfecReceiveStream::GetStats() const {
328 return webrtc::FlexfecReceiveStream::Stats(); 344 return webrtc::FlexfecReceiveStream::Stats();
329 } 345 }
330 346
331 FakeCall::FakeCall(const webrtc::Call::Config& config) 347 FakeCall::FakeCall(const webrtc::Call::Config& config)
332 : config_(config), 348 : config_(config),
333 audio_network_state_(webrtc::kNetworkUp), 349 audio_network_state_(webrtc::kNetworkUp),
334 video_network_state_(webrtc::kNetworkUp), 350 video_network_state_(webrtc::kNetworkUp),
335 num_created_send_streams_(0), 351 num_created_send_streams_(0),
336 num_created_receive_streams_(0) {} 352 num_created_receive_streams_(0),
353 audio_transport_overhead_(0),
354 video_transport_overhead_(0) {}
337 355
338 FakeCall::~FakeCall() { 356 FakeCall::~FakeCall() {
339 EXPECT_EQ(0u, video_send_streams_.size()); 357 EXPECT_EQ(0u, video_send_streams_.size());
340 EXPECT_EQ(0u, audio_send_streams_.size()); 358 EXPECT_EQ(0u, audio_send_streams_.size());
341 EXPECT_EQ(0u, video_receive_streams_.size()); 359 EXPECT_EQ(0u, video_receive_streams_.size());
342 EXPECT_EQ(0u, audio_receive_streams_.size()); 360 EXPECT_EQ(0u, audio_receive_streams_.size());
343 } 361 }
344 362
345 webrtc::Call::Config FakeCall::GetConfig() const { 363 webrtc::Call::Config FakeCall::GetConfig() const {
346 return config_; 364 return config_;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 } 615 }
598 616
599 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) { 617 void FakeCall::OnSentPacket(const rtc::SentPacket& sent_packet) {
600 last_sent_packet_ = sent_packet; 618 last_sent_packet_ = sent_packet;
601 if (sent_packet.packet_id >= 0) { 619 if (sent_packet.packet_id >= 0) {
602 last_sent_nonnegative_packet_id_ = sent_packet.packet_id; 620 last_sent_nonnegative_packet_id_ = sent_packet.packet_id;
603 } 621 }
604 } 622 }
605 623
606 } // namespace cricket 624 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/media/engine/fakewebrtccall.h ('k') | webrtc/media/engine/webrtcvideoengine2.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698