VTDecompressionSessionInvalidate线程卡死挂起导致的解码问题

在使用VideoToolbox进行解码时遇到错误12902,参数错误导致VTDecompressionSessionInvalidate线程挂起。线程在释放时出现同样问题。通过检查NALU类型和数据源,发现可能的数据错误。将VTDecompressionSessionInvalidate操作放在另一线程可避免卡死,但非根本解决方案。相关错误枚举和文章提供了解决思路。
摘要由CSDN通过智能技术生成

Decode Error

VideoToolBox解码时,VTDecompressionSessionDecodeFrame返回错误12902,kVTParameterErr = -12902
即参数错误,然后在VTDecompressionSessionInvalidate的时候,就发现线程卡死挂起了
同样操作VTDecompressionSessionWaitForAsynchronousFrames也是一样的,VTDecompressionSessionInvalidate里面也操作了VTDecompressionSessionWaitForAsynchronousFrames

CMItemCount count = CMSampleBufferGetNumSamples(sampleBuffer);
if (count > 0) {
   
    //解码
    //向视频解码器提示使用低功耗模式是可以的
    uint32_t decoder_flags          = 0;
    decoder_flags |= kVTDecodeFrame_EnableAsynchronousDecompression;
    decoder_flags |= kVTDecodeFrame_1xRealTimePlayback;
    //异步解码
    VTDecodeInfoFlags  flagOut = kVTDecodeInfo_Asynchronous;
    NSDate* currentTime = [NSDate date];
    status = VTDecompressionSessionDecodeFrame(_decompressionSession, sampleBuffer, decoder_flags,
                                               (void*)CFBridgingRetain(currentTime), &flagOut);
    if (status == kVTInvalidSessionErr) {
   
        GSLog(@"Video hard decode  InvalidSessionErr status = %d ,nalutype : %d", (int)status,nalu_type);
    } else if (status == kVTVideoDecoderBadDataErr) {
   
        GSLog(@"Video hard decode  BadData status = %d ,nalutype : %d", (int)status,nalu_type);
    } else if (status 
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值