| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2017 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 - (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate { | 175 - (BOOL)setBitrate:(uint32_t)bitrateKbit framerate:(uint32_t)framerate { |
| 176 return _videoToolboxEncoder->SetRates(bitrateKbit, framerate) == WEBRTC_VIDEO_
CODEC_OK; | 176 return _videoToolboxEncoder->SetRates(bitrateKbit, framerate) == WEBRTC_VIDEO_
CODEC_OK; |
| 177 } | 177 } |
| 178 | 178 |
| 179 - (RTCVideoEncoderQpThresholds *)scalingSettings { | 179 - (RTCVideoEncoderQpThresholds *)scalingSettings { |
| 180 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh
reshold | 180 return [[RTCVideoEncoderQpThresholds alloc] initWithThresholdsLow:kLowH264QpTh
reshold |
| 181 high:kHighH264QpT
hreshold]; | 181 high:kHighH264QpT
hreshold]; |
| 182 } | 182 } |
| 183 | 183 |
| 184 - (NSString *)implementationName { |
| 185 return @"VideoToolbox"; |
| 186 } |
| 187 |
| 184 @end | 188 @end |
| 185 | 189 |
| 186 // Decoder. | 190 // Decoder. |
| 187 @implementation RTCVideoDecoderH264 { | 191 @implementation RTCVideoDecoderH264 { |
| 188 webrtc::H264VideoToolboxDecoder *_videoToolboxDecoder; | 192 webrtc::H264VideoToolboxDecoder *_videoToolboxDecoder; |
| 189 H264VideoToolboxDecodeCompleteCallback *_toolboxCallback; | 193 H264VideoToolboxDecodeCompleteCallback *_toolboxCallback; |
| 190 } | 194 } |
| 191 | 195 |
| 192 - (instancetype)init { | 196 - (instancetype)init { |
| 193 if (self = [super init]) { | 197 if (self = [super init]) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 codecSpecificInfo = [(RTCCodecSpecificInfoH264 *)info nativeCodecSpecificInf
o]; | 244 codecSpecificInfo = [(RTCCodecSpecificInfoH264 *)info nativeCodecSpecificInf
o]; |
| 241 } | 245 } |
| 242 | 246 |
| 243 std::unique_ptr<webrtc::RTPFragmentationHeader> header = | 247 std::unique_ptr<webrtc::RTPFragmentationHeader> header = |
| 244 [fragmentationHeader createNativeFragmentationHeader]; | 248 [fragmentationHeader createNativeFragmentationHeader]; |
| 245 | 249 |
| 246 return _videoToolboxDecoder->Decode( | 250 return _videoToolboxDecoder->Decode( |
| 247 image, missingFrames, header.release(), &codecSpecificInfo, renderTimeMs); | 251 image, missingFrames, header.release(), &codecSpecificInfo, renderTimeMs); |
| 248 } | 252 } |
| 249 | 253 |
| 254 - (NSString *)implementationName { |
| 255 return @"VideoToolbox"; |
| 256 } |
| 257 |
| 250 @end | 258 @end |
| 251 | 259 |
| 252 // Encoder factory. | 260 // Encoder factory. |
| 253 @implementation RTCVideoEncoderFactoryH264 | 261 @implementation RTCVideoEncoderFactoryH264 |
| 254 | 262 |
| 255 - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { | 263 - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { |
| 256 NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array]; | 264 NSMutableArray<RTCVideoCodecInfo *> *codecs = [NSMutableArray array]; |
| 257 NSString *codecName = [NSString stringWithUTF8String:cricket::kH264CodecName]; | 265 NSString *codecName = [NSString stringWithUTF8String:cricket::kH264CodecName]; |
| 258 | 266 |
| 259 if (IsHighProfileEnabled()) { | 267 if (IsHighProfileEnabled()) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 - (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info { | 303 - (id<RTCVideoDecoder>)createDecoder:(RTCVideoCodecInfo *)info { |
| 296 return [[RTCVideoDecoderH264 alloc] init]; | 304 return [[RTCVideoDecoderH264 alloc] init]; |
| 297 } | 305 } |
| 298 | 306 |
| 299 - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { | 307 - (NSArray<RTCVideoCodecInfo *> *)supportedCodecs { |
| 300 NSString *codecName = [NSString stringWithUTF8String:cricket::kH264CodecName]; | 308 NSString *codecName = [NSString stringWithUTF8String:cricket::kH264CodecName]; |
| 301 return @[ [[RTCVideoCodecInfo alloc] initWithPayload:0 name:codecName paramete
rs:@{}] ]; | 309 return @[ [[RTCVideoCodecInfo alloc] initWithPayload:0 name:codecName paramete
rs:@{}] ]; |
| 302 } | 310 } |
| 303 | 311 |
| 304 @end | 312 @end |
| OLD | NEW |