InAppSettingsVideo: add video preset, video FPS and bandwidth limit preferences

This commit is contained in:
Gautier Pelloux-Prayer 2015-06-16 18:00:40 +02:00
parent 016fa44f62
commit 2d10de7d88
7 changed files with 148 additions and 56 deletions

View file

@ -218,6 +218,9 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
[self setBool:linphone_core_self_view_enabled(lc) forKey:@"self_video_preference"];
BOOL previewEnabled = [lm lpConfigBoolForKey:@"preview_preference" withDefault:YES];
[self setBool:previewEnabled forKey:@"preview_preference"];
const char *preset = linphone_core_get_video_preset(lc);
[self setCString:preset ? preset : "default" forKey:@"video_preset_preference"];
MSVideoSize vsize = linphone_core_get_preferred_video_size(lc);
int index;
if ((vsize.width == MS_VIDEO_SIZE_720P_W) && (vsize.height == MS_VIDEO_SIZE_720P_H)) {
@ -228,6 +231,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
index = 2;
}
[self setInteger:index forKey:@"video_preferred_size_preference"];
[self setInteger:linphone_core_get_preferred_framerate(lc) forKey:@"video_preferred_fps_preference"];
[self setInteger:linphone_core_get_download_bandwidth(lc) forKey:@"download_bandwidth_preference"];
}
// call section
@ -603,6 +608,8 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
linphone_core_enable_self_view(lc, [self boolForKey:@"self_video_preference"]);
BOOL preview_preference = [self boolForKey:@"preview_preference"];
[lm lpConfigSetInt:preview_preference forKey:@"preview_preference"];
linphone_core_set_video_preset(lc, [[self stringForKey:@"video_preset_preference"] UTF8String]);
int bw;
MSVideoSize vsize;
switch ([self integerForKey:@"video_preferred_size_preference"]) {
@ -623,9 +630,12 @@ extern void linphone_iphone_log_handler(int lev, const char *fmt, va_list args);
bw = 380;
break;
}
[self setInteger:bw forKey:@"upload_bandwidth_preference"];
[self setInteger:bw forKey:@"download_bandwidth_preference"];
linphone_core_set_preferred_video_size(lc, vsize);
if (![[self stringForKey:@"video_preset_preference"] isEqualToString:@"custom"]) {
[self setInteger:bw forKey:@"download_bandwidth_preference"];
}
linphone_core_set_preferred_framerate(lc, [self integerForKey:@"video_preferred_fps_preference"]);
linphone_core_set_download_bandwidth(lc, [self integerForKey:@"download_bandwidth_preference"]);
}
// call section

