improved mic deactivation logic
This commit is contained in:
parent
9863b10f4e
commit
0ce6562493
|
@ -32,6 +32,9 @@
|
|||
//microphone state
|
||||
@property NSControlStateValue microphoneState;
|
||||
|
||||
//last microphone state
|
||||
@property(nonatomic, retain)NSDate* lastMicEvent;
|
||||
|
||||
/* METHODS */
|
||||
|
||||
//start
|
||||
|
|
|
@ -29,6 +29,7 @@ extern os_log_t logHandle;
|
|||
|
||||
@synthesize clients;
|
||||
@synthesize audioClients;
|
||||
@synthesize lastMicEvent;
|
||||
|
||||
//init
|
||||
// create XPC connection & set remote obj interface
|
||||
|
@ -824,6 +825,23 @@ bail:
|
|||
//dbg msg
|
||||
os_log_debug(logHandle, "built in mic changed state to %ld", (long)state);
|
||||
|
||||
//ingore if event is too soon
|
||||
// macOS seems to toggle mic on/off on an off event :|
|
||||
if( (nil != self.lastMicEvent) &&
|
||||
([[NSDate date] timeIntervalSinceDate:self.lastMicEvent] < 0.5f) )
|
||||
{
|
||||
//dbg msg
|
||||
os_log_debug(logHandle, "ignoring mic event, as it happened <0.5s ");
|
||||
|
||||
//update
|
||||
self.lastMicEvent = [NSDate date];
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//update
|
||||
self.lastMicEvent = [NSDate date];
|
||||
|
||||
//mic off?
|
||||
if(NSControlStateValueOff == state)
|
||||
{
|
||||
|
|
|
@ -1493,7 +1493,7 @@ NSMutableDictionary* execTask(NSString* binaryPath, NSArray* arguments, BOOL sho
|
|||
bail:
|
||||
|
||||
//dbg msg
|
||||
os_log_debug(logHandle, "task completed with %@", results);
|
||||
os_log_debug(logHandle, "task completed with %{public}@", results);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue