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