| OLD | NEW |
| 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 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 @end | 23 @end |
| 24 | 24 |
| 25 @implementation ARDSettingsModel | 25 @implementation ARDSettingsModel |
| 26 | 26 |
| 27 - (NSArray<NSString *> *)availableVideoResoultionsMediaConstraints { | 27 - (NSArray<NSString *> *)availableVideoResoultionsMediaConstraints { |
| 28 return videoResolutionsStaticValues(); | 28 return videoResolutionsStaticValues(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 - (NSString *)currentVideoResoultionConstraintFromStore { | 31 - (NSString *)currentVideoResoultionConstraintFromStore { |
| 32 NSString *constraint = [[self settingsStore] videoResolutionConstraintsSetting
]; | 32 NSString *constraint = [[self settingsStore] videoResolutionConstraints]; |
| 33 if (!constraint) { | 33 if (!constraint) { |
| 34 constraint = [self defaultVideoResolutionMediaConstraint]; | 34 constraint = [self defaultVideoResolutionMediaConstraint]; |
| 35 // To ensure consistency add the default to the store. | 35 // To ensure consistency add the default to the store. |
| 36 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint]; | 36 [[self settingsStore] setVideoResolutionConstraints:constraint]; |
| 37 } | 37 } |
| 38 return constraint; | 38 return constraint; |
| 39 } | 39 } |
| 40 | 40 |
| 41 - (BOOL)storeVideoResoultionConstraint:(NSString *)constraint { | 41 - (BOOL)storeVideoResoultionConstraint:(NSString *)constraint { |
| 42 if (![[self availableVideoResoultionsMediaConstraints] containsObject:constrai
nt]) { | 42 if (![[self availableVideoResoultionsMediaConstraints] containsObject:constrai
nt]) { |
| 43 return NO; | 43 return NO; |
| 44 } | 44 } |
| 45 [[self settingsStore] setVideoResolutionConstraintsSetting:constraint]; | 45 [[self settingsStore] setVideoResolutionConstraints:constraint]; |
| 46 return YES; | 46 return YES; |
| 47 } | 47 } |
| 48 | 48 |
| 49 - (nullable NSNumber *)currentMaxBitrateSettingFromStore { |
| 50 return [[self settingsStore] maxBitrate]; |
| 51 } |
| 52 |
| 53 - (void)storeMaxBitrateSetting:(nullable NSNumber *)bitrate { |
| 54 [[self settingsStore] setMaxBitrate:bitrate]; |
| 55 } |
| 56 |
| 49 #pragma mark - Testable | 57 #pragma mark - Testable |
| 50 | 58 |
| 51 - (ARDSettingsStore *)settingsStore { | 59 - (ARDSettingsStore *)settingsStore { |
| 52 if (!_settingsStore) { | 60 if (!_settingsStore) { |
| 53 _settingsStore = [[ARDSettingsStore alloc] init]; | 61 _settingsStore = [[ARDSettingsStore alloc] init]; |
| 54 } | 62 } |
| 55 return _settingsStore; | 63 return _settingsStore; |
| 56 } | 64 } |
| 57 | 65 |
| 58 - (nullable NSString *)currentVideoResolutionWidthFromStore { | 66 - (nullable NSString *)currentVideoResolutionWidthFromStore { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 mediaConstraintsDictionary = @{ | 103 mediaConstraintsDictionary = @{ |
| 96 kRTCMediaConstraintsMinWidth : widthConstraint, | 104 kRTCMediaConstraintsMinWidth : widthConstraint, |
| 97 kRTCMediaConstraintsMinHeight : heightConstraint | 105 kRTCMediaConstraintsMinHeight : heightConstraint |
| 98 }; | 106 }; |
| 99 } | 107 } |
| 100 return mediaConstraintsDictionary; | 108 return mediaConstraintsDictionary; |
| 101 } | 109 } |
| 102 | 110 |
| 103 @end | 111 @end |
| 104 NS_ASSUME_NONNULL_END | 112 NS_ASSUME_NONNULL_END |
| OLD | NEW |