bcb2f287e1
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
29 lines
1 KiB
Diff
29 lines
1 KiB
Diff
--- a/osdep/mac/input_helper.swift
|
|
+++ b/osdep/mac/input_helper.swift
|
|
@@ -18,6 +18,14 @@
|
|
import Cocoa
|
|
import Carbon.HIToolbox
|
|
|
|
+extension NSCondition {
|
|
+ fileprivate func withLock<T>(_ body: () throws -> T) rethrows -> T {
|
|
+ self.lock()
|
|
+ defer { self.unlock() }
|
|
+ return try body()
|
|
+ }
|
|
+}
|
|
+
|
|
class InputHelper: NSObject {
|
|
var option: OptionHelper?
|
|
var lock = NSCondition()
|
|
--- a/audio/out/ao_avfoundation.m
|
|
+++ b/audio/out/ao_avfoundation.m
|
|
@@ -312,7 +312,8 @@
|
|
|
|
+ #if __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000
|
|
p->observer = [[AVObserver alloc] initWithAO:ao];
|
|
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
|
[center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererOutputConfigurationDidChangeNotification object:p->renderer];
|
|
[center addObserver:p->observer selector:@selector(handleRestartNotification:) name:AVSampleBufferAudioRendererWasFlushedAutomaticallyNotification object:p->renderer];
|
|
-
|
|
+ #endif
|
|
return CONTROL_OK;
|