| 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // - bitrate : New target bit rate | 116 // - bitrate : New target bit rate |
| 117 // - framerate : The target frame rate | 117 // - framerate : The target frame rate |
| 118 // | 118 // |
| 119 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. | 119 // Return value : WEBRTC_VIDEO_CODEC_OK if OK, < 0 otherwise. |
| 120 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; | 120 virtual int32_t SetRates(uint32_t bitrate, uint32_t framerate) = 0; |
| 121 | 121 |
| 122 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } | 122 virtual int32_t SetPeriodicKeyFrames(bool enable) { return -1; } |
| 123 virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) { | 123 virtual int32_t CodecConfigParameters(uint8_t* /*buffer*/, int32_t /*size*/) { |
| 124 return -1; | 124 return -1; |
| 125 } | 125 } |
| 126 virtual void OnDroppedFrame() {}; | 126 virtual void OnDroppedFrame() {} |
| 127 virtual bool SupportsNativeHandle() const { return false; } |
| 127 }; | 128 }; |
| 128 | 129 |
| 129 // Class used to wrap external VideoEncoders to provide a fallback option on | 130 // Class used to wrap external VideoEncoders to provide a fallback option on |
| 130 // software encoding when a hardware encoder fails to encode a stream due to | 131 // software encoding when a hardware encoder fails to encode a stream due to |
| 131 // hardware restrictions, such as max resolution. | 132 // hardware restrictions, such as max resolution. |
| 132 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { | 133 class VideoEncoderSoftwareFallbackWrapper : public VideoEncoder { |
| 133 public: | 134 public: |
| 134 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, | 135 VideoEncoderSoftwareFallbackWrapper(VideoCodecType codec_type, |
| 135 webrtc::VideoEncoder* encoder); | 136 webrtc::VideoEncoder* encoder); |
| 136 | 137 |
| 137 int32_t InitEncode(const VideoCodec* codec_settings, | 138 int32_t InitEncode(const VideoCodec* codec_settings, |
| 138 int32_t number_of_cores, | 139 int32_t number_of_cores, |
| 139 size_t max_payload_size) override; | 140 size_t max_payload_size) override; |
| 140 | 141 |
| 141 int32_t RegisterEncodeCompleteCallback( | 142 int32_t RegisterEncodeCompleteCallback( |
| 142 EncodedImageCallback* callback) override; | 143 EncodedImageCallback* callback) override; |
| 143 | 144 |
| 144 int32_t Release() override; | 145 int32_t Release() override; |
| 145 int32_t Encode(const VideoFrame& frame, | 146 int32_t Encode(const VideoFrame& frame, |
| 146 const CodecSpecificInfo* codec_specific_info, | 147 const CodecSpecificInfo* codec_specific_info, |
| 147 const std::vector<VideoFrameType>* frame_types) override; | 148 const std::vector<VideoFrameType>* frame_types) override; |
| 148 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 149 int32_t SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
| 149 | 150 |
| 150 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; | 151 int32_t SetRates(uint32_t bitrate, uint32_t framerate) override; |
| 151 void OnDroppedFrame() override; | 152 void OnDroppedFrame() override; |
| 153 bool SupportsNativeHandle() const override; |
| 152 | 154 |
| 153 private: | 155 private: |
| 154 const EncoderType encoder_type_; | 156 const EncoderType encoder_type_; |
| 155 webrtc::VideoEncoder* const encoder_; | 157 webrtc::VideoEncoder* const encoder_; |
| 156 | 158 |
| 157 rtc::scoped_ptr<webrtc::VideoEncoder> fallback_encoder_; | 159 rtc::scoped_ptr<webrtc::VideoEncoder> fallback_encoder_; |
| 158 EncodedImageCallback* callback_; | 160 EncodedImageCallback* callback_; |
| 159 }; | 161 }; |
| 160 } // namespace webrtc | 162 } // namespace webrtc |
| 161 #endif // WEBRTC_VIDEO_ENCODER_H_ | 163 #endif // WEBRTC_VIDEO_ENCODER_H_ |
| OLD | NEW |