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

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

Issue 2735303004: Add video codec setting to AppRTCMobile on iOS. (Closed)
Patch Set: Fix AppRTCMobile on Mac. Created 3 years, 9 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/ios/ARDSettingsModel.m
diff --git a/webrtc/examples/objc/AppRTCMobile/ios/ARDSettingsModel.m b/webrtc/examples/objc/AppRTCMobile/ios/ARDSettingsModel.m
index eda02758198cfe7e5a2e09a5c89fd43ac1d6bc87..7514689add53b0d5ee747aeae930f0c27a977a13 100644
--- a/webrtc/examples/objc/AppRTCMobile/ios/ARDSettingsModel.m
+++ b/webrtc/examples/objc/AppRTCMobile/ios/ARDSettingsModel.m
@@ -17,6 +17,10 @@ static NSArray<NSString *> *videoResolutionsStaticValues() {
return @[ @"640x480", @"960x540", @"1280x720" ];
}
+static NSArray<NSString *> *videoCodecsStaticValues() {
+ return @[ @"H264", @"VP8", @"VP9" ];
+}
+
@interface ARDSettingsModel () {
ARDSettingsStore *_settingsStore;
}
@@ -46,6 +50,27 @@ static NSArray<NSString *> *videoResolutionsStaticValues() {
return YES;
}
+- (NSArray<NSString *> *)availableVideoCodecs {
+ return videoCodecsStaticValues();
+}
+
+- (NSString *)currentVideoCodecSettingFromStore {
+ NSString *videoCodec = [[self settingsStore] videoCodec];
+ if (!videoCodec) {
+ videoCodec = [self defaultVideoCodecSetting];
+ [[self settingsStore] setVideoCodec:videoCodec];
+ }
+ return videoCodec;
+}
+
+- (BOOL)storeVideoCodecSetting:(NSString *)videoCodec {
+ if (![[self availableVideoCodecs] containsObject:videoCodec]) {
+ return NO;
+ }
+ [[self settingsStore] setVideoCodec:videoCodec];
+ return YES;
+}
+
- (nullable NSNumber *)currentMaxBitrateSettingFromStore {
return [[self settingsStore] maxBitrate];
}
@@ -92,6 +117,10 @@ static NSArray<NSString *> *videoResolutionsStaticValues() {
return components[index];
}
+- (NSString *)defaultVideoCodecSetting {
+ return videoCodecsStaticValues()[0];
+}
+
#pragma mark - Conversion to RTCMediaConstraints
- (nullable NSDictionary *)currentMediaConstraintFromStoreAsRTCDictionary {

Powered by Google App Engine
This is Rietveld 408576698