improved mic deactivation logic
This commit is contained in:
parent
9863b10f4e
commit
0ce6562493
|
@ -32,6 +32,9 @@
|
||||||
//microphone state
|
//microphone state
|
||||||
@property NSControlStateValue microphoneState;
|
@property NSControlStateValue microphoneState;
|
||||||
|
|
||||||
|
//last microphone state
|
||||||
|
@property(nonatomic, retain)NSDate* lastMicEvent;
|
||||||
|
|
||||||
/* METHODS */
|
/* METHODS */
|
||||||
|
|
||||||
//start
|
//start
|
||||||
|
|
|
@ -29,6 +29,7 @@ extern os_log_t logHandle;
|
||||||
|
|
||||||
@synthesize clients;
|
@synthesize clients;
|
||||||
@synthesize audioClients;
|
@synthesize audioClients;
|
||||||
|
@synthesize lastMicEvent;
|
||||||
|
|
||||||
//init
|
//init
|
||||||
// create XPC connection & set remote obj interface
|
// create XPC connection & set remote obj interface
|
||||||
|
@ -824,6 +825,23 @@ bail:
|
||||||
//dbg msg
|
//dbg msg
|
||||||
os_log_debug(logHandle, "built in mic changed state to %ld", (long)state);
|
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?
|
//mic off?
|
||||||
if(NSControlStateValueOff == state)
|
if(NSControlStateValueOff == state)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1493,7 +1493,7 @@ NSMutableDictionary* execTask(NSString* binaryPath, NSArray* arguments, BOOL sho
|
||||||
bail:
|
bail:
|
||||||
|
|
||||||
//dbg msg
|
//dbg msg
|
||||||
os_log_debug(logHandle, "task completed with %@", results);
|
os_log_debug(logHandle, "task completed with %{public}@", results);
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue