mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-08-24 10:14:13 -05:00
Merge pull request #7581 from PatTheMav/virtualcam-fixes
mac-virtualcam: Fix crashes in apps loading virtual camera and performance fixes
This commit is contained in:
@@ -10,7 +10,6 @@
|
||||
#import "Logging.h"
|
||||
|
||||
@interface OBSDALMachClient () <NSPortDelegate> {
|
||||
uint32_t _seed;
|
||||
NSPort *_receivePort;
|
||||
}
|
||||
@end
|
||||
@@ -114,6 +113,7 @@
|
||||
|
||||
IOSurfaceRef surface = IOSurfaceLookupFromMachPort(
|
||||
[framePort machPort]);
|
||||
[framePort invalidate];
|
||||
mach_port_deallocate(mach_task_self(),
|
||||
[framePort machPort]);
|
||||
|
||||
@@ -122,11 +122,20 @@
|
||||
return;
|
||||
}
|
||||
|
||||
IOSurfaceLock(surface, 0, &_seed);
|
||||
/*
|
||||
* IOSurfaceLocks are only necessary on non Apple Silicon devices, as those have
|
||||
* unified memory. On Intel machines, the lock ensures that the IOSurface is copied back
|
||||
* from GPU memory to CPU memory so we can process the pixel buffer.
|
||||
*/
|
||||
#ifndef __aarch64__
|
||||
IOSurfaceLock(surface, kIOSurfaceLockReadOnly, NULL);
|
||||
#endif
|
||||
CVPixelBufferRef frame;
|
||||
CVPixelBufferCreateWithIOSurface(kCFAllocatorDefault,
|
||||
surface, NULL, &frame);
|
||||
IOSurfaceUnlock(surface, 0, &_seed);
|
||||
#ifndef __aarch64__
|
||||
IOSurfaceUnlock(surface, kIOSurfaceLockReadOnly, NULL);
|
||||
#endif
|
||||
CFRelease(surface);
|
||||
|
||||
uint64_t timestamp;
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
@property NSPort *port;
|
||||
@property NSMutableSet *clientPorts;
|
||||
@property NSRunLoop *runLoop;
|
||||
@property uint32_t seed;
|
||||
@end
|
||||
|
||||
@implementation OBSDALMachServer
|
||||
@@ -156,7 +155,6 @@
|
||||
return;
|
||||
}
|
||||
|
||||
IOSurfaceLock(surface, 0, &_seed);
|
||||
mach_port_t framePort = IOSurfaceCreateMachPort(surface);
|
||||
|
||||
if (!framePort) {
|
||||
@@ -176,7 +174,6 @@
|
||||
]];
|
||||
|
||||
mach_port_deallocate(mach_task_self(), framePort);
|
||||
IOSurfaceUnlock(surface, 0, &_seed);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -84,11 +84,9 @@ static bool check_dal_plugin()
|
||||
copyPluginCmd];
|
||||
|
||||
NSDictionary *errorDict;
|
||||
NSAppleEventDescriptor *returnDescriptor = NULL;
|
||||
NSAppleScript *scriptObject =
|
||||
[[NSAppleScript alloc] initWithSource:copyCmd];
|
||||
returnDescriptor =
|
||||
[scriptObject executeAndReturnError:&errorDict];
|
||||
[scriptObject executeAndReturnError:&errorDict];
|
||||
if (errorDict != nil) {
|
||||
const char *errorMessage = [[errorDict
|
||||
objectForKey:@"NSAppleScriptErrorMessage"]
|
||||
|
||||
Reference in New Issue
Block a user