OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 |
11 #include "webrtc/common_types.h" | 11 #include "webrtc/common_types.h" |
12 | 12 |
13 #include <algorithm> // std::max | 13 #include <algorithm> // std::max |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" | 16 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h" |
17 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" | 17 #include "webrtc/modules/video_coding/codecs/interface/video_codec_interface.h" |
18 #include "webrtc/modules/video_coding/main/source/encoded_frame.h" | 18 #include "webrtc/modules/video_coding/main/source/encoded_frame.h" |
19 #include "webrtc/modules/video_coding/main/source/video_coding_impl.h" | 19 #include "webrtc/modules/video_coding/main/source/video_coding_impl.h" |
20 #include "webrtc/modules/video_coding/utility/include/quality_scaler.h" | 20 #include "webrtc/modules/video_coding/utility/include/quality_scaler.h" |
21 #include "webrtc/system_wrappers/interface/clock.h" | 21 #include "webrtc/system_wrappers/interface/clock.h" |
22 #include "webrtc/system_wrappers/interface/field_trial.h" | |
22 #include "webrtc/system_wrappers/interface/logging.h" | 23 #include "webrtc/system_wrappers/interface/logging.h" |
23 | 24 |
24 namespace webrtc { | 25 namespace webrtc { |
25 namespace vcm { | 26 namespace vcm { |
26 | 27 |
27 VideoSender::VideoSender(Clock* clock, | 28 VideoSender::VideoSender(Clock* clock, |
28 EncodedImageCallback* post_encode_callback, | 29 EncodedImageCallback* post_encode_callback, |
29 VideoEncoderRateObserver* encoder_rate_observer, | 30 VideoEncoderRateObserver* encoder_rate_observer, |
30 VCMQMSettingsCallback* qm_settings_callback) | 31 VCMQMSettingsCallback* qm_settings_callback) |
31 : clock_(clock), | 32 : clock_(clock), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 // Cache the current codec here so they can be fetched from this thread | 100 // Cache the current codec here so they can be fetched from this thread |
100 // without requiring the _sendCritSect lock. | 101 // without requiring the _sendCritSect lock. |
101 current_codec_ = *sendCodec; | 102 current_codec_ = *sendCodec; |
102 | 103 |
103 if (!ret) { | 104 if (!ret) { |
104 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '" | 105 LOG(LS_ERROR) << "Failed to initialize set encoder with payload name '" |
105 << sendCodec->plName << "'."; | 106 << sendCodec->plName << "'."; |
106 return VCM_CODEC_ERROR; | 107 return VCM_CODEC_ERROR; |
107 } | 108 } |
108 | 109 |
109 int numLayers = (sendCodec->codecType != kVideoCodecVP8) | 110 int numLayers; |
110 ? 1 | 111 if (sendCodec->codecType == kVideoCodecVP8) { |
111 : sendCodec->codecSpecific.VP8.numberOfTemporalLayers; | 112 numLayers = sendCodec->codecSpecific.VP8.numberOfTemporalLayers; |
113 } else if (sendCodec->codecType == kVideoCodecVP9) { | |
114 numLayers = sendCodec->codecSpecific.VP9.numberOfTemporalLayers; | |
115 } else { | |
116 numLayers = 1; | |
117 } | |
118 | |
112 // If we have screensharing and we have layers, we disable frame dropper. | 119 // If we have screensharing and we have layers, we disable frame dropper. |
113 bool disable_frame_dropper = | 120 bool disable_frame_dropper = |
114 numLayers > 1 && sendCodec->mode == kScreensharing; | 121 (numLayers > 1 && sendCodec->mode == kScreensharing) || |
122 (field_trial::FindFullName("WebRTC-DisableGenericBitrateFrameDropper") | |
pbos-webrtc
2015/10/07 11:27:55
Can we call this WebRTC-Test- or so? I'd like to d
ivica
2015/10/07 11:32:52
Now when it's so simple, I'm not sure if it's nece
| |
123 == "Enabled"); | |
115 if (disable_frame_dropper) { | 124 if (disable_frame_dropper) { |
116 _mediaOpt.EnableFrameDropper(false); | 125 _mediaOpt.EnableFrameDropper(false); |
117 } else if (frame_dropper_enabled_) { | 126 } else if (frame_dropper_enabled_) { |
118 _mediaOpt.EnableFrameDropper(true); | 127 _mediaOpt.EnableFrameDropper(true); |
119 } | 128 } |
120 _nextFrameTypes.clear(); | 129 _nextFrameTypes.clear(); |
121 _nextFrameTypes.resize(VCM_MAX(sendCodec->numberOfSimulcastStreams, 1), | 130 _nextFrameTypes.resize(VCM_MAX(sendCodec->numberOfSimulcastStreams, 1), |
122 kVideoFrameDelta); | 131 kVideoFrameDelta); |
123 | 132 |
124 _mediaOpt.SetEncodingData(sendCodec->codecType, | 133 _mediaOpt.SetEncodingData(sendCodec->codecType, |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
381 int window_bps = std::max(threshold_bps / 10, 10000); | 390 int window_bps = std::max(threshold_bps / 10, 10000); |
382 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); | 391 _mediaOpt.SuspendBelowMinBitrate(threshold_bps, window_bps); |
383 } | 392 } |
384 | 393 |
385 bool VideoSender::VideoSuspended() const { | 394 bool VideoSender::VideoSuspended() const { |
386 rtc::CritScope lock(&send_crit_); | 395 rtc::CritScope lock(&send_crit_); |
387 return _mediaOpt.IsVideoSuspended(); | 396 return _mediaOpt.IsVideoSuspended(); |
388 } | 397 } |
389 } // namespace vcm | 398 } // namespace vcm |
390 } // namespace webrtc | 399 } // namespace webrtc |
OLD | NEW |