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 |
11 #import "ARDSettingsStore.h" | 11 #import "ARDSettingsStore.h" |
12 | 12 |
13 static NSString *const kMediaConstraintsKey = @"rtc_video_resolution_media_const
raints_key"; | 13 static NSString *const kVideoResolutionKey = @"rtc_video_resolution_key"; |
14 static NSString *const kVideoCodecKey = @"rtc_video_codec_key"; | 14 static NSString *const kVideoCodecKey = @"rtc_video_codec_key"; |
15 static NSString *const kBitrateKey = @"rtc_max_bitrate_key"; | 15 static NSString *const kBitrateKey = @"rtc_max_bitrate_key"; |
16 | 16 |
17 NS_ASSUME_NONNULL_BEGIN | 17 NS_ASSUME_NONNULL_BEGIN |
18 @interface ARDSettingsStore () { | 18 @interface ARDSettingsStore () { |
19 NSUserDefaults *_storage; | 19 NSUserDefaults *_storage; |
20 } | 20 } |
21 @property(nonatomic, strong, readonly) NSUserDefaults *storage; | 21 @property(nonatomic, strong, readonly) NSUserDefaults *storage; |
22 @end | 22 @end |
23 | 23 |
24 @implementation ARDSettingsStore | 24 @implementation ARDSettingsStore |
25 | 25 |
26 - (NSUserDefaults *)storage { | 26 - (NSUserDefaults *)storage { |
27 if (!_storage) { | 27 if (!_storage) { |
28 _storage = [NSUserDefaults standardUserDefaults]; | 28 _storage = [NSUserDefaults standardUserDefaults]; |
29 } | 29 } |
30 return _storage; | 30 return _storage; |
31 } | 31 } |
32 | 32 |
33 - (nullable NSString *)videoResolutionConstraints { | 33 - (NSString *)videoResolution { |
34 return [self.storage objectForKey:kMediaConstraintsKey]; | 34 return [self.storage objectForKey:kVideoResolutionKey]; |
35 } | 35 } |
36 | 36 |
37 - (void)setVideoResolutionConstraints:(NSString *)constraintsString { | 37 - (void)setVideoResolution:(NSString *)resolution { |
38 [self.storage setObject:constraintsString forKey:kMediaConstraintsKey]; | 38 [self.storage setObject:resolution forKey:kVideoResolutionKey]; |
39 [self.storage synchronize]; | 39 [self.storage synchronize]; |
40 } | 40 } |
41 | 41 |
42 - (NSString *)videoCodec { | 42 - (NSString *)videoCodec { |
43 return [self.storage objectForKey:kVideoCodecKey]; | 43 return [self.storage objectForKey:kVideoCodecKey]; |
44 } | 44 } |
45 | 45 |
46 - (void)setVideoCodec:(NSString *)videoCodec { | 46 - (void)setVideoCodec:(NSString *)videoCodec { |
47 [self.storage setObject:videoCodec forKey:kVideoCodecKey]; | 47 [self.storage setObject:videoCodec forKey:kVideoCodecKey]; |
48 [self.storage synchronize]; | 48 [self.storage synchronize]; |
49 } | 49 } |
50 | 50 |
51 - (nullable NSNumber *)maxBitrate { | 51 - (nullable NSNumber *)maxBitrate { |
52 return [self.storage objectForKey:kBitrateKey]; | 52 return [self.storage objectForKey:kBitrateKey]; |
53 } | 53 } |
54 | 54 |
55 - (void)setMaxBitrate:(nullable NSNumber *)value { | 55 - (void)setMaxBitrate:(nullable NSNumber *)value { |
56 [self.storage setObject:value forKey:kBitrateKey]; | 56 [self.storage setObject:value forKey:kBitrateKey]; |
57 [self.storage synchronize]; | 57 [self.storage synchronize]; |
58 } | 58 } |
59 | 59 |
60 @end | 60 @end |
61 NS_ASSUME_NONNULL_END | 61 NS_ASSUME_NONNULL_END |
OLD | NEW |