我的视频处理应用程序发生奇怪的崩溃。它使用 AVFoundation 处理视频和音频,使用 GPUImage 进行过滤。我自己从未遇到过这个问题,但在将其发布到 App Store 后,它经常出现在 Crashlytics 中。这是崩溃的日志:
Thread : Crashed: AVPlayerItemOutput queue
0 libobjc.A.dylib 0x00000001986f80b4 objc_retain + 20
1 libsystem_blocks.dylib 0x0000000198d79bf8 _Block_object_assign + 320
2 AVFoundation 0x0000000186895a34 __copy_helper_block_171 + 36
3 libsystem_blocks.dylib 0x0000000198d79738 _Block_copy_internal + 384
4 libdispatch.dylib 0x0000000198d252fc _dispatch_Block_copy + 36
5 libdispatch.dylib 0x0000000198d2685c dispatch_async + 68
6 AVFoundation 0x00000001868959ac -[AVPlayerItemVideoOutput _dispatchOutputSequenceWasFlushed] + 112
7 libdispatch.dylib 0x0000000198d2536c _dispatch_client_callout + 16
8 libdispatch.dylib 0x0000000198d2e6e8 _dispatch_barrier_sync_f_invoke + 76
9 AVFoundation 0x00000001868940a8 AVPlayerItemVideoOutput_figVCSequentialAvailable + 196
10 MediaToolbox 0x000000018a3c16f8 FigVisualContextImageAvailableSequential + 108
11 MediaToolbox 0x000000018a348ce8 itemremote_postNotificationWithPayload + 3996
12 MediaToolbox 0x000000018a342d60 FigPlayerRemoteCallbacksServer_SendNotifyPing + 924
13 MediaToolbox 0x000000018a342998 _XSendNotifyPing + 60
14 MediaToolbox 0x000000018a33f0d4 figmoviecallbacks_server + 112
15 MediaToolbox 0x000000018a33f018 fpr_ClientPortCallBack + 208
16 CoreFoundation 0x0000000187f44ce0 __CFMachPortPerform + 180
17 CoreFoundation 0x0000000187f598fc __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 56
18 CoreFoundation 0x0000000187f5985c __CFRunLoopDoSource1 + 436
19 CoreFoundation 0x0000000187f577dc __CFRunLoopRun + 1640
20 CoreFoundation 0x0000000187e851f4 CFRunLoopRunSpecific + 396
21 GraphicsServices 0x00000001910135a4 GSEventRunModal + 168
22 UIKit 0x000000018c7b6784 UIApplicationMain + 1488
23 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 & Playback
extension 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 委托(delegate)时:
[playerItemOutput setDelegate:self queue:videoProcessingQueue],当 GPUImageMovie 实例解除分配时,playerItemOutput 不会释放其委托(delegate)。稍后,这会导致从已释放的对象 (outputSequenceWasFlushed:) 调用方法,然后发生崩溃。这是在 NSZombie 检测器的帮助下发现的,我通过在 GPUImageMovie dealloc 方法中添加它来修复它:[playerItemOutput setDelegate:nil queue:nil];
祝你好运,尼基塔 ;)
关于ios - __copy_helper_block_ 在 AVFoundation 中崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29103254/
为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar
我有一些Ruby代码,如下所示:Something.createdo|x|x.foo=barend我想编写一个测试,它使用double代替block参数x,这样我就可以调用:x_double.should_receive(:foo).with("whatever").这可能吗? 最佳答案 specify'something'dox=doublex.should_receive(:foo=).with("whatever")Something.should_receive(:create).and_yield(x)#callthere
我注意到像bundler这样的项目在每个specfile中执行requirespec_helper我还注意到rspec使用选项--require,它允许您在引导rspec时要求一个文件。您还可以将其添加到.rspec文件中,因此只要您运行不带参数的rspec就会添加它。使用上述方法有什么缺点可以解释为什么像bundler这样的项目选择在每个规范文件中都需要spec_helper吗? 最佳答案 我不在Bundler上工作,所以我不能直接谈论他们的做法。并非所有项目都checkin.rspec文件。原因是这个文件,通常按照当前的惯例,只
当我在Rails控制台中按向上或向左箭头时,出现此错误:irb(main):001:0>/Users/me/.rvm/gems/ruby-2.0.0-p247/gems/rb-readline-0.4.2/lib/rbreadline.rb:4269:in`blockin_rl_dispatch_subseq':invalidbytesequenceinUTF-8(ArgumentError)我使用rvm来管理我的ruby安装。我正在使用=>ruby-2.0.0-p247[x86_64]我使用bundle来管理我的gem,并且我有rb-readline(0.4.2)(人们推荐的最少
我在理解Enumerator.new方法的工作原理时遇到了一些困难。假设文档中的示例:fib=Enumerator.newdo|y|a=b=1loopdoy[1,1,2,3,5,8,13,21,34,55]循环中断条件在哪里,它如何知道循环应该迭代多少次(因为它没有任何明确的中断条件并且看起来像无限循环)? 最佳答案 Enumerator使用Fibers在内部。您的示例等效于:require'fiber'fiber=Fiber.newdoa=b=1loopdoFiber.yieldaa,b=b,a+bendend10.times.m
这里有一个很好的答案解释了如何在Ruby中下载文件而不将其加载到内存中:https://stackoverflow.com/a/29743394/4852737require'open-uri'download=open('http://example.com/image.png')IO.copy_stream(download,'~/image.png')我如何验证下载文件的IO.copy_stream调用是否真的成功——这意味着下载的文件与我打算下载的文件完全相同,而不是下载一半的损坏文件?documentation说IO.copy_stream返回它复制的字节数,但是当我还没有下
我正在尝试解析一个文本文件,该文件每行包含可变数量的单词和数字,如下所示:foo4.500bar3.001.33foobar如何读取由空格而不是换行符分隔的文件?有什么方法可以设置File("file.txt").foreach方法以使用空格而不是换行符作为分隔符? 最佳答案 接受的答案将slurp文件,这可能是大文本文件的问题。更好的解决方案是IO.foreach.它是惯用的,将按字符流式传输文件:File.foreach(filename,""){|string|putsstring}包含“thisisanexample”结果的
我没有理解以下行为(另请参阅inthisSOthread):defdef_testputs'def_test.in'yieldifblock_given?puts'def_test.out'enddef_testdoputs'def_testok'endblock_test=procdo|&block|puts'block_test.in'block.callifblockputs'block_test.out'endblock_test.calldoputs'block_test'endproc_test=procdoputs'proc_test.in'yieldifblock_gi
1.错误信息:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:requestcanceledwhilewaitingforconnection(Client.Timeoutexceededwhileawaitingheaders)或者:Errorresponsefromdaemon:Gethttps://registry-1.docker.io/v2/:net/http:TLShandshaketimeout2.报错原因:docker使用的镜像网址默认为国外,下载容易超时,需要修改成国内镜像地址(首先阿里
我需要尝试一些AES片段。我有一些密文c和一个keyk。密文已使用AES-CBC加密,并在前面加上IV。不存在填充,纯文本的长度是16的倍数。所以我这样做:aes=OpenSSL::Cipher::Cipher.new("AES-128-CCB")aes.decryptaes.key=kaes.iv=c[0..15]aes.update(c[16..63])+aes.final它工作得很好。现在我需要手动执行CBC模式,所以我需要单个block的“普通”AES解密。我正在尝试这个:aes=OpenSSL::Cipher::Cipher.new("AES-128-ECB")aes.dec