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

Unified Diff: webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m

Issue 2778163005: Use new RTCCameraVideoCapturer in AppRTCMobile. (Closed)
Patch Set: Remove localCapturer property from ARDVideoCallViewController. Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m
diff --git a/webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m b/webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m
index 7514689add53b0d5ee747aeae930f0c27a977a13..ecb6ab344b9d5c2676a90b29ef546d9b8cdc1ace 100644
--- a/webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m
+++ b/webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.m
@@ -28,25 +28,25 @@ static NSArray<NSString *> *videoCodecsStaticValues() {
@implementation ARDSettingsModel
-- (NSArray<NSString *> *)availableVideoResoultionsMediaConstraints {
+- (NSArray<NSString *> *)availableVideoResolutions {
return videoResolutionsStaticValues();
}
-- (NSString *)currentVideoResoultionConstraintFromStore {
- NSString *constraint = [[self settingsStore] videoResolutionConstraints];
- if (!constraint) {
- constraint = [self defaultVideoResolutionMediaConstraint];
+- (NSString *)currentVideoResolutionSettingFromStore {
+ NSString *resolution = [[self settingsStore] videoResolution];
+ if (!resolution) {
+ resolution = [self defaultVideoResolutionSetting];
// To ensure consistency add the default to the store.
- [[self settingsStore] setVideoResolutionConstraints:constraint];
+ [[self settingsStore] setVideoResolution:resolution];
}
- return constraint;
+ return resolution;
}
-- (BOOL)storeVideoResoultionConstraint:(NSString *)constraint {
- if (![[self availableVideoResoultionsMediaConstraints] containsObject:constraint]) {
+- (BOOL)storeVideoResolutionSetting:(NSString *)resolution {
+ if (![[self availableVideoResolutions] containsObject:resolution]) {
return NO;
}
- [[self settingsStore] setVideoResolutionConstraints:constraint];
+ [[self settingsStore] setVideoResolution:resolution];
return YES;
}
@@ -88,54 +88,37 @@ static NSArray<NSString *> *videoCodecsStaticValues() {
return _settingsStore;
}
-- (nullable NSString *)currentVideoResolutionWidthFromStore {
- NSString *mediaConstraintFromStore = [self currentVideoResoultionConstraintFromStore];
+- (int)currentVideoResolutionWidthFromStore {
+ NSString *resolution = [self currentVideoResolutionSettingFromStore];
- return [self videoResolutionComponentAtIndex:0 inConstraintsString:mediaConstraintFromStore];
+ return [self videoResolutionComponentAtIndex:0 inString:resolution];
}
-- (nullable NSString *)currentVideoResolutionHeightFromStore {
- NSString *mediaConstraintFromStore = [self currentVideoResoultionConstraintFromStore];
- return [self videoResolutionComponentAtIndex:1 inConstraintsString:mediaConstraintFromStore];
+- (int)currentVideoResolutionHeightFromStore {
+ NSString *resolution = [self currentVideoResolutionSettingFromStore];
+ return [self videoResolutionComponentAtIndex:1 inString:resolution];
}
#pragma mark -
-- (NSString *)defaultVideoResolutionMediaConstraint {
+- (NSString *)defaultVideoResolutionSetting {
return videoResolutionsStaticValues()[0];
}
-- (nullable NSString *)videoResolutionComponentAtIndex:(int)index
- inConstraintsString:(NSString *)constraint {
+- (int)videoResolutionComponentAtIndex:(int)index inString:(NSString *)resolution {
if (index != 0 && index != 1) {
- return nil;
+ return 0;
}
- NSArray *components = [constraint componentsSeparatedByString:@"x"];
+ NSArray<NSString *> *components = [resolution componentsSeparatedByString:@"x"];
if (components.count != 2) {
- return nil;
+ return 0;
}
- return components[index];
+ return components[index].intValue;
}
- (NSString *)defaultVideoCodecSetting {
return videoCodecsStaticValues()[0];
}
-#pragma mark - Conversion to RTCMediaConstraints
-
-- (nullable NSDictionary *)currentMediaConstraintFromStoreAsRTCDictionary {
- NSDictionary *mediaConstraintsDictionary = nil;
-
- NSString *widthConstraint = [self currentVideoResolutionWidthFromStore];
- NSString *heightConstraint = [self currentVideoResolutionHeightFromStore];
- if (widthConstraint && heightConstraint) {
- mediaConstraintsDictionary = @{
- kRTCMediaConstraintsMinWidth : widthConstraint,
- kRTCMediaConstraintsMinHeight : heightConstraint
- };
- }
- return mediaConstraintsDictionary;
-}
-
@end
NS_ASSUME_NONNULL_END
« no previous file with comments | « webrtc/examples/objc/AppRTCMobile/ARDSettingsModel.h ('k') | webrtc/examples/objc/AppRTCMobile/ARDSettingsModel+Private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698