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

Side by Side Diff: webrtc/video_encoder.h

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: prevent data race Created 4 years, 1 month 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
11 #ifndef WEBRTC_VIDEO_ENCODER_H_ 11 #ifndef WEBRTC_VIDEO_ENCODER_H_
12 #define WEBRTC_VIDEO_ENCODER_H_ 12 #define WEBRTC_VIDEO_ENCODER_H_
13 13
14 #include <memory> 14 #include <memory>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/common_types.h" 19 #include "webrtc/common_types.h"
20 #include "webrtc/typedefs.h" 20 #include "webrtc/typedefs.h"
21 #include "webrtc/video_frame.h" 21 #include "webrtc/video_frame.h"
22 #include "webrtc/base/optional.h"
22 23
23 namespace webrtc { 24 namespace webrtc {
24 25
25 class RTPFragmentationHeader; 26 class RTPFragmentationHeader;
26 // TODO(pbos): Expose these through a public (root) header or change these APIs. 27 // TODO(pbos): Expose these through a public (root) header or change these APIs.
27 struct CodecSpecificInfo; 28 struct CodecSpecificInfo;
28 class VideoCodec; 29 class VideoCodec;
29 30
30 class EncodedImageCallback { 31 class EncodedImageCallback {
31 public: 32 public:
(...skipping 30 matching lines...) Expand all
62 }; 63 };
63 64
64 class VideoEncoder { 65 class VideoEncoder {
65 public: 66 public:
66 enum EncoderType { 67 enum EncoderType {
67 kH264, 68 kH264,
68 kVp8, 69 kVp8,
69 kVp9, 70 kVp9,
70 kUnsupportedCodec, 71 kUnsupportedCodec,
71 }; 72 };
72 73 struct QPThresholds {
stefan-webrtc 2016/11/17 16:12:57 QpThresholds
kthelgason 2016/11/21 13:06:53 Done.
74 QPThresholds(int l, int h) : low(l), high(h) {}
75 QPThresholds() : low(-1), high(-1) {}
76 int low;
77 int high;
78 };
79 struct ScalingSettings {
80 ScalingSettings(bool on, int low, int high)
81 : enabled(on),
82 thresholds(rtc::Optional<QPThresholds>(QPThresholds(low, high))) {}
83 explicit ScalingSettings(bool on) : enabled(on) {}
84 const bool enabled;
85 const rtc::Optional<QPThresholds> thresholds;
86 };
73 static VideoEncoder* Create(EncoderType codec_type); 87 static VideoEncoder* Create(EncoderType codec_type);
74 // Returns true if this type of encoder can be created using 88 // Returns true if this type of encoder can be created using
75 // VideoEncoder::Create. 89 // VideoEncoder::Create.
76 static bool IsSupportedSoftware(EncoderType codec_type); 90 static bool IsSupportedSoftware(EncoderType codec_type);
77 static EncoderType CodecToEncoderType(VideoCodecType codec_type); 91 static EncoderType CodecToEncoderType(VideoCodecType codec_type);
78 92
79 static VideoCodecVP8 GetDefaultVp8Settings(); 93 static VideoCodecVP8 GetDefaultVp8Settings();
80 static VideoCodecVP9 GetDefaultVp9Settings(); 94 static VideoCodecVP9 GetDefaultVp9Settings();
81 static VideoCodecH264 GetDefaultH264Settings(); 95 static VideoCodecH264 GetDefaultH264Settings();
82 96
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return -1; 168 return -1;
155 } 169 }
156 170
157 // Default fallback: Just use the sum of bitrates as the single target rate. 171 // Default fallback: Just use the sum of bitrates as the single target rate.
158 // TODO(sprang): Remove this default implementation when we remove SetRates(). 172 // TODO(sprang): Remove this default implementation when we remove SetRates().
159 virtual int32_t SetRateAllocation(const BitrateAllocation& allocation, 173 virtual int32_t SetRateAllocation(const BitrateAllocation& allocation,
160 uint32_t framerate) { 174 uint32_t framerate) {
161 return SetRates(allocation.get_sum_kbps(), framerate); 175 return SetRates(allocation.get_sum_kbps(), framerate);
162 } 176 }
163 177
178 // Any encoder implementation wishing to use the WebRTC provided
179 // quality scaler must implement this method.
180 virtual ScalingSettings GetScalingSettings() const {
181 return ScalingSettings(false);
182 }
183
164 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } 184 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; }
165 virtual void OnDroppedFrame() {} 185 virtual void OnDroppedFrame() {}
stefan-webrtc 2016/11/17 16:12:57 TODO remove.
kthelgason 2016/11/21 13:06:53 Should this be removed from the interface? If so,
stefan-webrtc 2016/11/24 09:36:55 I thought it was only used for quality scaling? If
166 virtual bool SupportsNativeHandle() const { return false; } 186 virtual bool SupportsNativeHandle() const { return false; }
167 virtual const char* ImplementationName() const { return "unknown"; } 187 virtual const char* ImplementationName() const { return "unknown"; }
168 }; 188 };
169 189
170 } // namespace webrtc 190 } // namespace webrtc
171 #endif // WEBRTC_VIDEO_ENCODER_H_ 191 #endif // WEBRTC_VIDEO_ENCODER_H_
OLDNEW
« webrtc/video/vie_encoder_unittest.cc ('K') | « webrtc/video/vie_encoder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698