| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 28 matching lines...) Expand all Loading... |
| 39 int InitEncode(const VideoCodec* codec_settings, | 39 int InitEncode(const VideoCodec* codec_settings, |
| 40 int number_of_cores, | 40 int number_of_cores, |
| 41 size_t max_payload_size) override; | 41 size_t max_payload_size) override; |
| 42 | 42 |
| 43 int Encode(const VideoFrame& input_image, | 43 int Encode(const VideoFrame& input_image, |
| 44 const CodecSpecificInfo* codec_specific_info, | 44 const CodecSpecificInfo* codec_specific_info, |
| 45 const std::vector<FrameType>* frame_types) override; | 45 const std::vector<FrameType>* frame_types) override; |
| 46 | 46 |
| 47 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; | 47 int RegisterEncodeCompleteCallback(EncodedImageCallback* callback) override; |
| 48 | 48 |
| 49 void OnDroppedFrame() override; | |
| 50 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; | 49 int SetChannelParameters(uint32_t packet_loss, int64_t rtt) override; |
| 51 | 50 |
| 52 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override; | 51 int SetRates(uint32_t new_bitrate_kbit, uint32_t frame_rate) override; |
| 53 | 52 |
| 54 int Release() override; | 53 int Release() override; |
| 55 | 54 |
| 56 const char* ImplementationName() const override; | 55 const char* ImplementationName() const override; |
| 57 | 56 |
| 58 bool SupportsNativeHandle() const override; | 57 bool SupportsNativeHandle() const override; |
| 59 | 58 |
| 60 void OnEncodedFrame(OSStatus status, | 59 void OnEncodedFrame(OSStatus status, |
| 61 VTEncodeInfoFlags info_flags, | 60 VTEncodeInfoFlags info_flags, |
| 62 CMSampleBufferRef sample_buffer, | 61 CMSampleBufferRef sample_buffer, |
| 63 CodecSpecificInfo codec_specific_info, | 62 CodecSpecificInfo codec_specific_info, |
| 64 int32_t width, | 63 int32_t width, |
| 65 int32_t height, | 64 int32_t height, |
| 66 int64_t render_time_ms, | 65 int64_t render_time_ms, |
| 67 uint32_t timestamp, | 66 uint32_t timestamp, |
| 68 VideoRotation rotation); | 67 VideoRotation rotation); |
| 69 | 68 |
| 69 ScalingSettings GetScalingSettings() const override; |
| 70 |
| 70 private: | 71 private: |
| 71 int ResetCompressionSession(); | 72 int ResetCompressionSession(); |
| 72 void ConfigureCompressionSession(); | 73 void ConfigureCompressionSession(); |
| 73 void DestroyCompressionSession(); | 74 void DestroyCompressionSession(); |
| 74 rtc::scoped_refptr<VideoFrameBuffer> GetScaledBufferOnEncode( | 75 rtc::scoped_refptr<VideoFrameBuffer> GetScaledBufferOnEncode( |
| 75 const rtc::scoped_refptr<VideoFrameBuffer>& frame); | 76 const rtc::scoped_refptr<VideoFrameBuffer>& frame); |
| 76 void SetBitrateBps(uint32_t bitrate_bps); | 77 void SetBitrateBps(uint32_t bitrate_bps); |
| 77 void SetEncoderBitrateBps(uint32_t bitrate_bps); | 78 void SetEncoderBitrateBps(uint32_t bitrate_bps); |
| 78 | 79 |
| 79 EncodedImageCallback* callback_; | 80 EncodedImageCallback* callback_; |
| 80 VTCompressionSessionRef compression_session_; | 81 VTCompressionSessionRef compression_session_; |
| 81 BitrateAdjuster bitrate_adjuster_; | 82 BitrateAdjuster bitrate_adjuster_; |
| 82 uint32_t target_bitrate_bps_; | 83 uint32_t target_bitrate_bps_; |
| 83 uint32_t encoder_bitrate_bps_; | 84 uint32_t encoder_bitrate_bps_; |
| 84 int32_t width_; | 85 int32_t width_; |
| 85 int32_t height_; | 86 int32_t height_; |
| 86 const CFStringRef profile_; | 87 const CFStringRef profile_; |
| 87 | 88 |
| 88 rtc::CriticalSection quality_scaler_crit_; | |
| 89 QualityScaler quality_scaler_ GUARDED_BY(quality_scaler_crit_); | |
| 90 H264BitstreamParser h264_bitstream_parser_; | 89 H264BitstreamParser h264_bitstream_parser_; |
| 91 bool enable_scaling_; | |
| 92 std::vector<uint8_t> nv12_scale_buffer_; | 90 std::vector<uint8_t> nv12_scale_buffer_; |
| 93 }; // H264VideoToolboxEncoder | 91 }; // H264VideoToolboxEncoder |
| 94 | 92 |
| 95 } // namespace webrtc | 93 } // namespace webrtc |
| 96 | 94 |
| 97 #endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_H264_VIDEO_TOOLBOX_ENCODER_H_ | 95 #endif // WEBRTC_SDK_OBJC_FRAMEWORK_CLASSES_H264_VIDEO_TOOLBOX_ENCODER_H_ |
| OLD | NEW |