Call cannot be disconnected due to delay observed in AudioOutputUnitStop API

We have a VOIP calling application that releases resources at the end of call. When the AudioOutputUnitStop API is invoked, it takes upto 700millisecond to return back sometimes. If we comment that API call as a test then the AudioUnitUninitialize API takes upto 700ms. Once the cleanup is done, as part of the call flow, the application invokes a BYE SIP message. Hence in cases where the API takes more than 200 ms, the Bye message is sent with that much delay and gets blocked as per the server DDOS settings. (DDOS timer will start as soon as a the UDP socket is disconnected with the client and will timeout within 200 ms and Bye request coming post that time will get blocked) We need to understand why there is a delay of more than 200ms observed sometimes while in other cases it requires less than 50ms?

Hello @Adhakde, thank you for your post. You might be able to work around this issue by not waiting for AudioOutputUnitStop or AudioUnitUninitialize to finish before you message your server. If your current logic is synchronous, an asynchronous design could help you release resources and message your server at the same time.

Call cannot be disconnected due to delay observed in AudioOutputUnitStop API
 
 
Q