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

Side by Side Diff: webrtc/media/engine/webrtcvideoengine2.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) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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 20 matching lines...) Expand all
31 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h" 31 #include "webrtc/media/engine/videoencodersoftwarefallbackwrapper.h"
32 #include "webrtc/media/engine/videodecodersoftwarefallbackwrapper.h" 32 #include "webrtc/media/engine/videodecodersoftwarefallbackwrapper.h"
33 #include "webrtc/media/engine/webrtcmediaengine.h" 33 #include "webrtc/media/engine/webrtcmediaengine.h"
34 #include "webrtc/media/engine/webrtcvideoencoderfactory.h" 34 #include "webrtc/media/engine/webrtcvideoencoderfactory.h"
35 #include "webrtc/media/engine/webrtcvoiceengine.h" 35 #include "webrtc/media/engine/webrtcvoiceengine.h"
36 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h" 36 #include "webrtc/modules/video_coding/codecs/vp8/simulcast_encoder_adapter.h"
37 #include "webrtc/system_wrappers/include/field_trial.h" 37 #include "webrtc/system_wrappers/include/field_trial.h"
38 #include "webrtc/video_decoder.h" 38 #include "webrtc/video_decoder.h"
39 #include "webrtc/video_encoder.h" 39 #include "webrtc/video_encoder.h"
40 40
41 using DegradationPreference = webrtc::VideoSendStream::DegradationPreference;
nisse-webrtc 2017/03/14 09:00:29 Perhaps not for this cl, but if DegradationPrefere
sprang_webrtc 2017/03/14 14:15:02 Agreed. I think we need to overhaul a few pieces o
42
41 namespace cricket { 43 namespace cricket {
42 namespace { 44 namespace {
43
44 // If this field trial is enabled, we will enable sending FlexFEC and disable 45 // If this field trial is enabled, we will enable sending FlexFEC and disable
45 // sending ULPFEC whenever the former has been negotiated. Receiving FlexFEC 46 // sending ULPFEC whenever the former has been negotiated. Receiving FlexFEC
46 // is enabled whenever FlexFEC has been negotiated. 47 // is enabled whenever FlexFEC has been negotiated.
47 bool IsFlexfecFieldTrialEnabled() { 48 bool IsFlexfecFieldTrialEnabled() {
48 return webrtc::field_trial::FindFullName("WebRTC-FlexFEC-03") == "Enabled"; 49 return webrtc::field_trial::FindFullName("WebRTC-FlexFEC-03") == "Enabled";
49 } 50 }
50 51
51 // Wrap cricket::WebRtcVideoEncoderFactory as a webrtc::VideoEncoderFactory. 52 // Wrap cricket::WebRtcVideoEncoderFactory as a webrtc::VideoEncoderFactory.
52 class EncoderFactoryAdapter : public webrtc::VideoEncoderFactory { 53 class EncoderFactoryAdapter : public webrtc::VideoEncoderFactory {
53 public: 54 public:
(...skipping 1566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1620 // changes that may require codec reconfiguration. 1621 // changes that may require codec reconfiguration.
1621 old_options.is_screencast = options->is_screencast; 1622 old_options.is_screencast = options->is_screencast;
1622 } 1623 }
1623 if (parameters_.options != old_options) { 1624 if (parameters_.options != old_options) {
1624 ReconfigureEncoder(); 1625 ReconfigureEncoder();
1625 } 1626 }
1626 } 1627 }
1627 1628
1628 if (source_ && stream_) { 1629 if (source_ && stream_) {
1629 stream_->SetSource( 1630 stream_->SetSource(
1630 nullptr, webrtc::VideoSendStream::DegradationPreference::kBalanced); 1631 nullptr,
1632 webrtc::VideoSendStream::DegradationPreference::kDegradationDisabled);
kthelgason 2017/03/14 10:01:20 just DegradationPreference::kDegradationDisabled g
sprang_webrtc 2017/03/14 14:15:02 Done.
1631 } 1633 }
1632 // Switch to the new source. 1634 // Switch to the new source.
1633 source_ = source; 1635 source_ = source;
1634 if (source && stream_) { 1636 if (source && stream_) {
1635 // Do not adapt resolution for screen content as this will likely 1637 // Do not adapt resolution for screen content as this will likely
1636 // result in blurry and unreadable text. 1638 // result in blurry and unreadable text.
1637 // |this| acts like a VideoSource to make sure SinkWants are handled on the 1639 // |this| acts like a VideoSource to make sure SinkWants are handled on the
1638 // correct thread. 1640 // correct thread.
1639 stream_->SetSource( 1641 DegradationPreference degradation_preference;
1640 this, enable_cpu_overuse_detection_ && 1642 if (!enable_cpu_overuse_detection_) {
1641 !parameters_.options.is_screencast.value_or(false) 1643 degradation_preference = DegradationPreference::kDegradationDisabled;
nisse-webrtc 2017/03/14 09:00:29 I wonder if this disable value should be made avai
sprang_webrtc 2017/03/14 14:15:02 |enable_cpu_overuse_detection_| is currently popul
1642 ? webrtc::VideoSendStream::DegradationPreference::kBalanced 1644 } else {
1643 : webrtc::VideoSendStream::DegradationPreference:: 1645 if (parameters_.options.is_screencast.value_or(false)) {
1644 kMaintainResolution); 1646 degradation_preference = DegradationPreference::kMaintainResolution;
1647 } else {
1648 degradation_preference = DegradationPreference::kMaintainFramerate;
1649 }
1650 }
1651 stream_->SetSource(this, degradation_preference);
1645 } 1652 }
1646 return true; 1653 return true;
1647 } 1654 }
1648 1655
1649 const std::vector<uint32_t>& 1656 const std::vector<uint32_t>&
1650 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const { 1657 WebRtcVideoChannel2::WebRtcVideoSendStream::GetSsrcs() const {
1651 return ssrcs_; 1658 return ssrcs_;
1652 } 1659 }
1653 1660
1654 WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder 1661 WebRtcVideoChannel2::WebRtcVideoSendStream::AllocatedEncoder
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2081 parameters_.encoder_config.Copy()); 2088 parameters_.encoder_config.Copy());
2082 2089
2083 parameters_.encoder_config.encoder_specific_settings = NULL; 2090 parameters_.encoder_config.encoder_specific_settings = NULL;
2084 2091
2085 if (source_) { 2092 if (source_) {
2086 // Do not adapt resolution for screen content as this will likely result in 2093 // Do not adapt resolution for screen content as this will likely result in
2087 // blurry and unreadable text. 2094 // blurry and unreadable text.
2088 // |this| acts like a VideoSource to make sure SinkWants are handled on the 2095 // |this| acts like a VideoSource to make sure SinkWants are handled on the
2089 // correct thread. 2096 // correct thread.
2090 stream_->SetSource( 2097 stream_->SetSource(
2091 this, enable_cpu_overuse_detection_ && 2098 this,
2092 !parameters_.options.is_screencast.value_or(false) 2099 enable_cpu_overuse_detection_ &&
2093 ? webrtc::VideoSendStream::DegradationPreference::kBalanced 2100 !parameters_.options.is_screencast.value_or(false)
2094 : webrtc::VideoSendStream::DegradationPreference:: 2101 ? webrtc::VideoSendStream::DegradationPreference::kMaintainFramerate
nisse-webrtc 2017/03/14 09:00:29 Why is this logic different from logic in SetVideo
sprang_webrtc 2017/03/14 14:15:02 Done.
2095 kMaintainResolution); 2102 : webrtc::VideoSendStream::DegradationPreference::
2103 kMaintainResolution);
2096 } 2104 }
2097 2105
2098 // Call stream_->Start() if necessary conditions are met. 2106 // Call stream_->Start() if necessary conditions are met.
2099 UpdateSendState(); 2107 UpdateSendState();
2100 } 2108 }
2101 2109
2102 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream( 2110 WebRtcVideoChannel2::WebRtcVideoReceiveStream::WebRtcVideoReceiveStream(
2103 webrtc::Call* call, 2111 webrtc::Call* call,
2104 const StreamParams& sp, 2112 const StreamParams& sp,
2105 webrtc::VideoReceiveStream::Config config, 2113 webrtc::VideoReceiveStream::Config config,
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
2542 rtx_mapping[video_codecs[i].codec.id] != 2550 rtx_mapping[video_codecs[i].codec.id] !=
2543 ulpfec_config.red_payload_type) { 2551 ulpfec_config.red_payload_type) {
2544 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id]; 2552 video_codecs[i].rtx_payload_type = rtx_mapping[video_codecs[i].codec.id];
2545 } 2553 }
2546 } 2554 }
2547 2555
2548 return video_codecs; 2556 return video_codecs;
2549 } 2557 }
2550 2558
2551 } // namespace cricket 2559 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698