blob: fd396b53815bacf2f4e144d7d0a3e108d1f60600 [file] [log] [blame]
denicijad17d5362016-11-02 02:56:09 -07001/*
2 * Copyright 2016 The WebRTC Project Authors. All rights reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
denicija2256e042016-11-09 06:26:18 -080011#import "ARDSettingsStore.h"
denicijad17d5362016-11-02 02:56:09 -070012
denicija9af2b602016-11-17 00:43:43 -080013static NSString *const kMediaConstraintsKey = @"rtc_video_resolution_media_constraints_key";
14static NSString *const kBitrateKey = @"rtc_max_bitrate_key";
denicijad17d5362016-11-02 02:56:09 -070015
16NS_ASSUME_NONNULL_BEGIN
denicija9af2b602016-11-17 00:43:43 -080017@interface ARDSettingsStore () {
18 NSUserDefaults *_storage;
19}
20@property(nonatomic, strong) NSUserDefaults *storage;
21@end
22
denicija2256e042016-11-09 06:26:18 -080023@implementation ARDSettingsStore
denicijad17d5362016-11-02 02:56:09 -070024
denicija9af2b602016-11-17 00:43:43 -080025- (NSUserDefaults *)storage {
26 if (!_storage) {
27 _storage = [NSUserDefaults standardUserDefaults];
28 }
29 return _storage;
denicijad17d5362016-11-02 02:56:09 -070030}
31
denicija9af2b602016-11-17 00:43:43 -080032- (nullable NSString *)videoResolutionConstraints {
33 return [self.storage objectForKey:kMediaConstraintsKey];
34}
35
36- (void)setVideoResolutionConstraints:(NSString *)constraintsString {
37 [self.storage setObject:constraintsString forKey:kMediaConstraintsKey];
38 [self.storage synchronize];
39}
40
41- (nullable NSNumber *)maxBitrate {
42 return [self.storage objectForKey:kBitrateKey];
43}
44
45- (void)setMaxBitrate:(nullable NSNumber *)value {
46 [self.storage setObject:value forKey:kBitrateKey];
47 [self.storage synchronize];
denicijad17d5362016-11-02 02:56:09 -070048}
49
50@end
51NS_ASSUME_NONNULL_END