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

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

Issue 2479153002: Rename media constraints model and store. (Closed)
Patch Set: Created 4 years, 1 month 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 "ARDMediaConstraintsModel+Private.h" 11 #import "ARDSettingsModel+Private.h"
12 #import "ARDMediaConstraintsSettingsStore.h" 12 #import "ARDSettingsStore.h"
13 #import "WebRTC/RTCMediaConstraints.h" 13 #import "WebRTC/RTCMediaConstraints.h"
14 14
15 NS_ASSUME_NONNULL_BEGIN 15 NS_ASSUME_NONNULL_BEGIN
16 static NSArray<NSString *> *videoResolutionsStaticValues() { 16 static NSArray<NSString *> *videoResolutionsStaticValues() {
17 return @[ @"640x480", @"960x540", @"1280x720" ]; 17 return @[ @"640x480", @"960x540", @"1280x720" ];
18 } 18 }
19 19
20 @interface ARDMediaConstraintsModel () { 20 @interface ARDSettingsModel () {
21 ARDMediaConstraintsSettingsStore *_settingsStore; 21 ARDSettingsStore *_settingsStore;
22 NSNumber *_maximumBitrate;
magjed_webrtc 2016/11/07 13:47:32 Don't include this unrelated change in this CL.
daniela-webrtc 2016/11/07 14:45:39 It got away :) Thanks!
22 } 23 }
23 @end 24 @end
24 25
25 @implementation ARDMediaConstraintsModel 26 @implementation ARDSettingsModel
26 27
27 - (NSArray<NSString *> *)availableVideoResoultionsMediaConstraints { 28 - (NSArray<NSString *> *)availableVideoResoultionsMediaConstraints {
28 return videoResolutionsStaticValues(); 29 return videoResolutionsStaticValues();
29 } 30 }
30 31
31 - (NSString *)currentVideoResoultionConstraintFromStore { 32 - (NSString *)currentVideoResoultionConstraintFromStore {
32 NSString *constraint = [[self settingsStore] videoResolutionConstraintsSetting ]; 33 NSString *constraint = [[self settingsStore] videoResolutionConstraintsSetting ];
33 if (!constraint) { 34 if (!constraint) {
34 constraint = [self defaultVideoResolutionMediaConstraint]; 35 constraint = [self defaultVideoResolutionMediaConstraint];
35 // To ensure consistency add the default to the store. 36 // To ensure consistency add the default to the store.
36 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint]; 37 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint];
37 } 38 }
38 return constraint; 39 return constraint;
39 } 40 }
40 41
41 - (BOOL)storeVideoResoultionConstraint:(NSString *)constraint { 42 - (BOOL)storeVideoResoultionConstraint:(NSString *)constraint {
42 if (![[self availableVideoResoultionsMediaConstraints] containsObject:constrai nt]) { 43 if (![[self availableVideoResoultionsMediaConstraints] containsObject:constrai nt]) {
43 return NO; 44 return NO;
44 } 45 }
45 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint]; 46 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint];
46 return YES; 47 return YES;
47 } 48 }
48 49
49 #pragma mark - Testable 50 #pragma mark - Testable
50 51
51 - (ARDMediaConstraintsSettingsStore *)settingsStore { 52 - (ARDSettingsStore *)settingsStore {
52 if (!_settingsStore) { 53 if (!_settingsStore) {
53 _settingsStore = [[ARDMediaConstraintsSettingsStore alloc] init]; 54 _settingsStore = [[ARDSettingsStore alloc] init];
54 } 55 }
55 return _settingsStore; 56 return _settingsStore;
56 } 57 }
57 58
58 - (nullable NSString *)currentVideoResolutionWidthFromStore { 59 - (nullable NSString *)currentVideoResolutionWidthFromStore {
59 NSString *mediaConstraintFromStore = [self currentVideoResoultionConstraintFro mStore]; 60 NSString *mediaConstraintFromStore = [self currentVideoResoultionConstraintFro mStore];
60 61
61 return [self videoResolutionComponentAtIndex:0 inConstraintsString:mediaConstr aintFromStore]; 62 return [self videoResolutionComponentAtIndex:0 inConstraintsString:mediaConstr aintFromStore];
62 } 63 }
63 64
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 mediaConstraintsDictionary = @{ 96 mediaConstraintsDictionary = @{
96 kRTCMediaConstraintsMinWidth : widthConstraint, 97 kRTCMediaConstraintsMinWidth : widthConstraint,
97 kRTCMediaConstraintsMinHeight : heightConstraint 98 kRTCMediaConstraintsMinHeight : heightConstraint
98 }; 99 };
99 } 100 }
100 return mediaConstraintsDictionary; 101 return mediaConstraintsDictionary;
101 } 102 }
102 103
103 @end 104 @end
104 NS_ASSUME_NONNULL_END 105 NS_ASSUME_NONNULL_END
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698