ios – __copy_helper_block_在AVFoundation中崩溃

ios – __copy_helper_block_在AVFoundation中崩溃,第1张

概述我的视频处理应用程序中发生了一次奇怪的崩溃.它使用AVFoundation处理视频和视频.用于过滤的音频和GPU Image.我自己从未遇到过这个问题,但在将它发布到App Store之后,它经常出现在Crashlytics中.这是崩溃的日志: Thread : Crashed: AVPlayerItemOutput queue0 libobjc.A.dylib 我的视频处理应用程序中发生了一次奇怪的崩溃.它使用AVFoundation处理视频和视频.用于过滤的音频和GPU Image.我自己从未遇到过这个问题,但在将它发布到App Store之后,它经常出现在Crashlytics中.这是崩溃的日志:
Thread : Crashed: AVPlayerItemOutput queue0  libobjc.A.dylib                0x00000001986f80b4 objc_retain + 201  libsystem_blocks.dylib         0x0000000198d79bf8 _Block_object_assign + 3202  AVFoundation                   0x0000000186895a34 __copy_helper_block_171 + 363  libsystem_blocks.dylib         0x0000000198d79738 _Block_copy_internal + 3844  libdispatch.dylib              0x0000000198d252fc _dispatch_Block_copy + 365  libdispatch.dylib              0x0000000198d2685c dispatch_async + 686  AVFoundation                   0x00000001868959ac -[AVPlayerItemVIDeoOutput _dispatchOutputSequenceWasFlushed] + 1127  libdispatch.dylib              0x0000000198d2536c _dispatch_clIEnt_callout + 168  libdispatch.dylib              0x0000000198d2e6e8 _dispatch_barrIEr_sync_f_invoke + 769  AVFoundation                   0x00000001868940a8 AVPlayerItemVIDeoOutput_figVCSequentialAvailable + 19610 MediaToolBox                   0x000000018a3c16f8 figVisualContextimageAvailableSequential + 10811 MediaToolBox                   0x000000018a348ce8 itemremote_postNotificationWithPayload + 399612 MediaToolBox                   0x000000018a342d60 figPlayerRemoteCallbacksServer_SendNotifyPing + 92413 MediaToolBox                   0x000000018a342998 _XSendNotifyPing + 6014 MediaToolBox                   0x000000018a33f0d4 figmovIEcallbacks_server + 11215 MediaToolBox                   0x000000018a33f018 fpr_ClIEntPortCallBack + 20816 CoreFoundation                 0x0000000187f44ce0 __CFMachPortPerform + 18017 CoreFoundation                 0x0000000187f598fc __CFRUNLOOP_IS_CALliNG_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 5618 CoreFoundation                 0x0000000187f5985c __CFRunLoopDoSource1 + 43619 CoreFoundation                 0x0000000187f577dc __CFRunLoopRun + 164020 CoreFoundation                 0x0000000187e851f4 CFRunLoopRunspecific + 39621 GraphiCSServices               0x00000001910135a4 GSEventRunModal + 16822 UIKit                          0x000000018c7b6784 UIApplicationMain + 148823 MerryVIDeoEditor               0x000000010024b804 main (main.m:16)24 libdyld.dylib                  0x0000000198d4ea08 start + 4

这就是我将AVFoundation连接到GPUImage的方法:

class ProjectEditorVIEwController: UIVIEwController {   private var vIDeoPlayerVIEw = VIDeoPlayerVIEw()   private var movIEfile: GPUImageMovIE!      private var currentComposition: AVComposition!   //...and other propertIEs}// MARK: - Filtering & Playbackextension ProjectEditorVIEwController{   func updatePlayer() {      currentFilter.removeAllTargets()      movIEfile?.removeAllTargets()      movIEfile?.endProcessing()      let time = self.vIDeoPlayerVIEw.player?.currentItem.currentTime() ?? kCMTimeZero      let (composition,audioMix) = compositionBuilder.buildCompositionFromTimeline(timeline)      vIDeoPlayerVIEw.setAsset(composition)      vIDeoPlayerVIEw.playerItem.audioMix = audioMix      movIEfile = GPUImageMovIE(playerItem: vIDeoPlayerVIEw.player.currentItem)      currentFilter.applyFromOutput(movIEfile,toinput: gpuPlayerVIEw)      movIEfile.startProcessing()      addSyncLayerIfNeededForComposition(composition)      vIDeoPlayerVIEw.player.seektotime(time,toleranceBefore: kPlayerToleranceSeekTime,toleranceAfter: kPlayerToleranceSeekTime)      currentComposition = composition   }   func updatePlayerFilter(){                if movIEfile != nil{         movIEfile.removeAllTargets()         currentFilter.applyFromOutput(movIEfile,toinput: gpuPlayerVIEw)         if(!vIDeoPlayerVIEw.isPlaying) { movIEfile.startProcessing() }         addSyncLayerIfNeededForComposition(currentComposition)      }else{         updatePlayer()      }   }       }

任何想法我的代码有什么问题?任何问题,评论,提示和答案都非常感谢.

解决方法 这是GPUImageMovIE中的一个问题 – 当实例将自身添加为AVPlayerItemVIDeoOutput委托时:
[playerItemOutput setDelegate:self queue:vIDeoProcessingQueue],当GPUImageMovIE实例解除分配时,playerItemOutput不释放其委托.稍后,这会导致来自释放对象的方法调用(outputSequenceWasFlushed :),然后您就会崩溃.这是在NSZombIE探测器的帮助下找到的,我通过在GPUImageMovIE dealloc方法中添加它来修复它:[playerItemOutput setDelegate:nil queue:nil];

祝你好运,尼基塔;)

总结

以上是内存溢出为你收集整理的ios – __copy_helper_block_在AVFoundation中崩溃全部内容,希望文章能够帮你解决ios – __copy_helper_block_在AVFoundation中崩溃所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1107613.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-28
下一篇 2022-05-28

发表评论

登录后才能评论

评论列表(0条)

保存