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 |
11 #import "WebRTC/RTCVideoCodec.h" | 11 #import "WebRTC/RTCVideoCodec.h" |
12 | 12 |
13 #import "NSString+StdString.h" | 13 #import "NSString+StdString.h" |
14 #import "RTCVideoCodec+Private.h" | 14 #import "RTCVideoCodec+Private.h" |
15 #import "WebRTC/RTCVideoCodecFactory.h" | 15 #import "WebRTC/RTCVideoCodecFactory.h" |
16 | 16 |
17 @implementation RTCVideoEncoderSettings | 17 @implementation RTCVideoEncoderSettings |
18 | 18 |
19 @synthesize name = _name; | 19 @synthesize name = _name; |
20 @synthesize width = _width; | 20 @synthesize width = _width; |
21 @synthesize height = _height; | 21 @synthesize height = _height; |
22 @synthesize startBitrate = _startBitrate; | 22 @synthesize startBitrate = _startBitrate; |
23 @synthesize maxBitrate = _maxBitrate; | 23 @synthesize maxBitrate = _maxBitrate; |
24 @synthesize minBitrate = _minBitrate; | 24 @synthesize minBitrate = _minBitrate; |
25 @synthesize targetBitrate = _targetBitrate; | 25 @synthesize targetBitrate = _targetBitrate; |
26 @synthesize maxFramerate = _maxFramerate; | 26 @synthesize maxFramerate = _maxFramerate; |
27 @synthesize qpMax = _qpMax; | 27 @synthesize qpMax = _qpMax; |
| 28 @synthesize mode = _mode; |
28 | 29 |
29 - (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec
{ | 30 - (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec
{ |
30 if (self = [super init]) { | 31 if (self = [super init]) { |
31 if (videoCodec) { | 32 if (videoCodec) { |
32 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec-
>codecType); | 33 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec-
>codecType); |
33 if (codecName) { | 34 if (codecName) { |
34 _name = [NSString stringWithUTF8String:codecName.value()]; | 35 _name = [NSString stringWithUTF8String:codecName.value()]; |
35 } | 36 } |
36 | 37 |
37 _width = videoCodec->width; | 38 _width = videoCodec->width; |
38 _height = videoCodec->height; | 39 _height = videoCodec->height; |
39 _startBitrate = videoCodec->startBitrate; | 40 _startBitrate = videoCodec->startBitrate; |
40 _maxBitrate = videoCodec->maxBitrate; | 41 _maxBitrate = videoCodec->maxBitrate; |
41 _minBitrate = videoCodec->minBitrate; | 42 _minBitrate = videoCodec->minBitrate; |
42 _targetBitrate = videoCodec->targetBitrate; | 43 _targetBitrate = videoCodec->targetBitrate; |
43 _maxFramerate = videoCodec->maxFramerate; | 44 _maxFramerate = videoCodec->maxFramerate; |
44 _qpMax = videoCodec->qpMax; | 45 _qpMax = videoCodec->qpMax; |
| 46 _mode = (RTCVideoCodecMode)videoCodec->mode; |
45 } | 47 } |
46 } | 48 } |
47 | 49 |
48 return self; | 50 return self; |
49 } | 51 } |
50 | 52 |
51 - (std::unique_ptr<webrtc::VideoCodec>)createNativeVideoEncoderSettings { | |
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 | 53 @end |
OLD | NEW |