If the size of a source changes, the attached input will resize to match

This commit is contained in:
Zakk 2018-11-30 05:44:50 -05:00
parent 450b0e3056
commit 74dadf7428
3 changed files with 17 additions and 1 deletions

View file

@ -252,6 +252,7 @@ typedef enum resize_style_t {
NSDictionary *_undoActionMap;
float _croppedAR;
NSMutableArray *_frameUpdateQueue;
NSSize _previousSize;

View file

@ -745,6 +745,7 @@ static NSArray *_sourceTypes = nil;
_needsAdjustPosition = NO;
_topLevelHeight = 0;
_topLevelWidth = 0;
_previousSize = NSZeroSize;
_frameUpdateQueue = [NSMutableArray array];
self.changeInterval = 20.0f;
@ -2094,6 +2095,21 @@ static NSArray *_sourceTypes = nil;
[self.videoInput frameTickFromInput:self];
[self.layer frameTick];
NSSize capSize = self.videoInput.captureSize;
if (!NSEqualSizes(capSize, _previousSize) )
{
if (!NSEqualSizes(NSZeroSize, _previousSize))
{
resize_style resizeSave = self.resizeType;
self.resizeType = kResizeCenter | kResizeFree;
[self updateSize:capSize.width height:capSize.height];
self.resizeType = resizeSave;
}
_previousSize = capSize;
}
if (self.needsAdjustment)
{
[self adjustInputSize:self.needsAdjustPosition];

View file

@ -87,7 +87,6 @@
_fps_start_time = CFAbsoluteTimeGetCurrent();
_fps_frame_cnt = 0;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateStatistics:) name:CSNotificationStatisticsUpdate object:nil];
}