| 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 */ |
| 11 | 11 |
| 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ | 12 #ifndef WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ |
| 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ | 13 #define WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ |
| 14 | 14 |
| 15 #include "webrtc/common_video/rotation.h" |
| 15 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" | 16 #include "webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 16 #include "webrtc/modules/video_coding/include/bitrate_adjuster.h" | 17 #include "webrtc/modules/video_coding/include/bitrate_adjuster.h" |
| 17 | 18 |
| 18 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 19 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
| 19 | 20 |
| 20 #include <VideoToolbox/VideoToolbox.h> | 21 #include <VideoToolbox/VideoToolbox.h> |
| 21 #include <vector> | 22 #include <vector> |
| 22 | 23 |
| 23 // This file provides a H264 encoder implementation using the VideoToolbox | 24 // This file provides a H264 encoder implementation using the VideoToolbox |
| 24 // APIs. Since documentation is almost non-existent, this is largely based on | 25 // APIs. Since documentation is almost non-existent, this is largely based on |
| (...skipping 26 matching lines...) Expand all Loading... |
| 51 | 52 |
| 52 const char* ImplementationName() const override; | 53 const char* ImplementationName() const override; |
| 53 | 54 |
| 54 void OnEncodedFrame(OSStatus status, | 55 void OnEncodedFrame(OSStatus status, |
| 55 VTEncodeInfoFlags info_flags, | 56 VTEncodeInfoFlags info_flags, |
| 56 CMSampleBufferRef sample_buffer, | 57 CMSampleBufferRef sample_buffer, |
| 57 CodecSpecificInfo codec_specific_info, | 58 CodecSpecificInfo codec_specific_info, |
| 58 int32_t width, | 59 int32_t width, |
| 59 int32_t height, | 60 int32_t height, |
| 60 int64_t render_time_ms, | 61 int64_t render_time_ms, |
| 61 uint32_t timestamp); | 62 uint32_t timestamp, |
| 63 VideoRotation rotation); |
| 62 | 64 |
| 63 private: | 65 private: |
| 64 int ResetCompressionSession(); | 66 int ResetCompressionSession(); |
| 65 void ConfigureCompressionSession(); | 67 void ConfigureCompressionSession(); |
| 66 void DestroyCompressionSession(); | 68 void DestroyCompressionSession(); |
| 67 void SetBitrateBps(uint32_t bitrate_bps); | 69 void SetBitrateBps(uint32_t bitrate_bps); |
| 68 void SetEncoderBitrateBps(uint32_t bitrate_bps); | 70 void SetEncoderBitrateBps(uint32_t bitrate_bps); |
| 69 | 71 |
| 70 EncodedImageCallback* callback_; | 72 EncodedImageCallback* callback_; |
| 71 VTCompressionSessionRef compression_session_; | 73 VTCompressionSessionRef compression_session_; |
| 72 BitrateAdjuster bitrate_adjuster_; | 74 BitrateAdjuster bitrate_adjuster_; |
| 73 uint32_t target_bitrate_bps_; | 75 uint32_t target_bitrate_bps_; |
| 74 uint32_t encoder_bitrate_bps_; | 76 uint32_t encoder_bitrate_bps_; |
| 75 int32_t width_; | 77 int32_t width_; |
| 76 int32_t height_; | 78 int32_t height_; |
| 77 }; // H264VideoToolboxEncoder | 79 }; // H264VideoToolboxEncoder |
| 78 | 80 |
| 79 } // namespace webrtc | 81 } // namespace webrtc |
| 80 | 82 |
| 81 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) | 83 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
| 82 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ | 84 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_H264_H264_VIDEO_TOOLBOX_ENCODER_H_ |
| OLD | NEW |