Ios 为什么AVSampleBufferDisplayLayer在操作中断(-11847)时失败?
我正在使用一个Ios 为什么AVSampleBufferDisplayLayer在操作中断(-11847)时失败?,ios,h.264,video-toolbox,Ios,H.264,Video Toolbox,我正在使用一个AVSampleBufferDisplayLayer来解码和显示从服务器传输的H.264视频。当我的应用程序进入后台,然后返回前台时,解码过程就会出错,AVSampleBufferDisplayLayer会失败。我看到的错误是: H.264 decoding layer has failed: Error Domain=AVFoundationErrorDomain Code=-11847 "Operation Interrupted" UserInfo=0x17426c500
AVSampleBufferDisplayLayer
来解码和显示从服务器传输的H.264视频。当我的应用程序进入后台,然后返回前台时,解码过程就会出错,AVSampleBufferDisplayLayer
会失败。我看到的错误是:
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
时遇到过类似的问题吗?这是什么意思
我尝试过销毁AVSampleBufferDisplayLayer
并在收到错误时创建一个新的层,但随后我开始从H.264解码器接收其他错误:
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
失败之前,我没有收到任何错误。重建新的AVSampleBufferDisplayLayer后,应将其与最后一个最近的IDR帧(当前帧是IDR除外)排队,这意味着,解码时应将NALU保存在一个GOP中,并在下一个IDR到来时将其删除。我解决了这个问题
// create renderer
let renderingLayer = AVSampleBufferDisplayLayer()
// when enqueue data
if renderingLayer.status == .failed {
// this way
renderingLayer.flushAndRemoveImage()
}
你找到解决办法了吗?为什么它从后台出来后就停止解码?我也有同样的问题。我必须创建一个新的
AVSampleBufferDisplayLayer
,每次它扩展应用程序时。但这给了我几秒钟的黑屏,这是不好的。我从来没有找到解决这个问题的办法。更糟糕的是,我开始从AVSampleBufferDisplayLayer
的内部崩溃,它看起来像是过度扩展了一些内部对象。我已经完全停止使用AVSampleBufferDisplayLayer
。目前正试图找出如何直接使用VTDecompressionSession的输出。哦,这是个坏消息。我申请了一张苹果支持的罚单。当我们在模拟器上运行project时,发生了相同的错误,NSLocalizedFailureReason=找不到此媒体所需的编码器,、NSLocalizedDescription=无法编码、AVErrorMediaTypeKey=vide}、{AverRorMediaSubsubKey=(1785750887);AverorMediaTypeKey=vide;NSLocalizedDescription=“无法编码”;NSLocalizedFailureReason=“找不到此媒体所需的编码器。”;}。我没有再次尝试使用AVSampleBufferDisplayLayer
。我们成功地使用了VTDecompressionSession
并将其渲染为GLKView
。