OLD | NEW |
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 21 matching lines...) Expand all Loading... |
32 static const int kMeasureMs = 2000; | 32 static const int kMeasureMs = 2000; |
33 static const float kSamplePeriodScaleFactor = 2.5; | 33 static const float kSamplePeriodScaleFactor = 2.5; |
34 static const int kFramedropPercentThreshold = 60; | 34 static const int kFramedropPercentThreshold = 60; |
35 // QP scaling threshold defaults: | 35 // QP scaling threshold defaults: |
36 static const int kLowH264QpThreshold = 24; | 36 static const int kLowH264QpThreshold = 24; |
37 static const int kHighH264QpThreshold = 37; | 37 static const int kHighH264QpThreshold = 37; |
38 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the | 38 // QP is obtained from VP8-bitstream for HW, so the QP corresponds to the |
39 // bitstream range of [0, 127] and not the user-level range of [0,63]. | 39 // bitstream range of [0, 127] and not the user-level range of [0,63]. |
40 static const int kLowVp8QpThreshold = 29; | 40 static const int kLowVp8QpThreshold = 29; |
41 static const int kHighVp8QpThreshold = 95; | 41 static const int kHighVp8QpThreshold = 95; |
| 42 // QP is obtained from VP9-bitstream for HW, so the QP corresponds to the |
| 43 // bitstream range of [0, 255] and not the user-level range of [0,63]. |
| 44 // Current VP9 settings are mapped from VP8 thresholds above. |
| 45 static const int kLowVp9QpThreshold = 96; |
| 46 static const int kHighVp9QpThreshold = 208; |
42 static const int kMinFramesNeededToScale = 2 * 30; | 47 static const int kMinFramesNeededToScale = 2 * 30; |
43 | 48 |
44 static VideoEncoder::QpThresholds CodecTypeToDefaultThresholds( | 49 static VideoEncoder::QpThresholds CodecTypeToDefaultThresholds( |
45 VideoCodecType codec_type) { | 50 VideoCodecType codec_type) { |
46 int low = -1; | 51 int low = -1; |
47 int high = -1; | 52 int high = -1; |
48 switch (codec_type) { | 53 switch (codec_type) { |
49 case kVideoCodecH264: | 54 case kVideoCodecH264: |
50 low = kLowH264QpThreshold; | 55 low = kLowH264QpThreshold; |
51 high = kHighH264QpThreshold; | 56 high = kHighH264QpThreshold; |
52 break; | 57 break; |
53 case kVideoCodecVP8: | 58 case kVideoCodecVP8: |
54 low = kLowVp8QpThreshold; | 59 low = kLowVp8QpThreshold; |
55 high = kHighVp8QpThreshold; | 60 high = kHighVp8QpThreshold; |
56 break; | 61 break; |
| 62 case kVideoCodecVP9: |
| 63 low = kLowVp9QpThreshold; |
| 64 high = kHighVp9QpThreshold; |
| 65 break; |
57 default: | 66 default: |
58 RTC_NOTREACHED() << "Invalid codec type for QualityScaler."; | 67 RTC_NOTREACHED() << "Invalid codec type for QualityScaler."; |
59 } | 68 } |
60 return VideoEncoder::QpThresholds(low, high); | 69 return VideoEncoder::QpThresholds(low, high); |
61 } | 70 } |
62 } // namespace | 71 } // namespace |
63 | 72 |
64 class QualityScaler::CheckQPTask : public rtc::QueuedTask { | 73 class QualityScaler::CheckQPTask : public rtc::QueuedTask { |
65 public: | 74 public: |
66 explicit CheckQPTask(QualityScaler* scaler) : scaler_(scaler) { | 75 explicit CheckQPTask(QualityScaler* scaler) : scaler_(scaler) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 fast_rampup_ = false; | 196 fast_rampup_ = false; |
188 } | 197 } |
189 } | 198 } |
190 | 199 |
191 void QualityScaler::ClearSamples() { | 200 void QualityScaler::ClearSamples() { |
192 RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_); | 201 RTC_DCHECK_CALLED_SEQUENTIALLY(&task_checker_); |
193 framedrop_percent_.Reset(); | 202 framedrop_percent_.Reset(); |
194 average_qp_.Reset(); | 203 average_qp_.Reset(); |
195 } | 204 } |
196 } // namespace webrtc | 205 } // namespace webrtc |
OLD | NEW |