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

Side by Side Diff: webrtc/video_encoder.h

Issue 2398963003: Move usage of QualityScaler to ViEEncoder. (Closed)
Patch Set: fix android build 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/common_types.h" 18 #include "webrtc/common_types.h"
19 #include "webrtc/typedefs.h" 19 #include "webrtc/typedefs.h"
20 #include "webrtc/video_frame.h" 20 #include "webrtc/video_frame.h"
21 #include "webrtc/base/optional.h"
21 22
22 namespace webrtc { 23 namespace webrtc {
23 24
24 class RTPFragmentationHeader; 25 class RTPFragmentationHeader;
25 // TODO(pbos): Expose these through a public (root) header or change these APIs. 26 // TODO(pbos): Expose these through a public (root) header or change these APIs.
26 struct CodecSpecificInfo; 27 struct CodecSpecificInfo;
27 class VideoCodec; 28 class VideoCodec;
28 29
29 class EncodedImageCallback { 30 class EncodedImageCallback {
30 public: 31 public:
(...skipping 30 matching lines...) Expand all
61 }; 62 };
62 63
63 class VideoEncoder { 64 class VideoEncoder {
64 public: 65 public:
65 enum EncoderType { 66 enum EncoderType {
66 kH264, 67 kH264,
67 kVp8, 68 kVp8,
68 kVp9, 69 kVp9,
69 kUnsupportedCodec, 70 kUnsupportedCodec,
70 }; 71 };
71 72 struct QPThresholds {
73 QPThresholds(int l, int h) : low(l), high(h) {}
74 QPThresholds() : low(-1), high(-1) {}
75 int low;
76 int high;
77 };
78 struct ScalingSettings {
79 ScalingSettings(bool on, int low, int high)
80 : enabled(on),
81 thresholds(rtc::Optional<QPThresholds>(QPThresholds(low, high))) {}
82 explicit ScalingSettings(bool on) : enabled(on) {}
83 const bool enabled;
84 const rtc::Optional<QPThresholds> thresholds;
85 };
72 static VideoEncoder* Create(EncoderType codec_type); 86 static VideoEncoder* Create(EncoderType codec_type);
73 // Returns true if this type of encoder can be created using 87 // Returns true if this type of encoder can be created using
74 // VideoEncoder::Create. 88 // VideoEncoder::Create.
75 static bool IsSupportedSoftware(EncoderType codec_type); 89 static bool IsSupportedSoftware(EncoderType codec_type);
76 static EncoderType CodecToEncoderType(VideoCodecType codec_type); 90 static EncoderType CodecToEncoderType(VideoCodecType codec_type);
77 91
78 static VideoCodecVP8 GetDefaultVp8Settings(); 92 static VideoCodecVP8 GetDefaultVp8Settings();
79 static VideoCodecVP9 GetDefaultVp9Settings(); 93 static VideoCodecVP9 GetDefaultVp9Settings();
80 static VideoCodecH264 GetDefaultH264Settings(); 94 static VideoCodecH264 GetDefaultH264Settings();
81 95
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 157
144 // Inform the encoder about the new target bit rate. 158 // Inform the encoder about the new target bit rate.
145 // 159 //
146 // Input: 160 // Input:
147 // - bitrate : New target bit rate 161 // - bitrate : New target bit rate
148 // - framerate : The target frame rate 162 // - framerate : The target frame rate
149 // 163 //
150 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. 164 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise.
151 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; 165 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0;
152 166
167 // Any encoder implementation wishing to use the WebRTC provided
168 // quality scaler must implement this method.
169 virtual ScalingSettings GetScalingSettings() const {
170 return ScalingSettings(false);
171 }
172
153 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } 173 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; }
154 virtual void OnDroppedFrame() {} 174 virtual void OnDroppedFrame() {}
155 virtual bool SupportsNativeHandle() const { return false; } 175 virtual bool SupportsNativeHandle() const { return false; }
156 virtual const char* ImplementationName() const { return "unknown"; } 176 virtual const char* ImplementationName() const { return "unknown"; }
157 }; 177 };
158 178
159 } // namespace webrtc 179 } // namespace webrtc
160 #endif // WEBRTC_VIDEO_ENCODER_H_ 180 #endif // WEBRTC_VIDEO_ENCODER_H_
OLDNEW
« webrtc/video/vie_encoder.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