为什么AVSampleBufferDisplayLayer会因操作中断(-11847)而失败? [英] Why does AVSampleBufferDisplayLayer fail with Operation Interrupted (-11847)?

查看:409
本文介绍了为什么AVSampleBufferDisplayLayer会因操作中断(-11847)而失败?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用AVSampleBufferDisplayLayer解码和显示从服务器流式传输的H.264视频.当我的应用进入后台,然后返回到前台时,解码过程搞砸了,AVSampleBufferDisplayLayer失败了.我看到的错误是:

I'm using an AVSampleBufferDisplayLayer to decode and display H.264 video streamed from a server. When my app goes into the background and then returns to the foreground, the decoding process gets screwed up and the AVSampleBufferDisplayLayer fails. The error I'm seeing is:

H.264 decoding layer has failed: Error Domain=AVFoundationErrorDomain
  Code=-11847 "Operation Interrupted" UserInfo=0x17426c500
  {NSUnderlyingError=0x17805fe90 "The operation couldn’t be completed.
    (OSStatus error -12084.)",
   NSLocalizedRecoverySuggestion=Stop other operations and try again.,
   NSLocalizedDescription=Operation Interrupted}

是否还有其他人遇到AVSampleBufferDisplayLayer这样的问题?这是什么意思?

Has anybody else run into issues like this with AVSampleBufferDisplayLayer? What does this mean?

我尝试销毁AVSampleBufferDisplayLayer并在收到错误时创建一个新的错误,但是随后我开始从H.264解码器接收其他错误:

I have tried destroying the AVSampleBufferDisplayLayer and creating a new one when I get the error, but then I start receiving other errors from the H.264 decoder:

Error Domain=AVFoundationErrorDomain Code=-11821 "Cannot Decode"
UserInfo=0x1740e9700 {AVErrorMediaSubTypeKey=(1635148593),
  NSLocalizedFailureReason=The media data could not be decoded. It may be damaged.,
  NSUnderlyingError=0x174247680 "The operation couldn’t be completed. (OSStatus error -12909.)",
  AVErrorMediaTypeKey=vide,
  AVErrorPresentationTimeStampKey=CMTime: {7/30 = 0.233},
  NSLocalizedDescription=Cannot Decode}

AVSampleBufferDisplayLayer失败之前,我没有收到任何这些错误.

I was not receiving any of those errors before the AVSampleBufferDisplayLayer failed.

推荐答案

重建新的AVSampleBufferDisplayLayer后,应使用最近的IDR帧将其入队,但当前帧是IDR,这意味着应将纳达尔保存在一个解码时为GOP,下一个IDR出现时将其删除.

After you rebuild a new AVSampleBufferDisplayLayer, you should enqueue it with the last nearest IDR frame except current frame is the IDR, which means, you should save nalus in one GOP when decoding and delete them when next IDR is coming.

这篇关于为什么AVSampleBufferDisplayLayer会因操作中断(-11847)而失败?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