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

Side by Side Diff: webrtc/examples/objc/AppRTCMobile/ios/ARDSettingsViewController.m

Issue 2778163005: Use new RTCCameraVideoCapturer in AppRTCMobile. (Closed)
Patch Set: Remove localCapturer property from ARDVideoCallViewController. Created 3 years, 8 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 2016 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2016 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 "ARDSettingsViewController.h" 11 #import "ARDSettingsViewController.h"
12 #import "ARDSettingsModel.h" 12 #import "ARDSettingsModel.h"
13 13
14 NS_ASSUME_NONNULL_BEGIN 14 NS_ASSUME_NONNULL_BEGIN
15 15
16 typedef NS_ENUM(int, ARDSettingsSections) { 16 typedef NS_ENUM(int, ARDSettingsSections) {
17 ARDSettingsSectionMediaConstraints = 0, 17 ARDSettingsSectionVideoResolution = 0,
18 ARDSettingsSectionVideoCodec, 18 ARDSettingsSectionVideoCodec,
19 ARDSettingsSectionBitRate, 19 ARDSettingsSectionBitRate,
20 }; 20 };
21 21
22 @interface ARDSettingsViewController () <UITextFieldDelegate> { 22 @interface ARDSettingsViewController () <UITextFieldDelegate> {
23 ARDSettingsModel *_settingsModel; 23 ARDSettingsModel *_settingsModel;
24 } 24 }
25 25
26 @end 26 @end
27 27
(...skipping 11 matching lines...) Expand all
39 #pragma mark - View lifecycle 39 #pragma mark - View lifecycle
40 40
41 - (void)viewDidLoad { 41 - (void)viewDidLoad {
42 [super viewDidLoad]; 42 [super viewDidLoad];
43 self.title = @"Settings"; 43 self.title = @"Settings";
44 [self addDoneBarButton]; 44 [self addDoneBarButton];
45 } 45 }
46 46
47 - (void)viewWillAppear:(BOOL)animated { 47 - (void)viewWillAppear:(BOOL)animated {
48 [super viewWillAppear:animated]; 48 [super viewWillAppear:animated];
49 [self addCheckmarkInSection:ARDSettingsSectionMediaConstraints 49 [self addCheckmarkInSection:ARDSettingsSectionVideoResolution
50 withArray:[self mediaConstraintsArray] 50 withArray:[self videoResolutionArray]
51 selecting:[_settingsModel currentVideoResoultionConstraintFr omStore]]; 51 selecting:[_settingsModel currentVideoResolutionSettingFromS tore]];
52 [self addCheckmarkInSection:ARDSettingsSectionVideoCodec 52 [self addCheckmarkInSection:ARDSettingsSectionVideoCodec
53 withArray:[self videoCodecArray] 53 withArray:[self videoCodecArray]
54 selecting:[_settingsModel currentVideoCodecSettingFromStore] ]; 54 selecting:[_settingsModel currentVideoCodecSettingFromStore] ];
55 } 55 }
56 56
57 - (void)viewDidAppear:(BOOL)animated { 57 - (void)viewDidAppear:(BOOL)animated {
58 [super viewDidAppear:animated]; 58 [super viewDidAppear:animated];
59 } 59 }
60 60
61 #pragma mark - Data source 61 #pragma mark - Data source
62 62
63 - (NSArray<NSString *> *)mediaConstraintsArray { 63 - (NSArray<NSString *> *)videoResolutionArray {
64 return _settingsModel.availableVideoResoultionsMediaConstraints; 64 return _settingsModel.availableVideoResolutions;
65 } 65 }
66 66
67 - (NSArray<NSString *> *)videoCodecArray { 67 - (NSArray<NSString *> *)videoCodecArray {
68 return _settingsModel.availableVideoCodecs; 68 return _settingsModel.availableVideoCodecs;
69 } 69 }
70 70
71 #pragma mark - 71 #pragma mark -
72 72
73 - (void)addDoneBarButton { 73 - (void)addDoneBarButton {
74 UIBarButtonItem *barItem = 74 UIBarButtonItem *barItem =
(...skipping 20 matching lines...) Expand all
95 } 95 }
96 96
97 #pragma mark - Table view data source 97 #pragma mark - Table view data source
98 98
99 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 99 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
100 return 3; 100 return 3;
101 } 101 }
102 102
103 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section { 103 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger )section {
104 switch (section) { 104 switch (section) {
105 case ARDSettingsSectionMediaConstraints: 105 case ARDSettingsSectionVideoResolution:
106 return self.mediaConstraintsArray.count; 106 return self.videoResolutionArray.count;
107 case ARDSettingsSectionVideoCodec: 107 case ARDSettingsSectionVideoCodec:
108 return self.videoCodecArray.count; 108 return self.videoCodecArray.count;
109 default: 109 default:
110 return 1; 110 return 1;
111 } 111 }
112 } 112 }
113 113
114 #pragma mark - Table view delegate helpers 114 #pragma mark - Table view delegate helpers
115 115
116 - (void)removeAllAccessories:(UITableView *)tableView 116 - (void)removeAllAccessories:(UITableView *)tableView
(...skipping 13 matching lines...) Expand all
130 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath]; 130 UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
131 cell.accessoryType = UITableViewCellAccessoryCheckmark; 131 cell.accessoryType = UITableViewCellAccessoryCheckmark;
132 [tableView deselectRowAtIndexPath:indexPath animated:YES]; 132 [tableView deselectRowAtIndexPath:indexPath animated:YES];
133 } 133 }
134 134
135 #pragma mark - Table view delegate 135 #pragma mark - Table view delegate
136 136
137 - (nullable NSString *)tableView:(UITableView *)tableView 137 - (nullable NSString *)tableView:(UITableView *)tableView
138 titleForHeaderInSection:(NSInteger)section { 138 titleForHeaderInSection:(NSInteger)section {
139 switch (section) { 139 switch (section) {
140 case ARDSettingsSectionMediaConstraints: 140 case ARDSettingsSectionVideoResolution:
141 return @"Media constraints"; 141 return @"Video resolution";
142 case ARDSettingsSectionVideoCodec: 142 case ARDSettingsSectionVideoCodec:
143 return @"Video codec"; 143 return @"Video codec";
144 case ARDSettingsSectionBitRate: 144 case ARDSettingsSectionBitRate:
145 return @"Maximum bitrate"; 145 return @"Maximum bitrate";
146 default: 146 default:
147 return @""; 147 return @"";
148 } 148 }
149 } 149 }
150 150
151 - (UITableViewCell *)tableView:(UITableView *)tableView 151 - (UITableViewCell *)tableView:(UITableView *)tableView
152 cellForRowAtIndexPath:(NSIndexPath *)indexPath { 152 cellForRowAtIndexPath:(NSIndexPath *)indexPath {
153 switch (indexPath.section) { 153 switch (indexPath.section) {
154 case ARDSettingsSectionMediaConstraints: 154 case ARDSettingsSectionVideoResolution:
155 return [self mediaConstraintsTableViewCellForTableView:tableView atIndexPa th:indexPath]; 155 return [self videoResolutionTableViewCellForTableView:tableView atIndexPat h:indexPath];
156 156
157 case ARDSettingsSectionVideoCodec: 157 case ARDSettingsSectionVideoCodec:
158 return [self videoCodecTableViewCellForTableView:tableView atIndexPath:ind exPath]; 158 return [self videoCodecTableViewCellForTableView:tableView atIndexPath:ind exPath];
159 159
160 case ARDSettingsSectionBitRate: 160 case ARDSettingsSectionBitRate:
161 return [self bitrateTableViewCellForTableView:tableView atIndexPath:indexP ath]; 161 return [self bitrateTableViewCellForTableView:tableView atIndexPath:indexP ath];
162 162
163 default: 163 default:
164 return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 164 return [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
165 reuseIdentifier:@"identifier"]; 165 reuseIdentifier:@"identifier"];
166 } 166 }
167 } 167 }
168 168
169 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 169 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
170 switch (indexPath.section) { 170 switch (indexPath.section) {
171 case ARDSettingsSectionMediaConstraints: 171 case ARDSettingsSectionVideoResolution:
172 [self tableView:tableView didSelectMediaConstraintsCellAtIndexPath:indexPa th]; 172 [self tableView:tableView disSelectVideoResolutionAtIndex:indexPath];
173 break; 173 break;
174 174
175 case ARDSettingsSectionVideoCodec: 175 case ARDSettingsSectionVideoCodec:
176 [self tableView:tableView didSelectVideoCodecCellAtIndexPath:indexPath]; 176 [self tableView:tableView didSelectVideoCodecCellAtIndexPath:indexPath];
177 break; 177 break;
178 } 178 }
179 } 179 }
180 180
181 #pragma mark - Table view delegate(Media Constraints) 181 #pragma mark - Table view delegate(Video Resolution)
182 182
183 - (UITableViewCell *)mediaConstraintsTableViewCellForTableView:(UITableView *)ta bleView 183 - (UITableViewCell *)videoResolutionTableViewCellForTableView:(UITableView *)tab leView
184 atIndexPath:(NSIndexPath *)in dexPath { 184 atIndexPath:(NSIndexPath *)ind exPath {
185 NSString *dequeueIdentifier = @"ARDSettingsMediaConstraintsViewCellIdentifier" ; 185 NSString *dequeueIdentifier = @"ARDSettingsVideoResolutionViewCellIdentifier";
186 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dequeueId entifier]; 186 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dequeueId entifier];
187 if (!cell) { 187 if (!cell) {
188 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 188 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
189 reuseIdentifier:dequeueIdentifier]; 189 reuseIdentifier:dequeueIdentifier];
190 } 190 }
191 cell.textLabel.text = self.mediaConstraintsArray[indexPath.row]; 191 cell.textLabel.text = self.videoResolutionArray[indexPath.row];
192 return cell; 192 return cell;
193 } 193 }
194 194
195 - (void)tableView:(UITableView *)tableView 195 - (void)tableView:(UITableView *)tableView
196 didSelectMediaConstraintsCellAtIndexPath:(NSIndexPath *)indexPath { 196 disSelectVideoResolutionAtIndex:(NSIndexPath *)indexPath {
197 [self tableView:tableView 197 [self tableView:tableView
198 updateListSelectionAtIndexPath:indexPath 198 updateListSelectionAtIndexPath:indexPath
199 inSection:ARDSettingsSectionMediaConstraints]; 199 inSection:ARDSettingsSectionVideoResolution];
200 200
201 NSString *mediaConstraintsString = self.mediaConstraintsArray[indexPath.row]; 201 NSString *videoResolution = self.videoResolutionArray[indexPath.row];
202 [_settingsModel storeVideoResoultionConstraint:mediaConstraintsString]; 202 [_settingsModel storeVideoResolutionSetting:videoResolution];
203 } 203 }
204 204
205 #pragma mark - Table view delegate(Video Codec) 205 #pragma mark - Table view delegate(Video Codec)
206 206
207 - (UITableViewCell *)videoCodecTableViewCellForTableView:(UITableView *)tableVie w 207 - (UITableViewCell *)videoCodecTableViewCellForTableView:(UITableView *)tableVie w
208 atIndexPath:(NSIndexPath *)indexPat h { 208 atIndexPath:(NSIndexPath *)indexPat h {
209 NSString *dequeueIdentifier = @"ARDSettingsVideoCodecCellIdentifier"; 209 NSString *dequeueIdentifier = @"ARDSettingsVideoCodecCellIdentifier";
210 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dequeueId entifier]; 210 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:dequeueId entifier];
211 if (!cell) { 211 if (!cell) {
212 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault 212 cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 if (textField.text.length != 0) { 275 if (textField.text.length != 0) {
276 bitrateNumber = [NSNumber numberWithInteger:textField.text.intValue]; 276 bitrateNumber = [NSNumber numberWithInteger:textField.text.intValue];
277 } 277 }
278 278
279 [_settingsModel storeMaxBitrateSetting:bitrateNumber]; 279 [_settingsModel storeMaxBitrateSetting:bitrateNumber];
280 } 280 }
281 281
282 @end 282 @end
283 NS_ASSUME_NONNULL_END 283 NS_ASSUME_NONNULL_END
OLDNEW
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ARDSettingsStore.m ('k') | webrtc/examples/objc/AppRTCMobile/ios/ARDVideoCallView.m » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698