OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved. | |
3 * | |
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 | |
6 * tree. An additional intellectual property rights grant can be found | |
7 * in the file PATENTS. All contributing project authors may | |
8 * be found in the AUTHORS file in the root of the source tree. | |
9 */ | |
10 | |
11 #import "WebRTC/RTCVideoCodec.h" | |
12 | |
13 #import "NSString+StdString.h" | |
14 #import "RTCVideoCodec+Private.h" | |
15 #import "WebRTC/RTCVideoCodecFactory.h" | |
16 | |
17 @implementation RTCVideoEncoderSettings | |
18 | |
19 @synthesize name = _name; | |
20 @synthesize width = _width; | |
21 @synthesize height = _height; | |
22 @synthesize startBitrate = _startBitrate; | |
23 @synthesize maxBitrate = _maxBitrate; | |
24 @synthesize minBitrate = _minBitrate; | |
25 @synthesize targetBitrate = _targetBitrate; | |
26 @synthesize maxFramerate = _maxFramerate; | |
27 @synthesize qpMax = _qpMax; | |
28 | |
29 - (instancetype)initWithVideoCodec:(const webrtc::VideoCodec *__nullable)videoCo dec { | |
Chuck
2017/07/21 15:59:48
initWithNativeVideoCode, no __nullable
| |
30 if (self = [super init]) { | |
31 if (videoCodec) { | |
32 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec- >codecType); | |
33 if (codecName) { | |
34 _name = [NSString stringWithUTF8String:codecName.value()]; | |
35 } | |
36 | |
37 _width = videoCodec->width; | |
38 _height = videoCodec->height; | |
39 _startBitrate = videoCodec->startBitrate; | |
40 _maxBitrate = videoCodec->maxBitrate; | |
41 _minBitrate = videoCodec->minBitrate; | |
42 _targetBitrate = videoCodec->targetBitrate; | |
43 _maxFramerate = videoCodec->maxFramerate; | |
44 _qpMax = videoCodec->qpMax; | |
45 } | |
46 } | |
47 | |
48 return self; | |
49 } | |
50 | |
51 - (std::unique_ptr<webrtc::VideoCodec>)toCpp { | |
Chuck
2017/07/21 15:59:48
createNativeVideoCodec
| |
52 auto codecSettings = std::unique_ptr<webrtc::VideoCodec>(new webrtc::VideoCode c); | |
53 | |
54 rtc::Optional<webrtc::VideoCodecType> codecType = | |
55 webrtc::PayloadNameToCodecType([NSString stdStringForString:_name]); | |
56 if (codecType) { | |
57 codecSettings->codecType = codecType.value(); | |
58 } | |
59 | |
60 codecSettings->width = _width; | |
61 codecSettings->height = _height; | |
62 codecSettings->startBitrate = _startBitrate; | |
63 codecSettings->maxBitrate = _maxBitrate; | |
64 codecSettings->minBitrate = _minBitrate; | |
65 codecSettings->targetBitrate = _targetBitrate; | |
66 codecSettings->maxFramerate = _maxFramerate; | |
67 codecSettings->qpMax = _qpMax; | |
68 | |
69 return codecSettings; | |
70 } | |
71 | |
72 @end | |
OLD | NEW |