Why does AVSampleBufferDisplayLayer fail with Operation Interrupted (-11847)?

非 Y 不嫁゛ 提交于 2019-12-22 06:56:41

问题


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}

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

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}

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


回答1:


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.



来源:https://stackoverflow.com/questions/28841903/why-does-avsamplebufferdisplaylayer-fail-with-operation-interrupted-11847

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!