jjzjj

iOS Speech-to-text AVAudioInputNode(?) 随机崩溃

coder 2024-01-12 原文

我的应用程序中有语音转文本功能,请按住按钮;一个 viewcontroller 从外部 windowbounds 动画进入 View 并开始录制,释放按钮;录制停止, View 在窗口范围外动画显示。

突然,我通过 Firebase Crashreporting 收到了一些崩溃报告,报告该功能在某些用户(2 个用户/5 个实例,所有相同的事件)上崩溃。下面是我的崩溃日志事件指向我的代码......但是,我根本无法重现错误,我可能已经尝试了 1000 次,压力加载(猴子按钮捣碎它等),它不会在我的设备上崩溃..

谁能帮我剖析底部/建议中的堆栈跟踪?/对出了什么问题有建议吗?我可以做些什么来稳定?

据我了解,它围绕着 installTapOnBus:0?对下一步有什么建议吗?

_audioEngine = [[AVAudioEngine alloc] init];
_speechRecognizer = [[SFSpeechRecognizer alloc] initWithLocale:[NSLocale localeWithLocaleIdentifier:@"da"]];
[_speechRecognizer setDelegate:self];
_request = [[SFSpeechAudioBufferRecognitionRequest alloc] init];


AVAudioInputNode *node =[_audioEngine inputNode];
AVAudioFormat *recordingFormat = [node outputFormatForBus:0];


[node installTapOnBus:0 bufferSize:1024 format:recordingFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {

        [_request appendAudioPCMBuffer:buffer];

    }];
}

堆栈跟踪:

1 CoreFoundation __exceptionPreprocess + 1232864

2 libobjc.A.dylib objc_exception_throw + 34100

3 CoreFoundation +[NSException raise:format:arguments:] + 1232560

4 AVFAudio AVAE_RaiseException(NSString*, ...) + 78280

5 AVFAudio AVAudioNodeImplBase::CreateRecordingTap(unsigned long, unsigned int, AVAudioFormat*, void (AVAudioPCMBuffer*, AVAudioTime*) block_pointer) + 554488

6 AVFAudio -[AVAudioNode installTapOnBus:bufferSize:format:block:] + 545144

7 shoppinglist 4295363296 + 297696

8 shoppinglist 4295358408 + 292808

9 UIKit -[UIViewController loadViewIfRequired] + 65212

10 UIKit -[UIViewController view] + 64152

11 shoppinglist 4295296168 + 230568

12 shoppinglist 4295272504 + 206904

13 shoppinglist 4295266368 + 200768

14 UIKit -[UIViewController _setViewAppearState:isAnimating:] + 162800

15 UIKit -[UIViewController __viewWillAppear:] + 162144

16 UIKit __56-[UIPresentationController runTransitionForCurrentState]_block_invoke + 3540196

17 UIKit _runAfterCACommitDeferredBlocks + 2738508

18 UIKit _cleanUpAfterCAFlushAndRunDeferredBlocks + 2681320

19 UIKit _afterCACommitHandler + 9796

20 CoreFoundation __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 895396

21 CoreFoundation __CFRunLoopDoObservers + 886316

22 CoreFoundation __CFRunLoopRun + 887416

23 CoreFoundation CFRunLoopRunSpecific + 36256

24 GraphicsServices GSEventRunModal + 49264

25 UIKit UIApplicationMain + 479316

26 shoppinglist 4295262124 + 196524

27 libdyld.dylib start + 17816

最佳答案

我也遇到过同样的崩溃,但现在已经修复了。所以你需要检查音频格式的速率:

AVAudioInputNode *node =[_audioEngine inputNode];
AVAudioFormat *recordingFormat = [node outputFormatForBus:0];

if (recordingFormat.sampleRate > 0)
{
    [node installTapOnBus:0 bufferSize:1024 format:recordingFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {

        [_request appendAudioPCMBuffer:buffer];

    }];
}

关于iOS Speech-to-text AVAudioInputNode(?) 随机崩溃,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44438649/

