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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // | 118 // |
119 // Input: | 119 // Input: |
120 // - bitrate : New target bit rate | 120 // - bitrate : New target bit rate |
121 // - framerate : The target frame rate | 121 // - framerate : The target frame rate |
122 // | 122 // |
123 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. | 123 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. |
124 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; | 124 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; |
125 | 125 |
126 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } | 126 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } |
127 virtual void OnDroppedFrame() {} | 127 virtual void OnDroppedFrame() {} |
128 virtual int GetTargetFramerate() { return -1; } | |
129 virtual bool SupportsNativeHandle() const { return false; } | 128 virtual bool SupportsNativeHandle() const { return false; } |
130 virtual const char* ImplementationName() const { return "unknown"; } | 129 virtual const char* ImplementationName() const { return "unknown"; } |
131 }; | 130 }; |
132 | 131 |
133 // Class used to wrap external VideoEncoders to provide a fallback option on | 132 // Class used to wrap external VideoEncoders to provide a fallback option on |
134 // software encoding when a hardware encoder fails to encode a stream due to | 133 // software encoding when a hardware encoder fails to encode a stream due to |
135 // hardware restrictions, such as max resolution. | 134 // hardware restrictions, such as max resolution. |
136 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { | 135 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { |
137 public: | 136 public: |
138 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, | 137 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, |
139 webrtc::VideoEncoder* encoder); | 138 webrtc::VideoEncoder* encoder); |
140 | 139 |
141 int32_t InitEncode(const VideoCodec* codec_settings, | 140 int32_t InitEncode(const VideoCodec* codec_settings, |
142 int32_t number_of_cores, | 141 int32_t number_of_cores, |
143 size_t max_payload_size) override; | 142 size_t max_payload_size) override; |
144 | 143 |
145 int32_t RegisterEncodeCompleteCallback( | 144 int32_t RegisterEncodeCompleteCallback( |
146 EncodedImageCallback* callback) override; | 145 EncodedImageCallback* callback) override; |
147 | 146 |
148 int32_t Release() override; | 147 int32_t Release() override; |
149 int32_t Encode(const VideoFrame& frame, | 148 int32_t Encode(const VideoFrame& frame, |
150 const CodecSpecificInfo* codec_specific_info, | 149 const CodecSpecificInfo* codec_specific_info, |
151 const std::vector<FrameType>* frame_types) override; | 150 const std::vector<FrameType>* frame_types) override; |
152 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 151 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
153 | 152 |
154 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; | 153 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; |
155 void OnDroppedFrame() override; | 154 void OnDroppedFrame() override; |
156 int GetTargetFramerate() override; | |
157 bool SupportsNativeHandle() const override; | 155 bool SupportsNativeHandle() const override; |
158 const char* ImplementationName() const override; | 156 const char* ImplementationName() const override; |
159 | 157 |
160 private: | 158 private: |
161 bool InitFallbackEncoder(); | 159 bool InitFallbackEncoder(); |
162 | 160 |
163 // Settings used in the last InitEncode call and used if a dynamic fallback to | 161 // Settings used in the last InitEncode call and used if a dynamic fallback to |
164 // software is required. | 162 // software is required. |
165 VideoCodec codec_settings_; | 163 VideoCodec codec_settings_; |
166 int32_t number_of_cores_; | 164 int32_t number_of_cores_; |
(...skipping 11 matching lines...) Expand all Loading... |
178 | 176 |
179 const EncoderType encoder_type_; | 177 const EncoderType encoder_type_; |
180 webrtc::VideoEncoder* const encoder_; | 178 webrtc::VideoEncoder* const encoder_; |
181 | 179 |
182 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; | 180 std::unique_ptr<webrtc::VideoEncoder> fallback_encoder_; |
183 std::string fallback_implementation_name_; | 181 std::string fallback_implementation_name_; |
184 EncodedImageCallback* callback_; | 182 EncodedImageCallback* callback_; |
185 }; | 183 }; |
186 } // namespace webrtc | 184 } // namespace webrtc |
187 #endif // WEBRTC_VIDEO_ENCODER_H_ | 185 #endif // WEBRTC_VIDEO_ENCODER_H_ |
OLD | NEW |