Skip to content

Commit 3f86eda

Browse files
authored
fix: allow setting precise resolution for the MJPEG stream (#1009)
* Allow setting precise resolution for the MJPEG stream, by accepting a float instead of an int value for FBMjpegScalingFactor * Bump version to 9.6.0-repeato.1 * Revert "Bump version to 9.6.0-repeato.1" This reverts commit e277fb9.
1 parent f9cc549 commit 3f86eda

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

WebDriverAgentLib/Commands/FBSessionCommands.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ + (NSArray *)routes
383383
[FBConfiguration setScreenshotQuality:[[settings objectForKey:FB_SETTING_SCREENSHOT_QUALITY] unsignedIntegerValue]];
384384
}
385385
if (nil != [settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR]) {
386-
[FBConfiguration setMjpegScalingFactor:[[settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR] unsignedIntegerValue]];
386+
[FBConfiguration setMjpegScalingFactor:[[settings objectForKey:FB_SETTING_MJPEG_SCALING_FACTOR] floatValue]];
387387
}
388388
if (nil != [settings objectForKey:FB_SETTING_MJPEG_FIX_ORIENTATION]) {
389389
[FBConfiguration setMjpegShouldFixOrientation:[[settings objectForKey:FB_SETTING_MJPEG_FIX_ORIENTATION] boolValue]];

WebDriverAgentLib/Routing/FBWebServer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ - (void)readMjpegSettingsFromEnv
142142
NSDictionary *env = NSProcessInfo.processInfo.environment;
143143
NSString *scalingFactor = [env objectForKey:@"MJPEG_SCALING_FACTOR"];
144144
if (scalingFactor != nil && [scalingFactor length] > 0) {
145-
[FBConfiguration setMjpegScalingFactor:[scalingFactor integerValue]];
145+
[FBConfiguration setMjpegScalingFactor:[scalingFactor floatValue]];
146146
}
147147
NSString *screenshotQuality = [env objectForKey:@"MJPEG_SERVER_SCREENSHOT_QUALITY"];
148148
if (screenshotQuality != nil && [screenshotQuality length] > 0) {

WebDriverAgentLib/Utilities/FBConfiguration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ extern NSString *const FBSnapshotMaxDepthKey;
136136
! Setting this to a value less than 100, especially together with orientation fixing enabled
137137
! may lead to WDA process termination because of an excessive CPU usage.
138138
*/
139-
+ (NSUInteger)mjpegScalingFactor;
140-
+ (void)setMjpegScalingFactor:(NSUInteger)scalingFactor;
139+
+ (CGFloat)mjpegScalingFactor;
140+
+ (void)setMjpegScalingFactor:(CGFloat)scalingFactor;
141141

142142
/**
143143
YES if verbose logging is enabled. NO otherwise.

WebDriverAgentLib/Utilities/FBConfiguration.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
static BOOL FBShouldUseSingletonTestManager = YES;
3838
static BOOL FBShouldRespectSystemAlerts = NO;
3939

40-
static NSUInteger FBMjpegScalingFactor = 100;
40+
static CGFloat FBMjpegScalingFactor = 100.0;
4141
static BOOL FBMjpegShouldFixOrientation = NO;
4242
static NSUInteger FBMjpegServerScreenshotQuality = 25;
4343
static NSUInteger FBMjpegServerFramerate = 10;
@@ -149,12 +149,12 @@ + (NSInteger)mjpegServerPort
149149
return DefaultMjpegServerPort;
150150
}
151151

152-
+ (NSUInteger)mjpegScalingFactor
152+
+ (CGFloat)mjpegScalingFactor
153153
{
154154
return FBMjpegScalingFactor;
155155
}
156156

157-
+ (void)setMjpegScalingFactor:(NSUInteger)scalingFactor {
157+
+ (void)setMjpegScalingFactor:(CGFloat)scalingFactor {
158158
FBMjpegScalingFactor = scalingFactor;
159159
}
160160

0 commit comments

Comments
 (0)