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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/Video/RTCVideoCodec.mm

Issue 2978623002: Implement H264 codec in Objective-C classes. (Closed)
Patch Set: Fix test after rebase. Created 3 years, 5 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
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 @synthesize name = _name; 61 @synthesize name = _name;
62 @synthesize width = _width; 62 @synthesize width = _width;
63 @synthesize height = _height; 63 @synthesize height = _height;
64 @synthesize startBitrate = _startBitrate; 64 @synthesize startBitrate = _startBitrate;
65 @synthesize maxBitrate = _maxBitrate; 65 @synthesize maxBitrate = _maxBitrate;
66 @synthesize minBitrate = _minBitrate; 66 @synthesize minBitrate = _minBitrate;
67 @synthesize targetBitrate = _targetBitrate; 67 @synthesize targetBitrate = _targetBitrate;
68 @synthesize maxFramerate = _maxFramerate; 68 @synthesize maxFramerate = _maxFramerate;
69 @synthesize qpMax = _qpMax; 69 @synthesize qpMax = _qpMax;
70 @synthesize mode = _mode;
70 71
71 - (instancetype)initWithVideoCodec:(const webrtc::VideoCodec *__nullable)videoCo dec { 72 - (instancetype)initWithVideoCodec:(const webrtc::VideoCodec *__nullable)videoCo dec {
72 if (self = [super init]) { 73 if (self = [super init]) {
73 if (videoCodec) { 74 if (videoCodec) {
74 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec- >codecType); 75 rtc::Optional<const char *> codecName = CodecTypeToPayloadName(videoCodec- >codecType);
75 if (codecName) { 76 if (codecName) {
76 _name = [NSString stringWithUTF8String:codecName.value()]; 77 _name = [NSString stringWithUTF8String:codecName.value()];
77 } 78 }
78 79
79 _width = videoCodec->width; 80 _width = videoCodec->width;
80 _height = videoCodec->height; 81 _height = videoCodec->height;
81 _startBitrate = videoCodec->startBitrate; 82 _startBitrate = videoCodec->startBitrate;
82 _maxBitrate = videoCodec->maxBitrate; 83 _maxBitrate = videoCodec->maxBitrate;
83 _minBitrate = videoCodec->minBitrate; 84 _minBitrate = videoCodec->minBitrate;
84 _targetBitrate = videoCodec->targetBitrate; 85 _targetBitrate = videoCodec->targetBitrate;
85 _maxFramerate = videoCodec->maxFramerate; 86 _maxFramerate = videoCodec->maxFramerate;
86 _qpMax = videoCodec->qpMax; 87 _qpMax = videoCodec->qpMax;
88 _mode = (RTCVideoCodecMode)videoCodec->mode;
87 } 89 }
88 } 90 }
89 91
90 return self; 92 return self;
91 } 93 }
92 94
93 - (webrtc::VideoCodec *)toCpp { 95 - (webrtc::VideoCodec *)toCpp {
94 webrtc::VideoCodec *codecSettings = new webrtc::VideoCodec; 96 webrtc::VideoCodec *codecSettings = new webrtc::VideoCodec;
95 97
96 rtc::Optional<webrtc::VideoCodecType> codecType = 98 rtc::Optional<webrtc::VideoCodecType> codecType =
97 webrtc::PayloadNameToCodecType(webrtc::ios::StdStringFromNSString(_name)); 99 webrtc::PayloadNameToCodecType(webrtc::ios::StdStringFromNSString(_name));
98 if (codecType) { 100 if (codecType) {
99 codecSettings->codecType = codecType.value(); 101 codecSettings->codecType = codecType.value();
100 } 102 }
101 103
102 codecSettings->width = _width; 104 codecSettings->width = _width;
103 codecSettings->height = _height; 105 codecSettings->height = _height;
104 codecSettings->startBitrate = _startBitrate; 106 codecSettings->startBitrate = _startBitrate;
105 codecSettings->maxBitrate = _maxBitrate; 107 codecSettings->maxBitrate = _maxBitrate;
106 codecSettings->minBitrate = _minBitrate; 108 codecSettings->minBitrate = _minBitrate;
107 codecSettings->targetBitrate = _targetBitrate; 109 codecSettings->targetBitrate = _targetBitrate;
108 codecSettings->maxFramerate = _maxFramerate; 110 codecSettings->maxFramerate = _maxFramerate;
109 codecSettings->qpMax = _qpMax; 111 codecSettings->qpMax = _qpMax;
112 codecSettings->mode = (webrtc::VideoCodecMode)_mode;
110 113
111 return codecSettings; 114 return codecSettings;
112 } 115 }
113 116
114 @end 117 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698