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

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

Issue 2989803002: ObjC style fix for injectable video codecs (Closed)
Patch Set: Created 3 years, 4 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
OLDNEW
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 28
29 - (instancetype)initWithVideoCodec:(const webrtc::VideoCodec *__nullable)videoCo dec { 29 - (instancetype)initWithNativeVideoCodec:(const webrtc::VideoCodec *)videoCodec {
30 if (self = [super init]) { 30 if (self = [super init]) {
31 if (videoCodec) { 31 if (videoCodec) {
32 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec- >codecType); 32 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec- >codecType);
33 if (codecName) { 33 if (codecName) {
34 _name = [NSString stringWithUTF8String:codecName.value()]; 34 _name = [NSString stringWithUTF8String:codecName.value()];
35 } 35 }
36 36
37 _width = videoCodec->width; 37 _width = videoCodec->width;
38 _height = videoCodec->height; 38 _height = videoCodec->height;
39 _startBitrate = videoCodec->startBitrate; 39 _startBitrate = videoCodec->startBitrate;
40 _maxBitrate = videoCodec->maxBitrate; 40 _maxBitrate = videoCodec->maxBitrate;
41 _minBitrate = videoCodec->minBitrate; 41 _minBitrate = videoCodec->minBitrate;
42 _targetBitrate = videoCodec->targetBitrate; 42 _targetBitrate = videoCodec->targetBitrate;
43 _maxFramerate = videoCodec->maxFramerate; 43 _maxFramerate = videoCodec->maxFramerate;
44 _qpMax = videoCodec->qpMax; 44 _qpMax = videoCodec->qpMax;
45 } 45 }
46 } 46 }
47 47
48 return self; 48 return self;
49 } 49 }
50 50
51 - (std::unique_ptr<webrtc::VideoCodec>)toCpp { 51 - (std::unique_ptr<webrtc::VideoCodec>)createNativeVideoEncoderSettings {
52 auto codecSettings = std::unique_ptr<webrtc::VideoCodec>(new webrtc::VideoCode c); 52 auto codecSettings = std::unique_ptr<webrtc::VideoCodec>(new webrtc::VideoCode c);
53 53
54 rtc::Optional<webrtc::VideoCodecType> codecType = 54 rtc::Optional<webrtc::VideoCodecType> codecType =
55 webrtc::PayloadNameToCodecType([NSString stdStringForString:_name]); 55 webrtc::PayloadNameToCodecType([NSString stdStringForString:_name]);
56 if (codecType) { 56 if (codecType) {
57 codecSettings->codecType = codecType.value(); 57 codecSettings->codecType = codecType.value();
58 } 58 }
59 59
60 codecSettings->width = _width; 60 codecSettings->width = _width;
61 codecSettings->height = _height; 61 codecSettings->height = _height;
62 codecSettings->startBitrate = _startBitrate; 62 codecSettings->startBitrate = _startBitrate;
63 codecSettings->maxBitrate = _maxBitrate; 63 codecSettings->maxBitrate = _maxBitrate;
64 codecSettings->minBitrate = _minBitrate; 64 codecSettings->minBitrate = _minBitrate;
65 codecSettings->targetBitrate = _targetBitrate; 65 codecSettings->targetBitrate = _targetBitrate;
66 codecSettings->maxFramerate = _maxFramerate; 66 codecSettings->maxFramerate = _maxFramerate;
67 codecSettings->qpMax = _qpMax; 67 codecSettings->qpMax = _qpMax;
68 68
69 return codecSettings; 69 return codecSettings;
70 } 70 }
71 71
72 @end 72 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698