Post

Replies

Boosts

Views

Activity

AVSampleBufferDisplayLayer crash on flush
I am calling AVSampleBufferDisplayLayer.flush from a background queue but this seems to occasionally crash the app. I am calling it from the same thread I pass to - (void)requestMediaDataWhenReadyOnQueue:(dispatch_queue_t)queue usingBlock:(void (^)(void))block;. My question is, is this API threadsafe, or do I need to call flush from the main thread? Or is there another issue that I am not considering? It seems strange to me that this API would trigger an autolayout pass. 0 CoreFoundation 0x00000001bb384e38 __exceptionPreprocess + 164 1 libobjc.A.dylib 0x00000001b451b8d8 objc_exception_throw + 59 2 CoreAutoLayout 0x00000001d7e09e84 _AssertAutoLayoutOnAllowedThreadsOnly + 327 3 CoreAutoLayout 0x00000001d7e00e60 -[NSISEngine withBehaviors:performModifications:] + 35 4 UIKitCore 0x00000001be58fd40 -[UIView _postMovedFromSuperview:] + 671 5 UIKitCore 0x00000001bd56dfec -[UIView(Internal) _addSubview:positioned:relativeTo:] + 1903 6 UIKitCore 0x00000001bda57ccc -[_UITextLayoutCanvasView textViewportLayoutController:configureRenderingSurfaceForTextLayoutFragment:] + 455 7 UIFoundation 0x00000001c588bc9c __48-[NSTextViewportLayoutController layoutViewport]_block_invoke_4 + 151 8 UIFoundation 0x00000001c5836b50 __80-[NSTextLayoutManager enumerateViewportElementsFromLocation:options:usingBlock:]_block_invoke + 43 9 UIFoundation 0x00000001c580e158 __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke_2 + 535 10 CoreFoundation 0x00000001bb385350 __NSARRAY_IS_CALLING_OUT_TO_A_BLOCK__ + 23 11 CoreFoundation 0x00000001bb3b24dc -[__NSSingleObjectArrayI enumerateObjectsWithOptions:usingBlock:] + 91 12 UIFoundation 0x00000001c580de28 __83-[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:]_block_invoke + 775 13 UIFoundation 0x00000001c57f7504 -[NSTextLayoutManager enumerateTextLayoutFragmentsFromLocation:options:usingBlock:] + 659 14 UIFoundation 0x00000001c57f7264 -[NSTextLayoutManager enumerateViewportElementsFromLocation:options:usingBlock:] + 99 15 UIFoundation 0x00000001c57f6d7c -[NSTextViewportLayoutController layoutViewport] + 1299 16 UIKitCore 0x00000001bd580a3c +[UIView(Animation) performWithoutAnimation:] + 75 17 UIKitCore 0x00000001bd5582d0 -[_UITextLayoutCanvasView layoutSubviews] + 139 18 UIKitCore 0x00000001bd5544c8 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1979 19 QuartzCore 0x00000001bca277fc CA::Layer::layout_if_needed(CA::Transaction*) + 499 20 QuartzCore 0x00000001bca3aeb0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 147 21 QuartzCore 0x00000001bca4c234 CA::Context::commit_transaction(CA::Transaction*, double, double*) + 443 22 QuartzCore 0x00000001bca81630 CA::Transaction::commit() + 651 23 MediaToolbox 0x00000001ca8d0da0 videoQueueRemote_SetProperty + 367 24 AVFCore 0x00000001cad191b4 __63-[AVSampleBufferVideoRenderer _setContentLayerOnFigVideoQueue:]_block_invoke + 179 25 libdispatch.dylib 0x00000001c299cf88 _dispatch_client_callout + 19 26 libdispatch.dylib 0x00000001c29ac574 _dispatch_lane_barrier_sync_invoke_and_complete + 55 27 AVFCore 0x00000001cad190d0 -[AVSampleBufferVideoRenderer _setContentLayerOnFigVideoQueue:] + 167 28 AVFCore 0x00000001cad14674 -[AVSampleBufferVideoRenderer _createVideoQueue:errorStep:] + 195 29 AVFCore 0x00000001cad14ac8 -[AVSampleBufferVideoRenderer createVideoQueue:] + 55 30 AVFCore 0x00000001cad179cc -[AVSampleBufferVideoRenderer flushWithRemovalOfDisplayedImage:completionHandler:] + 439 31 App 0x0000000102370214 -[AVSampleBufferDisplayLayer flush] + 51
1
0
680
Mar ’23
AVSampleBufferDisplayLayer freezes UI on init
Hello, I am seeing an issue in my app where creating instances of AVSampleBufferDisplayLayer from AVFoundation is freezing the main UI in some circumstances for more than 5 seconds. Is there any workarounds for this?  I have not been able to reproduce this myself though. I am creating all instances of this class on the main thread. Here is the stack trace that is being logged. 0 libsystem_kernel.dylib:mach_msg_trap (in libsystem_kernel.dylib) + 8 1 MediaToolbox:FigVideoQueueRemoteClient_Create (in MediaToolbox) + 200 2 MediaToolbox:__FigVideoQueueCreateRemote_block_invoke (in MediaToolbox) + 100 3 CoreMedia:FigRPCCreateServerConnectionForObject (in CoreMedia) + 508 4 MediaToolbox:FigVideoQueueCreateRemote (in MediaToolbox) + 300 5 AVFCore:__49-[AVSampleBufferVideoRenderer _createVideoQueue:]_block_invoke (in AVFCore) + 48 6 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 7 libdispatch.dylib:_dispatch_lane_barrier_sync_invoke_and_complete (in libdispatch.dylib) + 56 8 AVFCore:-[AVSampleBufferVideoRenderer _createVideoQueue:] (in AVFCore) + 164 9 AVFCore:-[AVSampleBufferVideoRenderer init] (in AVFCore) + 528 10 AVFCore:-[AVSampleBufferDisplayLayer init] (in AVFCore) + 280 11 MyApplication:-[PlaybackView initWithFrame:] (in MyApplication) (PlaybackView.m:56) 12 MyApplication:__62-[CustomPlayer setupVideoDisplayLayerWithCompletion:]_block_invoke (in MyApplication) (CustomPlayer.m:730) 13 libdispatch.dylib:_dispatch_call_block_and_release (in libdispatch.dylib) + 32 14 libdispatch.dylib:_dispatch_client_callout (in libdispatch.dylib) + 20 15 libdispatch.dylib:_dispatch_main_queue_drain (in libdispatch.dylib) + 928 16 libdispatch.dylib:_dispatch_main_queue_callback_4CF (in libdispatch.dylib) + 44 17 CoreFoundation:__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ (in CoreFoundation) + 16 18 CoreFoundation:__CFRunLoopRun (in CoreFoundation) + 2532 19 CoreFoundation:CFRunLoopRunSpecific (in CoreFoundation) + 600 20 GraphicsServices:GSEventRunModal (in GraphicsServices) + 164 21 UIKitCore:-[UIApplication _run] (in UIKitCore) + 1100 22 UIKitCore:UIApplicationMain (in UIKitCore) + 364 23 LinkedIn:main (in LinkedIn) (main.m:37) 24 ???:24 ??? 0x000000010877dda4 0x0 + 0
2
0
1k
Nov ’22