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

Side by Side Diff: sdk/objc/Framework/Classes/VideoToolbox/RTCVideoEncoderH264.mm

Issue 3015693002: Remove internal video codec methods from global namespace.
Patch Set: Created 3 years, 2 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 */
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 sampleBuffer:(CMSampleBufferRef)sampleBuffer 42 sampleBuffer:(CMSampleBufferRef)sampleBuffer
43 codecSpecificInfo:(id<RTCCodecSpecificInfo>)codecSpecificInfo 43 codecSpecificInfo:(id<RTCCodecSpecificInfo>)codecSpecificInfo
44 width:(int32_t)width 44 width:(int32_t)width
45 height:(int32_t)height 45 height:(int32_t)height
46 renderTimeMs:(int64_t)renderTimeMs 46 renderTimeMs:(int64_t)renderTimeMs
47 timestamp:(uint32_t)timestamp 47 timestamp:(uint32_t)timestamp
48 rotation:(RTCVideoRotation)rotation; 48 rotation:(RTCVideoRotation)rotation;
49 49
50 @end 50 @end
51 51
52 namespace { // anonymous namespace
53
52 // The ratio between kVTCompressionPropertyKey_DataRateLimits and 54 // The ratio between kVTCompressionPropertyKey_DataRateLimits and
53 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher 55 // kVTCompressionPropertyKey_AverageBitRate. The data rate limit is set higher
54 // than the average bit rate to avoid undershooting the target. 56 // than the average bit rate to avoid undershooting the target.
55 const float kLimitToAverageBitRateFactor = 1.5f; 57 const float kLimitToAverageBitRateFactor = 1.5f;
56 // These thresholds deviate from the default h264 QP thresholds, as they 58 // These thresholds deviate from the default h264 QP thresholds, as they
57 // have been found to work better on devices that support VideoToolbox 59 // have been found to work better on devices that support VideoToolbox
58 const int kLowH264QpThreshold = 28; 60 const int kLowH264QpThreshold = 28;
59 const int kHighH264QpThreshold = 39; 61 const int kHighH264QpThreshold = 39;
60 62
61 // Struct that we pass to the encoder per frame to encode. We receive it again 63 // Struct that we pass to the encoder per frame to encode. We receive it again
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 case webrtc::H264::kLevel1_1: 263 case webrtc::H264::kLevel1_1:
262 case webrtc::H264::kLevel1_2: 264 case webrtc::H264::kLevel1_2:
263 case webrtc::H264::kLevel1_3: 265 case webrtc::H264::kLevel1_3:
264 case webrtc::H264::kLevel2: 266 case webrtc::H264::kLevel2:
265 case webrtc::H264::kLevel2_1: 267 case webrtc::H264::kLevel2_1:
266 case webrtc::H264::kLevel2_2: 268 case webrtc::H264::kLevel2_2:
267 return kVTProfileLevel_H264_High_AutoLevel; 269 return kVTProfileLevel_H264_High_AutoLevel;
268 } 270 }
269 } 271 }
270 } 272 }
273 } // namespace
271 274
272 @implementation RTCVideoEncoderH264 { 275 @implementation RTCVideoEncoderH264 {
273 RTCVideoCodecInfo *_codecInfo; 276 RTCVideoCodecInfo *_codecInfo;
274 webrtc::BitrateAdjuster *_bitrateAdjuster; 277 webrtc::BitrateAdjuster *_bitrateAdjuster;
275 uint32_t _targetBitrateBps; 278 uint32_t _targetBitrateBps;
276 uint32_t _encoderBitrateBps; 279 uint32_t _encoderBitrateBps;
277 RTCH264PacketizationMode _packetizationMode; 280 RTCH264PacketizationMode _packetizationMode;
278 CFStringRef _profile; 281 CFStringRef _profile;
279 RTCVideoEncoderCallback _callback; 282 RTCVideoEncoderCallback _callback;
280 int32_t _width; 283 int32_t _width;
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
704 } 707 }
705 _bitrateAdjuster->Update(frame.buffer.length); 708 _bitrateAdjuster->Update(frame.buffer.length);
706 } 709 }
707 710
708 - (RTCVideoEncoderQpThresholds *)scalingSettings { 711 - (RTCVideoEncoderQpThresholds *)scalingSettings {
709 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh reshold 712 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh reshold
710 high:kHighH264QpT hreshold]; 713 high:kHighH264QpT hreshold];
711 } 714 }
712 715
713 @end 716 @end
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698