Hello. In iOS16, I faced the problem that main thread become deadlock when call copyNextSampleBuffer method in AVAssetReaderOutput in requestMediaDataWhenReady method of AVAssetWriterInput.
Main thread become deadlock sometimes and main thread's call stack like below.
Thread 1 Queue : com.apple.main-thread (serial)
#0 0x00000001ebd73b48 in mach_msg2_trap ()
#1 0x00000001ebd86008 in mach_msg2_internal ()
#2 0x00000001ebd86248 in mach_msg_overwrite ()
#3 0x00000001ebd7408c in mach_msg ()
#4 0x00000001b0059564 in CA::Render::Message::send_message() ()
#5 0x00000001b0235084 in CA::Render::Encoder::send_message(unsigned int, unsigned int, unsigned int*, unsigned long) ()
#6 0x00000001b0002274 in CA::Context::commit_transaction(CA::Transaction*, double, double*) ()
#7 0x00000001b0035148 in CA::Transaction::commit() ()
#8 0x00000001b001e4c8 in CA::Transaction::flush_as_runloop_observer(bool) ()
#9 0x00000001b1004870 in _UIApplicationFlushCATransaction ()
#10 0x00000001b1151c78 in _UIUpdateSequenceRun ()
#11 0x00000001b17958f8 in schedulerStepScheduledMainSection ()
#12 0x00000001b1794ac4 in runloopSourceCallback ()
#13 0x00000001aea32394 in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ ()
#14 0x00000001aea3e76c in __CFRunLoopDoSource0 ()
#15 0x00000001ae9c2650 in __CFRunLoopDoSources0 ()
#16 0x00000001ae9d7fe8 in __CFRunLoopRun ()
#17 0x00000001ae9dd314 in CFRunLoopRunSpecific ()
#18 0x00000001e851f368 in GSEventRunModal ()
#19 0x00000001b0ea23e8 in -[UIApplication _run] ()
#20 0x00000001b0ea204c in UIApplicationMain ()
#21 0x000000010506f918 in main at /Users/user/Desktop/LINE/QA/line-ios/Talk/AppDelegate.swift:72
#22 0x00000001cd8d9960 in start ()
I tried to delay some logic to call markAsFinished and finishWriting methods of AVAssetWriter but that couldn't solve this problem.
Is there anyone to experience same issue as me?
If so, let me know what is workaround code if you solve this problem?