View file

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6254" systemVersion="14B25" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="7703"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UICallCell">
@ -33,10 +32,10 @@
<outlet property="videoDownloadBandwidthLabel" destination="109" id="125"/>
<outlet property="videoIceConnectivityHeaderLabel" destination="111" id="126"/>
<outlet property="videoIceConnectivityLabel" destination="112" id="127"/>
<outlet property="videoRecvSizeHeaderLabel" destination="nNJ-4U-pl2" id="r20-yj-TG9"/>
<outlet property="videoRecvSizeLabel" destination="RxS-YG-dqM" id="fPi-Uk-MHy"/>
<outlet property="videoSentSizeHeaderLabel" destination="6PM-O1-cYd" id="G8P-SK-lgu"/>
<outlet property="videoSentSizeLabel" destination="CCZ-g0-5g1" id="kgM-NY-RUy"/>
<outlet property="videoRecvSizeFPSHeaderLabel" destination="nNJ-4U-pl2" id="mMd-r3-eEC"/>
<outlet property="videoRecvSizeFPSLabel" destination="RxS-YG-dqM" id="paX-s0-Cjs"/>
<outlet property="videoSentSizeFPSHeaderLabel" destination="6PM-O1-cYd" id="I9e-1I-e8q"/>
<outlet property="videoSentSizeFPSLabel" destination="CCZ-g0-5g1" id="uzZ-aa-lnu"/>
<outlet property="videoStatsView" destination="99" id="128"/>
<outlet property="videoUploadBandwidthHeaderLabel" destination="107" id="129"/>
<outlet property="videoUploadBandwidthLabel" destination="108" id="130"/>
@ -218,11 +217,11 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="j5j-bZ-C2L" userLabel="videoSentSizeView">
<view contentMode="scaleToFill" id="j5j-bZ-C2L" userLabel="videoSentSizeFPSView">
<rect key="frame" x="10" y="80" width="310" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Size sent:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="6PM-O1-cYd" userLabel="videoSentSizeHeaderLabel">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Size sent (FPS):" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="6PM-O1-cYd" userLabel="videoSentSizeFPSHeaderLabel">
<rect key="frame" x="0.0" y="0.0" width="160" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration">
@ -231,7 +230,7 @@
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="320x240" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="CCZ-g0-5g1" userLabel="videoSentSizeLabel">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="320x240 (15FPS)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="CCZ-g0-5g1" userLabel="videoSentSizeFPSLabel">
<rect key="frame" x="168" y="0.0" width="142" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Video upload bandwidth">
@ -243,11 +242,11 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<view contentMode="scaleToFill" id="6oX-23-Ivn" userLabel="videoRecvSizeView">
<view contentMode="scaleToFill" id="6oX-23-Ivn" userLabel="videoRecvSizeFPSView">
<rect key="frame" x="10" y="110" width="310" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Size received:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="nNJ-4U-pl2" userLabel="videoRecvSizeHeaderLabel">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="Size received (FPS):" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="nNJ-4U-pl2" userLabel="videoRecvSizeFPSHeaderLabel">
<rect key="frame" x="0.0" y="0.0" width="160" height="21"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration">
@ -256,7 +255,7 @@
<fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="320x240" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="RxS-YG-dqM" userLabel="videoRecvSizeLabel">
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" text="320x240 (15FPS)" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="10" id="RxS-YG-dqM" userLabel="videoRecvSizeFPSLabel">
<rect key="frame" x="168" y="0.0" width="142" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<accessibility key="accessibilityConfiguration" label="Video upload bandwidth">

View file

