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 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h" | 12 #include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h" |
| 13 |
| 14 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
13 | 15 |
14 #include <memory> | 16 #include <memory> |
15 #include <string> | 17 #include <string> |
16 #include <vector> | 18 #include <vector> |
17 | 19 |
18 #if defined(WEBRTC_IOS) | 20 #if defined(WEBRTC_IOS) |
19 #import "WebRTC/UIDevice+RTCDevice.h" | 21 #import "WebRTC/UIDevice+RTCDevice.h" |
20 #include "RTCUIApplication.h" | 22 #include "RTCUIApplication.h" |
21 #endif | 23 #endif |
22 #include "libyuv/convert_from.h" | 24 #include "libyuv/convert_from.h" |
23 #include "webrtc/base/checks.h" | 25 #include "webrtc/base/checks.h" |
24 #include "webrtc/base/logging.h" | 26 #include "webrtc/base/logging.h" |
25 #include "webrtc/common_video/include/corevideo_frame_buffer.h" | 27 #include "webrtc/common_video/include/corevideo_frame_buffer.h" |
26 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_nalu.h" | 28 #include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h" |
27 #include "webrtc/system_wrappers/include/clock.h" | 29 #include "webrtc/system_wrappers/include/clock.h" |
28 | 30 |
29 namespace internal { | 31 namespace internal { |
30 | 32 |
31 // The ratio between kVTCompressionPropertyKey_DataRateLimits and | 33 // The ratio between kVTCompressionPropertyKey_DataRateLimits and |
32 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher | 34 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher |
33 // than the average bit rate to avoid undershooting the target. | 35 // than the average bit rate to avoid undershooting the target. |
34 const float kLimitToAverageBitRateFactor = 1.5f; | 36 const float kLimitToAverageBitRateFactor = 1.5f; |
35 // These thresholds deviate from the default h264 QP thresholds, as they | 37 // These thresholds deviate from the default h264 QP thresholds, as they |
36 // have been found to work better on devices that support VideoToolbox | 38 // have been found to work better on devices that support VideoToolbox |
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 EncodedImageCallback::Result result = | 653 EncodedImageCallback::Result result = |
652 callback_->OnEncodedImage(frame, &codec_specific_info, header.get()); | 654 callback_->OnEncodedImage(frame, &codec_specific_info, header.get()); |
653 if (result.error != EncodedImageCallback::Result::OK) { | 655 if (result.error != EncodedImageCallback::Result::OK) { |
654 LOG(LS_ERROR) << "Encode callback failed: " << result.error; | 656 LOG(LS_ERROR) << "Encode callback failed: " << result.error; |
655 return; | 657 return; |
656 } | 658 } |
657 bitrate_adjuster_.Update(frame._size); | 659 bitrate_adjuster_.Update(frame._size); |
658 } | 660 } |
659 | 661 |
660 } // namespace webrtc | 662 } // namespace webrtc |
| 663 |
| 664 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED) |
OLD | NEW |