Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.mm

Issue 2487723004: Reland of Add a webrtc{en,de}coderfactory implementation for VideoToolbox (Closed)
Patch Set: fix gyp build Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/modules/video_coding/codecs/h264/h264_video_toolbox_encoder.h" 12 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_encoder.h"
13
14 #if defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
15 13
16 #include <memory> 14 #include <memory>
17 #include <string> 15 #include <string>
18 #include <vector> 16 #include <vector>
19 17
20 #if defined(WEBRTC_IOS) 18 #if defined(WEBRTC_IOS)
21 #import "WebRTC/UIDevice+RTCDevice.h" 19 #import "WebRTC/UIDevice+RTCDevice.h"
22 #include "RTCUIApplication.h" 20 #include "RTCUIApplication.h"
23 #endif 21 #endif
24 #include "libyuv/convert_from.h" 22 #include "libyuv/convert_from.h"
25 #include "webrtc/base/checks.h" 23 #include "webrtc/base/checks.h"
26 #include "webrtc/base/logging.h" 24 #include "webrtc/base/logging.h"
27 #include "webrtc/common_video/include/corevideo_frame_buffer.h" 25 #include "webrtc/common_video/include/corevideo_frame_buffer.h"
28 #include "webrtc/modules/video_coding/codecs/h264/h264_video_toolbox_nalu.h" 26 #include "webrtc/sdk/objc/Framework/Classes/h264_video_toolbox_nalu.h"
29 #include "webrtc/system_wrappers/include/clock.h" 27 #include "webrtc/system_wrappers/include/clock.h"
30 28
31 namespace internal { 29 namespace internal {
32 30
33 // The ratio between kVTCompressionPropertyKey_DataRateLimits and 31 // The ratio between kVTCompressionPropertyKey_DataRateLimits and
34 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher 32 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher
35 // than the average bit rate to avoid undershooting the target. 33 // than the average bit rate to avoid undershooting the target.
36 const float kLimitToAverageBitRateFactor = 1.5f; 34 const float kLimitToAverageBitRateFactor = 1.5f;
37 // These thresholds deviate from the default h264 QP thresholds, as they 35 // These thresholds deviate from the default h264 QP thresholds, as they
38 // have been found to work better on devices that support VideoToolbox 36 // have been found to work better on devices that support VideoToolbox
(...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 EncodedImageCallback::Result result = 651 EncodedImageCallback::Result result =
654 callback_->OnEncodedImage(frame, &codec_specific_info, header.get()); 652 callback_->OnEncodedImage(frame, &codec_specific_info, header.get());
655 if (result.error != EncodedImageCallback::Result::OK) { 653 if (result.error != EncodedImageCallback::Result::OK) {
656 LOG(LS_ERROR) << "Encode callback failed: " << result.error; 654 LOG(LS_ERROR) << "Encode callback failed: " << result.error;
657 return; 655 return;
658 } 656 }
659 bitrate_adjuster_.Update(frame._size); 657 bitrate_adjuster_.Update(frame._size);
660 } 658 }
661 659
662 } // namespace webrtc 660 } // namespace webrtc
663
664 #endif // defined(WEBRTC_VIDEO_TOOLBOX_SUPPORTED)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698