@ -78,10 +78,10 @@ typedef enum _UICallCellOtherView {
@property (nonatomic, strong) IBOutlet UILabel* videoCodecLabel;
@property (nonatomic, strong) IBOutlet UILabel* videoCodecHeaderLabel;
@property (strong, nonatomic) IBOutlet UILabel *videoSentSizeHeaderLabel;
@property (strong, nonatomic) IBOutlet UILabel *videoSentSizeLabel;
@property (strong, nonatomic) IBOutlet UILabel *videoRecvSizeHeaderLabel;
@property (strong, nonatomic) IBOutlet UILabel *videoRecvSizeLabel;
@property(strong, nonatomic) IBOutlet UILabel *videoSentSizeFPSHeaderLabel;
@property(strong, nonatomic) IBOutlet UILabel *videoSentSizeFPSLabel;
@property(strong, nonatomic) IBOutlet UILabel *videoRecvSizeFPSHeaderLabel;
@property(strong, nonatomic) IBOutlet UILabel *videoRecvSizeFPSLabel;
@property (nonatomic, strong) IBOutlet UILabel* videoUploadBandwidthLabel;
@property (nonatomic, strong) IBOutlet UILabel* videoUploadBandwidthHeaderLabel;

View file

@ -120,8 +120,8 @@
@synthesize videoDownloadBandwidthLabel, videoDownloadBandwidthHeaderLabel;
@synthesize videoIceConnectivityLabel, videoIceConnectivityHeaderLabel;
@synthesize videoRecvSizeHeaderLabel, videoRecvSizeLabel;
@synthesize videoSentSizeHeaderLabel, videoSentSizeLabel;
@synthesize videoRecvSizeFPSHeaderLabel, videoRecvSizeFPSLabel;
@synthesize videoSentSizeFPSHeaderLabel, videoSentSizeFPSLabel;
@synthesize otherView;
@ -433,24 +433,28 @@
const LinphoneCallStats *stats = linphone_call_get_video_stats(call);
MSVideoSize sentSize = linphone_call_params_get_sent_video_size(params);
MSVideoSize recvSize = linphone_call_params_get_received_video_size(params);
if (stats != NULL && linphone_call_params_video_enabled(params)) {
MSVideoSize sentSize = linphone_call_params_get_sent_video_size(params);
MSVideoSize recvSize = linphone_call_params_get_received_video_size(params);
float sentFPS = linphone_call_params_get_sent_framerate(params);
float recvFPS = linphone_call_params_get_received_framerate(params);
if(stats != NULL) {
[videoUploadBandwidthLabel setText:[NSString stringWithFormat:@"%1.1f kbits/s", stats->upload_bandwidth]];
[videoDownloadBandwidthLabel setText:[NSString stringWithFormat:@"%1.1f kbits/s", stats->download_bandwidth]];
[videoIceConnectivityLabel setText:[UICallCell iceToString:stats->ice_state]];
[videoSentSizeLabel setText:[NSString stringWithFormat:@"%dx%d",sentSize.width, sentSize.height]];
[videoRecvSizeLabel setText:[NSString stringWithFormat:@"%dx%d",recvSize.width, recvSize.height]];
} else {
[videoUploadBandwidthLabel setText:@""];
[videoDownloadBandwidthLabel setText:@""];
[videoIceConnectivityLabel setText:@""];
[videoSentSizeLabel setText:@"0x0"];
[videoRecvSizeLabel setText:@"0x0"];
}
}
[videoUploadBandwidthLabel setText:[NSString stringWithFormat:@"%1.1f kbits/s", stats->upload_bandwidth]];
[videoDownloadBandwidthLabel
setText:[NSString stringWithFormat:@"%1.1f kbits/s", stats->download_bandwidth]];
[videoIceConnectivityLabel setText:[UICallCell iceToString:stats->ice_state]];
[videoSentSizeFPSLabel
setText:[NSString stringWithFormat:@"%dx%d (%.1fFPS)", sentSize.width, sentSize.height, sentFPS]];
[videoRecvSizeFPSLabel
setText:[NSString stringWithFormat:@"%dx%d (%.1fFPS)", recvSize.width, recvSize.height, recvFPS]];
} else {
[videoUploadBandwidthLabel setText:@""];
[videoDownloadBandwidthLabel setText:@""];
[videoIceConnectivityLabel setText:@""];
[videoSentSizeFPSLabel setText:@"0x0"];
[videoRecvSizeFPSLabel setText:@"0x0"];
}
}
}

View file

