mirror of
https://github.com/zakk4223/CocoaSplit.git
synced 2026-05-21 06:46:14 -06:00
Added an autorelease pool to frame tick calls; InputSources were staying allocated too long, likely due to a thread without an autorelease pool
This commit is contained in:
parent
d2a84e24f1
commit
50b55035f3
6 changed files with 41 additions and 32 deletions
Binary file not shown.
|
|
@ -1799,7 +1799,6 @@
|
|||
-(void)setStagingLayout:(SourceLayout *)stagingLayout
|
||||
{
|
||||
|
||||
|
||||
[stagingLayout restoreSourceList:nil];
|
||||
[stagingLayout setupMIDI];
|
||||
|
||||
|
|
@ -1850,7 +1849,6 @@
|
|||
-(void)setSelectedLayout:(SourceLayout *)selectedLayout
|
||||
{
|
||||
|
||||
|
||||
[selectedLayout setAddLayoutBlock:^(SourceLayout *layout) {
|
||||
|
||||
layout.in_live = YES;
|
||||
|
|
@ -2618,8 +2616,7 @@
|
|||
return;
|
||||
}
|
||||
|
||||
@autoreleasepool {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -2635,6 +2632,7 @@
|
|||
|
||||
|
||||
_frame_time = startTime;
|
||||
@autoreleasepool {
|
||||
|
||||
[self newFrame];
|
||||
}
|
||||
|
|
@ -2672,12 +2670,10 @@
|
|||
|
||||
CVPixelBufferRef newFrame;
|
||||
|
||||
|
||||
double nfstart = [self mach_time_seconds];
|
||||
|
||||
newFrame = [self.previewCtx.layoutRenderer currentImg];
|
||||
|
||||
|
||||
double nfdone = [self mach_time_seconds];
|
||||
double nftime = nfdone - nfstart;
|
||||
_renderedFrames++;
|
||||
|
|
|
|||
|
|
@ -1300,8 +1300,7 @@ static NSArray *_sourceTypes = nil;
|
|||
-(void)dealloc
|
||||
{
|
||||
|
||||
|
||||
|
||||
NSLog(@"DEALLOC INPUT");
|
||||
[self deregisterVideoInput:self.videoInput];
|
||||
for(id vInput in self.videoSources)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -227,6 +227,7 @@
|
|||
CVPixelBufferRef destFrame = NULL;
|
||||
CGFloat frameWidth, frameHeight;
|
||||
|
||||
|
||||
[self.layout frameTick];
|
||||
if (_transitionLayout)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1438,6 +1438,7 @@
|
|||
|
||||
if (toDelete)
|
||||
{
|
||||
|
||||
self.selectedSource = nil;
|
||||
self.mousedSource = nil;
|
||||
|
||||
|
|
@ -1718,6 +1719,7 @@
|
|||
|
||||
-(void)sourceWasDeleted:(NSNotification *)notification
|
||||
{
|
||||
|
||||
InputSource *toDel = notification.object;
|
||||
[self purgeConfigForInput:toDel];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -484,6 +484,7 @@
|
|||
mylist = self.sourceList;
|
||||
}
|
||||
|
||||
|
||||
NSArray *listCopy = [mylist sortedArrayUsingDescriptors:@[_sourceDepthSorter, _sourceUUIDSorter]];
|
||||
return listCopy;
|
||||
}
|
||||
|
|
@ -1506,7 +1507,9 @@
|
|||
[delSource willDelete];
|
||||
|
||||
[self willChangeValueForKey:@"topLevelSourceList"];
|
||||
[[self mutableArrayValueForKey:@"sourceList" ] removeObject:delSource];
|
||||
@synchronized (self) {
|
||||
[[self mutableArrayValueForKey:@"sourceList" ] removeObject:delSource];
|
||||
}
|
||||
[self generateTopLevelSourceList];
|
||||
[self didChangeValueForKey:@"topLevelSourceList"];
|
||||
|
||||
|
|
@ -1529,6 +1532,8 @@
|
|||
[[NSNotificationCenter defaultCenter] postNotificationName:CSNotificationInputDeleted object:delSource userInfo:nil];
|
||||
delSource.sourceLayout = nil;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -1727,35 +1732,41 @@
|
|||
|
||||
-(void)frameTick
|
||||
{
|
||||
|
||||
bool needsResize = NO;
|
||||
NSSize curSize = NSMakeSize(self.canvas_width, self.canvas_height);
|
||||
|
||||
if (!NSEqualSizes(curSize, _rootSize))
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
self.rootLayer.bounds = CGRectMake(0, 0, self.canvas_width, self.canvas_height);
|
||||
bool needsResize = NO;
|
||||
NSSize curSize = NSMakeSize(self.canvas_width, self.canvas_height);
|
||||
|
||||
_rootSize = curSize;
|
||||
needsResize = YES;
|
||||
}
|
||||
|
||||
NSArray *listCopy = [self sourceListOrdered];
|
||||
|
||||
|
||||
for (InputSource *isource in listCopy)
|
||||
{
|
||||
if (needsResize)
|
||||
if (!NSEqualSizes(curSize, _rootSize))
|
||||
{
|
||||
isource.needsAdjustPosition = YES;
|
||||
isource.needsAdjustment = YES;
|
||||
|
||||
self.rootLayer.bounds = CGRectMake(0, 0, self.canvas_width, self.canvas_height);
|
||||
|
||||
_rootSize = curSize;
|
||||
needsResize = YES;
|
||||
}
|
||||
|
||||
if (isource.active)
|
||||
{
|
||||
[isource frameTick];
|
||||
}
|
||||
|
||||
NSArray *listCopy;
|
||||
|
||||
listCopy = [self sourceListOrdered];
|
||||
|
||||
|
||||
|
||||
for (InputSource *isource in listCopy)
|
||||
{
|
||||
if (needsResize)
|
||||
{
|
||||
isource.needsAdjustPosition = YES;
|
||||
isource.needsAdjustment = YES;
|
||||
}
|
||||
|
||||
if (isource.active)
|
||||
{
|
||||
[isource frameTick];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue