2016-11-02 02:56:09 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright 2016 The WebRTC Project Authors. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
2016-11-09 06:26:18 -08:00
|
|
|
#import "ARDSettingsStore.h"
|
2016-11-02 02:56:09 -07:00
|
|
|
|
2016-11-17 00:43:43 -08:00
|
|
|
static NSString *const kMediaConstraintsKey = @"rtc_video_resolution_media_constraints_key";
|
2017-03-17 09:01:59 -07:00
|
|
|
static NSString *const kVideoCodecKey = @"rtc_video_codec_key";
|
2016-11-17 00:43:43 -08:00
|
|
|
static NSString *const kBitrateKey = @"rtc_max_bitrate_key";
|
2016-11-02 02:56:09 -07:00
|
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
2016-11-17 00:43:43 -08:00
|
|
|
@interface ARDSettingsStore () {
|
|
|
|
|
NSUserDefaults *_storage;
|
|
|
|
|
}
|
|
|
|
|
@property(nonatomic, strong) NSUserDefaults *storage;
|
|
|
|
|
@end
|
|
|
|
|
|
2016-11-09 06:26:18 -08:00
|
|
|
@implementation ARDSettingsStore
|
2016-11-02 02:56:09 -07:00
|
|
|
|
2016-11-17 00:43:43 -08:00
|
|
|
- (NSUserDefaults *)storage {
|
|
|
|
|
if (!_storage) {
|
|
|
|
|
_storage = [NSUserDefaults standardUserDefaults];
|
|
|
|
|
}
|
|
|
|
|
return _storage;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (nullable NSString *)videoResolutionConstraints {
|
|
|
|
|
return [self.storage objectForKey:kMediaConstraintsKey];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setVideoResolutionConstraints:(NSString *)constraintsString {
|
|
|
|
|
[self.storage setObject:constraintsString forKey:kMediaConstraintsKey];
|
|
|
|
|
[self.storage synchronize];
|
|
|
|
|
}
|
|
|
|
|
|
2017-03-17 09:01:59 -07:00
|
|
|
- (NSString *)videoCodec {
|
|
|
|
|
return [self.storage objectForKey:kVideoCodecKey];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
- (void)setVideoCodec:(NSString *)videoCodec {
|
|
|
|
|
[self.storage setObject:videoCodec forKey:kVideoCodecKey];
|
|
|
|
|
[self.storage synchronize];
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-17 00:43:43 -08:00
|
|
|
- (nullable NSNumber *)maxBitrate {
|
|
|
|
|
return [self.storage objectForKey:kBitrateKey];
|
2016-11-02 02:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
2016-11-17 00:43:43 -08:00
|
|
|
- (void)setMaxBitrate:(nullable NSNumber *)value {
|
|
|
|
|
[self.storage setObject:value forKey:kBitrateKey];
|
|
|
|
|
[self.storage synchronize];
|
2016-11-02 02:56:09 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
NS_ASSUME_NONNULL_END
|