0

I get this problem from online app not responding report, call stack cases as below:

case 1: AVAudioSession create sharedInstance

MediaPlayer -[MPAVLightweightRoutingController initWithName:] + 204
AudioSession +[AVAudioSession sharedInstance] + 144
libdispatch.dylib __dispatch_once_callout + 32
libdispatch.dylib __dispatch_client_callout + 20
AudioSession ___32+[AVAudioSession sharedInstance]_block_invoke + 68
AudioSession -[AVAudioSession initWithSessionType:] + 20
AudioSession -[AVAudioSession initWithSessionType:identifier:] + 300
AudioSession __ZN8avfaudio16SessionConnector7ConnectEP14AVAudioSessionN10applesauce2CF9ObjectRefIP11__CFRunLoopEE16AudioSessionTypeP8NSString + 124
AudioToolbox _AudioSessionCreateSessionWithIdentifier_Priv + 540
AudioToolbox __ZN18AudioSessionClient28InitializeAudioSessionClientEP11__CFRunLoopPK10__CFStringPFvPvjES5_16AudioSessionTypeS4_j + 824
libdispatch.dylib __dispatch_lane_barrier_sync_invoke_and_complete + 56
libdispatch.dylib __dispatch_client_callout + 20
AudioToolbox ____ZN25AudioSessionClientManager19CreatePrimaryClientEP11__CFRunLoopPK10__CFStringPFvPvjES5__block_invoke + 116
AudioToolbox __ZNSt3__115allocate_sharedI18AudioSessionClientNS_9allocatorIS1_EEJRP11__CFRunLoopRPK10__CFStringRPFvPvjERSB_16AudioSessionTypeiEvEENS_10shared_ptrIT_EERKT0_DpOT1_ + 128
AudioToolbox __ZN18AudioSessionClientC2EP11__CFRunLoopPK10__CFStringPFvPvjES5_16AudioSessionTypeS4_j + 1144
libsystem_kernel.dylib _mach_msg + 72
libsystem_kernel.dylib _mach_msg_trap + 8

case 2: MPAVLightweightRoutingController create instance

MediaPlayer -[MPVolumeView initWithFrame:style:] + 80
MediaPlayer -[MPVolumeView _initWithStyle:] + 124
MediaPlayer -[MPAVLightweightRoutingController initWithName:] + 140
AVFCore -[AVOutputDeviceDiscoverySession initWithDeviceFeatures:] + 84
AVFCore -[AVFigRouteDiscovererOutputDeviceDiscoverySessionFactory outputDeviceDiscoverySessionOfClass:withDeviceFeatures:] + 216
AVFCore -[AVFigRouteDiscovererOutputDeviceDiscoverySessionImpl initWithFigRouteDiscovererCreator:syncController:] + 156
AVFCore _AVFigRouteDiscovererFactoryCreateRouteDiscovererWithType + 132
AVFCore -[AVFigRemoteRouteDiscovererFactory createRouteDiscovererWithAllocator:options:] + 40
MediaExperience _FigRouteDiscovererXPCRemoteCreate + 912
CoreMedia _FigXPCRemoteClientSendSyncMessageCreatingReply + 40
libxpc.dylib _xpc_connection_send_message_with_reply_sync + 228
libdispatch.dylib _dispatch_mach_send_with_result_and_wait_for_reply + 60
libdispatch.dylib __dispatch_mach_send_and_wait_for_reply + 532
libsystem_kernel.dylib _mach_msg + 72
libsystem_kernel.dylib _mach_msg_trap + 8

case 3: MPAVLightweightRoutingController pickedRoutes

MediaPlayer -[MPVolumeView layoutSubviews] + 200
MediaPlayer -[MPVolumeView _setShowsVolumeSlider:] + 104
MediaPlayer -[MPAVLightweightRoutingController pickedRoutes] + 60
AVFCore -[AVFigRouteDescriptorFigRoutingContextOutputDeviceTranslator outputDevicesFromRoutingContext:] + 180
MediaExperience _routingContextResilientRemote_CopySelectedRouteDescriptors + 92
MediaExperience _routingContextResilientRemote_withRemoteContext + 128
MediaExperience _routingContextRemoteXPC_CopySelectedRouteDescriptors + 80
CoreMedia _FigXPCRemoteClientSendSyncMessageCreatingReply + 40
libxpc.dylib _xpc_connection_send_message_with_reply_sync + 228
libdispatch.dylib _dispatch_mach_send_with_result_and_wait_for_reply + 60
libdispatch.dylib __dispatch_mach_send_and_wait_for_reply + 532
libsystem_kernel.dylib _mach_msg + 72
libsystem_kernel.dylib _mach_msg_trap + 8

All of this problems block for sync wait for xpc result, MPVolumeView is subclass of UIView and should be used on main thread, and cause block on main thread for about 5 second(our online app not responding report threshold is 5 second).

AVAudioSession problem can be fixed by dispatch to background thread.

As for MPVolumeView must be used on main thread, dispatch to background thread is not a reasonable solution.

So what's the right solution?

same problem found on YouTube: https://pastebin.com/ydVXhhFX

John
  • 65
  • 9

0 Answers0