@ -490,11 +490,15 @@ static UICompositeViewDescription *compositeDescription = nil;
[[LinphoneManager instance] setLogsEnabled:debugEnabled];
} else if( [@"advanced_account_preference" compare:notif.object] == NSOrderedSame) {
removeFromHiddenKeys = [[notif.userInfo objectForKey:@"advanced_account_preference"] boolValue];
[keys addObject:@"userid_preference"];
[keys addObject:@"proxy_preference"];
[keys addObject:@"outbound_proxy_preference"];
[keys addObject:@"avpf_preference"];
} else if ([@"video_preset_preference" compare:notif.object] == NSOrderedSame) {
NSString *video_preset = [notif.userInfo objectForKey:@"video_preset_preference"];
removeFromHiddenKeys = [video_preset isEqualToString:@"custom"];
[keys addObject:@"video_preferred_fps_preference"];
[keys addObject:@"bandwidth_limit_preference"];
}
for(NSString* key in keys){
@ -640,26 +644,31 @@ static UICompositeViewDescription *compositeDescription = nil;
[hiddenKeys addObject:@"video_menu"];
}
if (!linphone_core_get_video_preset([LinphoneManager getLc]) ||
strcmp(linphone_core_get_video_preset([LinphoneManager getLc]), "custom") != 0) {
[hiddenKeys addObject:@"video_preferred_fps_preference"];
[hiddenKeys addObject:@"bandwidth_limit_preference"];
}
[hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]];
[hiddenKeys addObjectsFromArray:[[LinphoneManager unsupportedCodecs] allObjects]];
BOOL random_port = [lm lpConfigBoolForKey:@"random_port_preference"];
if(random_port) {
[hiddenKeys addObject:@"port_preference"];
}
BOOL random_port = [lm lpConfigBoolForKey:@"random_port_preference"];
if (random_port) {
[hiddenKeys addObject:@"port_preference"];
}
if(linphone_core_get_stun_server([LinphoneManager getLc]) == NULL) {
[hiddenKeys addObject:@"ice_preference"];
}
if (linphone_core_get_stun_server([LinphoneManager getLc]) == NULL) {
[hiddenKeys addObject:@"ice_preference"];
}
if(![lm lpConfigBoolForKey:@"debugenable_preference"]) {
[hiddenKeys addObject:@"console_button"];
}
if (![lm lpConfigBoolForKey:@"debugenable_preference"]) {
[hiddenKeys addObject:@"console_button"];
}
if(![LinphoneManager runningOnIpad]) {
[hiddenKeys addObject:@"preview_preference"];
}
if([lm lpConfigBoolForKey:@"hide_run_assistant_preference"]) {
if (![LinphoneManager runningOnIpad]) {
[hiddenKeys addObject:@"preview_preference"];
}
if ([lm lpConfigBoolForKey:@"hide_run_assistant_preference"]) {
[hiddenKeys addObject:@"wizard_button"];
}

View file

@ -41,8 +41,28 @@
<string>preview_preference</string>
</dict>
<dict>
<key>Key</key>
<string>video_preset_preference</string>
<key>Title</key>
<string>Video preset</string>
<key>Titles</key>
<array>
<string>Default</string>
<string>High FPS</string>
<string>Custom</string>
</array>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Values</key>
<array>
<string>default</string>
<string>high-fps</string>
<string>custom</string>
</array>
<key>DefaultValue</key>
<integer>1</integer>
<string>default</string>
</dict>
<dict>
<key>Key</key>
<string>video_preferred_size_preference</string>
<key>Title</key>
@ -61,6 +81,56 @@
<integer>1</integer>
<integer>2</integer>
</array>
<key>DefaultValue</key>
<integer>1</integer>
</dict>
<dict>
<key>Key</key>
<string>video_preferred_fps_preference</string>
<key>Title</key>
<string>Preferred FPS</string>
<key>Type</key>
<string>PSMultiValueSpecifier</string>
<key>Titles</key>
<array>
<string>No preference</string>
<string>5</string>
<string>10</string>
<string>15</string>
<string>20</string>
<string>25</string>
<string>30</string>
</array>
<key>Values</key>
<array>
<integer>0</integer>
<integer>5</integer>
<integer>10</integer>
<integer>15</integer>
<integer>20</integer>
<integer>25</integer>
<integer>30</integer>
</array>
<key>DefaultValue</key>
<string>0</string>
</dict>
<dict>
<key>Key</key>
<string>bandwidth_limit_preference</string>
<key>Title</key>
<string>Bandwidth limit in kbits/s</string>
<key>Type</key>
<string>PSTextFieldSpecifier</string>
<key>AutocapitalizationType</key>
<string>None</string>
<key>AutocorrectionType</key>
<string>No</string>
<key>KeyboardType</key>
<string>NumberPad</string>
<key>DefaultValue</key>
<integer>380</integer>
<key>IASKTextAlignment</key>
<string>IASKUITextAlignmentRight</string>
</dict>
<dict>
<key>Title</key>

@ -1 +1 @@
Subproject commit e7db1545745344aeb7077d8e3d432dcdf2018f8f
Subproject commit 98628e52b9901650d13281be2216a6fb9c247710