有关iOS Speech-to-text AVAudioInputNode(?) 随机崩溃的更多相关文章

  1. ruby - 检查 "command"的输出应该包含 NilClass 的意外崩溃 - 2

    为了将Cucumber用于命令行脚本,我按照提供的说明安装了arubagem。它在我的Gemfile中,我可以验证是否安装了正确的版本并且我已经包含了require'aruba/cucumber'在'features/env.rb'中为了确保它能正常工作,我写了以下场景:@announceScenario:Testingcucumber/arubaGivenablankslateThentheoutputfrom"ls-la"shouldcontain"drw"假设事情应该失败。它确实失败了,但失败的原因是错误的:@announceScenario:Testingcucumber/ar

  2. ruby-on-rails - rails : save file from URL and save it to Amazon S3 - 2

    从给定URL下载文件并立即将其上传到AmazonS3的更直接的方法是什么(+将有关文件的一些信息保存到数据库中,例如名称、大小等)?现在,我既不使用Paperclip,也不使用Carrierwave。谢谢 最佳答案 简单明了:require'open-uri'require's3'amazon=S3::Service.new(access_key_id:'KEY',secret_access_key:'KEY')bucket=amazon.buckets.find('image_storage')url='http://www.ex

  3. ruby - 续集在添加关联时访问many_to_many连接表 - 2

    我正在使用Sequel构建一个愿望list系统。我有一个wishlists和itemstable和一个items_wishlists连接表(该名称是续集选择的名称)。items_wishlists表还有一个用于facebookid的额外列(因此我可以存储opengraph操作),这是一个NOTNULL列。我还有Wishlist和Item具有续集many_to_many关联的模型已建立。Wishlist类也有:selectmany_to_many关联的选项设置为select:[:items.*,:items_wishlists__facebook_action_id].有没有一种方法可以

  4. ruby-on-rails - rails : How to make a form post to another controller action - 2

    我知道您通常应该在Rails中使用新建/创建和编辑/更新之间的链接,但我有一个情况需要其他东西。无论如何我可以实现同样的连接吗?我有一个模型表单,我希望它发布数据(类似于新View如何发布到创建操作)。这是我的表格prohibitedthisjobfrombeingsaved: 最佳答案 使用:url选项。=form_for@job,:url=>company_path,:html=>{:method=>:post/:put} 关于ruby-on-rails-rails:Howtomak

  5. Ruby Readline 在向上箭头上使控制台崩溃 - 2

    当我在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)(人们推荐的最少

  6. ruby-on-rails - link_to 不显示任何 rails - 2

    我试图在索引页中创建一个超链接,但它没有显示,也没有给出任何错误。这是我的index.html.erb代码。ListingarticlesTitleTextssss我检查了我的路线,我认为它们也没有问题。PrefixVerbURIPatternController#Actionwelcome_indexGET/welcome/index(.:format)welcome#indexarticlesGET/articles(.:format)articles#indexPOST/articles(.:format)articles#createnew_articleGET/article

  7. ruby - 无法覆盖 irb 中的 to_s - 2

    我在pry中定义了一个函数:to_s,但我无法调用它。这个方法去哪里了,怎么调用?pry(main)>defto_spry(main)*'hello'pry(main)*endpry(main)>to_s=>"main"我的ruby版本是2.1.2看了一些答案和搜索后,我认为我得到了正确的答案:这个方法用在什么地方?在irb或pry中定义方法时,会转到Object.instance_methods[1]pry(main)>defto_s[1]pry(main)*'hello'[1]pry(main)*end=>:to_s[2]pry(main)>defhello[2]pry(main)

  8. ruby-on-rails - 错误 : Error installing pg: ERROR: Failed to build gem native extension - 2

    我克隆了一个rails仓库,我现在正尝试捆绑安装背景:OSXElCapitanruby2.2.3p173(2015-08-18修订版51636)[x86_64-darwin15]rails-v在您的Gemfile中列出的或native可用的任何gem源中找不到gem'pg(>=0)ruby​​'。运行bundleinstall以安装缺少的gem。bundleinstallFetchinggemmetadatafromhttps://rubygems.org/............Fetchingversionmetadatafromhttps://rubygems.org/...Fe

  9. ruby-on-rails - Prawn PDF : I need to generate nested tables - 2

    我需要一个表,其中行实际上是2行表,一个嵌套表是..我怎样才能在Prawn中做到这一点?也许我需要延期..但哪一个? 最佳答案 现在支持子表:Prawn::Document.generate("subtable.pdf")do|pdf|subtable=pdf.make_table([["sub"],["table"]])pdf.table([[subtable,"original"]])end 关于ruby-on-rails-PrawnPDF:Ineedtogeneratenested

  10. ruby - rails 3 redirect_to 将参数传递给命名路由 - 2

    我没有找到太多关于如何执行此操作的信息,尽管有很多关于如何使用像这样的redirect_to将参数传递给重定向的建议:action=>'something',:controller=>'something'在我的应用程序中,我在路由文件中有以下内容match'profile'=>'User#show'我的表演Action是这样的defshow@user=User.find(params[:user])@title=@user.first_nameend重定向发生在同一个用户Controller中,就像这样defregister@title="Registration"@user=Use

随机推荐