diff --git a/CapturePlugins/CSAppleWebViewCapturePlugin/CSAppleWebViewCapturePlugin/CSAppleWebViewCapture.m b/CapturePlugins/CSAppleWebViewCapturePlugin/CSAppleWebViewCapturePlugin/CSAppleWebViewCapture.m index 17985011..0c755b14 100644 --- a/CapturePlugins/CSAppleWebViewCapturePlugin/CSAppleWebViewCapturePlugin/CSAppleWebViewCapture.m +++ b/CapturePlugins/CSAppleWebViewCapturePlugin/CSAppleWebViewCapturePlugin/CSAppleWebViewCapture.m @@ -116,6 +116,7 @@ -(void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { + [self.webView setValue:@NO forKey:@"drawsBackground"]; NSString *captureName = self.webView.title; if (!captureName || captureName.length == 0) diff --git a/CapturePlugins/CSTextCapturePlugin/CSTextCapturePlugin/FileTextCapture.m b/CapturePlugins/CSTextCapturePlugin/CSTextCapturePlugin/FileTextCapture.m index fd9eeb43..bae643a5 100644 --- a/CapturePlugins/CSTextCapturePlugin/CSTextCapturePlugin/FileTextCapture.m +++ b/CapturePlugins/CSTextCapturePlugin/CSTextCapturePlugin/FileTextCapture.m @@ -18,10 +18,10 @@ { if (self = [super init]) { - self.lineLimit = 0; - self.startLine = 0; - self.collapseLines = NO; - self.fontSizeAdjust = 0; + _lineLimit = 0; + _startLine = 0; + _collapseLines = NO; + _fontSizeAdjust = 0; _fileChangeQueue = dispatch_queue_create("File Watch Queue", DISPATCH_QUEUE_SERIAL); } @@ -114,8 +114,9 @@ -(void)setCurrentFile:(NSString *)currentFile { + [self openFile:currentFile]; _currentFile = currentFile; - [self openFile:self.currentFile]; + } -(NSString *)currentFile @@ -133,13 +134,19 @@ { - if (!self.currentFile) + + if (!filename) { + [self cancelWatch]; return; } - dispatch_async(_fileChangeQueue, ^{ + if (self.currentFile && ![self.currentFile isEqualToString:filename]) + { [self cancelWatch]; + } + + dispatch_async(_fileChangeQueue, ^{ NSData *fileData = [NSData dataWithContentsOfFile:filename]; [self watchPath:filename]; [self processFileData:fileData]; @@ -160,7 +167,6 @@ if (fileAttributedString && [documentAttributes[NSDocumentTypeDocumentAttribute] isEqualToString:NSPlainTextDocumentType]) { - self.attributedText = nil; //self.currentFile = filename; NSString *fileText = fileAttributedString.string; @@ -192,7 +198,8 @@ fileText = [fileText stringByReplacingOccurrencesOfString:@"\n" withString:@" "]; } - self.text = fileText; + + self.attributedText = [[NSAttributedString alloc] initWithString:fileText attributes:self.defaultAttributes]; } else if (fileAttributedString) { [fileAttributedString beginEditing]; [fileAttributedString enumerateAttribute:NSFontAttributeName inRange:NSMakeRange(0, fileAttributedString.length) options:0 usingBlock:^(id _Nullable value, NSRange range, BOOL * _Nonnull stop) { @@ -202,7 +209,7 @@ [fileAttributedString addAttribute:NSFontAttributeName value:newFont range:range]; }]; [fileAttributedString endEditing]; - self.text = nil; + //self.text = nil; self.attributedText = fileAttributedString; } } @@ -231,18 +238,18 @@ int fd = open([filePath UTF8String], O_EVTONLY); __block typeof(self) blockSelf = self; - _fileSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, fd, DISPATCH_VNODE_DELETE | DISPATCH_VNODE_WRITE | DISPATCH_VNODE_EXTEND | DISPATCH_VNODE_ATTRIB | DISPATCH_VNODE_LINK | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE, _fileChangeQueue); + _fileSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, fd, DISPATCH_VNODE_DELETE | DISPATCH_VNODE_WRITE | DISPATCH_VNODE_RENAME | DISPATCH_VNODE_REVOKE, _fileChangeQueue); dispatch_source_set_event_handler(_fileSource, ^{ unsigned long flags = dispatch_source_get_data(blockSelf->_fileSource); - + //NSLog(@"FLAGS %lu", flags); if (flags & DISPATCH_VNODE_DELETE) { dispatch_source_cancel(blockSelf->_fileSource); blockSelf->_fileSource = NULL; [blockSelf watchPath:filePath]; } else { - [self openFile:filePath]; + [self openFile:filePath]; } }); diff --git a/CocoaSplit/CAMultiAudio/CAMultiAudioEngine.m b/CocoaSplit/CAMultiAudio/CAMultiAudioEngine.m index 5284ce63..275317ff 100644 --- a/CocoaSplit/CAMultiAudio/CAMultiAudioEngine.m +++ b/CocoaSplit/CAMultiAudio/CAMultiAudioEngine.m @@ -1019,7 +1019,6 @@ OSStatus encoderRenderCallback( void *inRefCon, AudioUnitRenderActionFlags *ioAc CAMultiAudioOutputTrack *outputTrack = self.outputTracks[trackUID]; if (outputTrack) { - NSLog(@"STARTING ENCODER FOR %@", trackUID); CAMultiAudioNode *renderNode = outputTrack.encoderNode; CSAacEncoder *encoder = outputTrack.encoder; AudioUnitAddRenderNotify(renderNode.audioUnit, encoderRenderCallback, [encoder inputBufferPtr]); diff --git a/CocoaSplit/CAMultiAudio/CAMultiAudioGraph.m b/CocoaSplit/CAMultiAudio/CAMultiAudioGraph.m index 8a98ddcd..b3e3a4b4 100644 --- a/CocoaSplit/CAMultiAudio/CAMultiAudioGraph.m +++ b/CocoaSplit/CAMultiAudio/CAMultiAudioGraph.m @@ -227,8 +227,7 @@ } [outputsForBus addObject:[[CAMultiAudioConnection alloc] initWithNode:toNode bus:inBus]]; toNode.inputConnections[@(inBus)] = [[CAMultiAudioConnection alloc] initWithNode:node bus:outBus]; - NSLog(@"%@ OUTPUT %@", node, [node outputFormatForBus:outBus]); - NSLog(@"%@ INPUT %@", toNode, [toNode inputFormatForBus:inBus]); + } return YES; } diff --git a/CocoaSplit/CSLayoutRecorder.m b/CocoaSplit/CSLayoutRecorder.m index c89505b4..0f1f1d4c 100644 --- a/CocoaSplit/CSLayoutRecorder.m +++ b/CocoaSplit/CSLayoutRecorder.m @@ -512,7 +512,7 @@ elapsed_t = end_t - start_t; if (elapsed_t > 1.0f/60.0f) { - NSLog(@"RENDER TOOK %f", elapsed_t); + NSLog(@"RENDER TOOK %f %@", elapsed_t, NSThread.currentThread); } if (self.frameReadyBlock) { diff --git a/CocoaSplit/InputSource.m b/CocoaSplit/InputSource.m index 12e5076a..a9a6e564 100644 --- a/CocoaSplit/InputSource.m +++ b/CocoaSplit/InputSource.m @@ -683,7 +683,7 @@ static NSArray *_sourceTypes = nil; { [CATransaction begin]; updateBlock(_currentLayer); - [_currentLayer setNeedsDisplay]; + [_currentLayer displayIfNeeded]; [CATransaction commit]; } } diff --git a/CocoaSplit/PluginBaseClasses/CSCaptureBase.m b/CocoaSplit/PluginBaseClasses/CSCaptureBase.m index c6c95198..ade4c3d0 100644 --- a/CocoaSplit/PluginBaseClasses/CSCaptureBase.m +++ b/CocoaSplit/PluginBaseClasses/CSCaptureBase.m @@ -354,9 +354,11 @@ { - CALayer *newLayer = [self createNewLayer]; + CALayer *newLayer = nil; @synchronized(self) { + newLayer = [self createNewLayer]; + if (!self.tickInput) { self.tickInput = inputsrc; diff --git a/CocoaSplit/PluginBaseClasses/CSTextCaptureBase.m b/CocoaSplit/PluginBaseClasses/CSTextCaptureBase.m index ce16a05d..1f60f67f 100644 --- a/CocoaSplit/PluginBaseClasses/CSTextCaptureBase.m +++ b/CocoaSplit/PluginBaseClasses/CSTextCaptureBase.m @@ -51,9 +51,17 @@ -(CALayer *)createNewLayer { CATextLayer *newLayer = [CATextLayer layer]; - newLayer.string = _attribString; - newLayer.bounds = CGRectMake(0.0, 0.0, _attribString.size.width, _attribString.size.height); + NSMutableAttributedString *aStr = nil; + @synchronized (self) { + aStr = _attribString; + } + + if (aStr) + { + newLayer.string = _attribString; + newLayer.bounds = CGRectMake(0.0, 0.0, aStr.size.width, aStr.size.height); + } newLayer.alignmentMode = self.alignmentMode; newLayer.wrapped = self.wrapped; return newLayer; @@ -150,14 +158,18 @@ { NSDictionary *strAttrs = self.defaultAttributes; + NSMutableAttributedString *newAttribString = nil; if (self.attributedText) { - _attribString = self.attributedText.mutableCopy; + newAttribString = self.attributedText.mutableCopy; } else { - _attribString = [[NSMutableAttributedString alloc] initWithString:self.text attributes:strAttrs]; + newAttribString = [[NSMutableAttributedString alloc] initWithString:self.text attributes:strAttrs]; } + @synchronized (self) { + _attribString = newAttribString; + } if ([self.alignmentMode isEqualToString:kCAAlignmentCenter] || [self.alignmentMode isEqualToString:kCAAlignmentRight]) { self.allowScaling = YES; @@ -168,7 +180,8 @@ [self updateLayersWithBlock:^(CALayer *layer) { //layer.bounds = CGRectMake(0.0, 0.0, self->_attribString.size.width, self->_attribString.size.height); - ((CATextLayer *)layer).string = self->_attribString; + + ((CATextLayer *)layer).string = newAttribString; ((CATextLayer *)layer).alignmentMode = self.alignmentMode; ((CATextLayer *)layer).wrapped = self.wrapped; }]; @@ -193,14 +206,12 @@ _attributedText = attributedText; dispatch_async(dispatch_get_main_queue(), ^{ - self.captureName = attributedText.string; }); - [self buildString]; }