解码HEVC时,iOS VTDecompressionDecodeFrame错误-12909

解码HEVC时,iOS VTDecompressionDecodeFrame错误-12909,ios,video-streaming,hevc,h.265,video-toolbox,Ios,Video Streaming,Hevc,H.265,Video Toolbox,使用VTDecompressionDecodeFrame时,我在rtsp上传输原始H.265时遇到一些问题。我做的3个主要步骤如下: OSStatus status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault, 3, parameterSetPointers, parameterSetSizes, (int)kNALUHeaderSize, NULL, &formatDescripti

使用VTDecompressionDecodeFrame时,我在rtsp上传输原始H.265时遇到一些问题。我做的3个主要步骤如下:

OSStatus status = CMVideoFormatDescriptionCreateFromHEVCParameterSets(kCFAllocatorDefault, 3, parameterSetPointers, parameterSetSizes, (int)kNALUHeaderSize, NULL, &formatDescription);

OSStatus status = VTDecompressionSessionCreate(NULL, formatDescription, NULL, NULL, &decompressionCallBack, &_decompressionSession);

VTDecompressionSessionDecodeFrame(self.decompressionSession, sampleBuffer, flags, (void *)CFBridgingRetain(currentTime), NULL);
格式说明如下所示:

<CMVideoFormatDescription 0x1c0044d10 [0x1b2bb1310]> {
mediaType:'vide' 
mediaSubType:'hvc1' 
mediaSpecific: {
    codecType: 'hvc1'       dimensions: 640 x 360 
} 
extensions: {<CFBasicHash 0x1c00742c0 [0x1b2bb1310]>{type = immutable dict, count = 10,
entries =>
0 : <CFString 0x1ab8dd470 [0x1b2bb1310]>{contents = "SampleDescriptionExtensionAtoms"} = <CFBasicHash 0x1c0074140 [0x1b2bb1310]>{type = immutable dict, count = 1,
entries =>
0 : hvcC = <CFData 0x1c01678c0 [0x1b2bb1310]>{length = 115, capacity = 115, bytes = 0x01016000000000008000000042f000fc ... 4401d172b0942b12}
}

1 : <CFString 0x1ab8b8ff8 [0x1b2bb1310]>{contents = "CVImageBufferYCbCrMatrix"} = <CFString 0x1ab8b9018 [0x1b2bb1310]>{contents = "ITU_R_709_2"}
2 : <CFString 0x1ab8b92b8 [0x1b2bb1310]>{contents = "CVImageBufferChromaLocationTopField"} = <CFString 0x1ab8b92f8 [0x1b2bb1310]>{contents = "Left"}
3 : <CFString 0x1ab8b8f38 [0x1b2bb1310]>{contents = "CVPixelAspectRatio"} = <CFBasicHash 0x1c0074280 [0x1b2bb1310]>{type = immutable dict, count = 2,
entries =>
1 : <CFString 0x1ab8b8f58 [0x1b2bb1310]>{contents = "HorizontalSpacing"} = <CFNumber 0xb000000000000012 [0x1b2bb1310]>{value = +1, type = kCFNumberSInt32Type}
2 : <CFString 0x1ab8b8f78 [0x1b2bb1310]>{contents = "VerticalSpacing"} = <CFNumber 0xb000000000000012 [0x1b2bb1310]>{value = +1, type = kCFNumberSInt32Type}
}

5 : <CFString 0x1ab8b90d8 [0x1b2bb1310]>{contents = "CVImageBufferColorPrimaries"} = <CFString 0x1ab8b9018 [0x1b2bb1310]>{contents = "ITU_R_709_2"}
6 : <CFString 0x1ab8dd670 [0x1b2bb1310]>{contents = "FullRangeVideo"} = <CFBoolean 0x1b2bb1868 [0x1b2bb1310]>{value = true}
8 : <CFString 0x1ab8b9158 [0x1b2bb1310]>{contents = "CVImageBufferTransferFunction"} = <CFString 0x1ab8b9018 [0x1b2bb1310]>{contents = "ITU_R_709_2"}
10 : <CFString 0x1ab8b92d8 [0x1b2bb1310]>{contents = "CVImageBufferChromaLocationBottomField"} = <CFString 0x1ab8b92f8 [0x1b2bb1310]>{contents = "Left"}
11 : <CFString 0x1ab8ddc10 [0x1b2bb1310]>{contents = "BitsPerComponent"} = <CFNumber 0xb000000000000080 [0x1b2bb1310]>{value = +8, type = kCFNumberSInt8Type}
12 : <CFString 0x1ab8b8e78 [0x1b2bb1310]>{contents = "CVFieldCount"} = <CFNumber 0xb000000000000012 [0x1b2bb1310]>{value = +1, type = kCFNumberSInt32Type}
}
}
}
{
媒体类型:'vide'
媒体子类型:“hvc1”
特定媒体:{
编解码器类型:“hvc1”尺寸:640 x 360
} 
扩展名:{{type=immutable dict,count=10,
条目=>
0:{contents=“SampleDescriptionExtensionAtoms”}={type=不可变的dict,count=1,
条目=>
0:hvcC={length=115,capacity=115,bytes=0x010160000000000800000042F000FC…4401d172b0942b12}
}
1:{contents=“CVImageBufferYCbCrMatrix”}={contents=“ITU__709_2”}
2:{contents=“CVImageBufferChromaLocationTopField”}={contents=“Left”}
3:{contents=“CVPixelAspectRatio”}={type=immutable dict,count=2,
条目=>
1:{contents=“horizontalspacking”}={value=+1,type=kCFNumberSInt32Type}
2:{contents=“verticalspacting”}={value=+1,type=kCFNumberSInt32Type}
}
5:{contents=“CVImageBufferColorPrimaries”}={contents=“ITU__709_2”}
6:{contents=“FullRangeVideo”}={value=true}
8:{contents=“CVImageBufferTransferFunction”}={contents=“ITU__709_2”}
10:{contents=“CVImageBufferChromaLocationBottomField”}={contents=“Left”}
11:{contents=“BitsPerComponent”}={value=+8,type=kCFNumberSInt8Type}
12:{contents=“CVFieldCount”}={value=+1,type=kCFNumberSInt32Type}
}
}
}
解码帧时,我在解压回调中得到OSStatus-12909。因此,我认为在创建格式描述时正确处理了VPS、PPS和SPS。解压会话也已成功创建。我还可以成功解码并呈现HEVC流,例如: 如果将CMVideoFormatDescriptionCreateFromHEVCParameterSets更改为CMVideoFormatDescriptionCreatefromH264参数集,则该解决方案在流式传输原始H.264时也可以工作

你知道什么是错的吗?是否支持格式描述?遗憾的是,苹果方面并没有太多关于HEVC解码的文档。 如果使用ffmpeg,我可以传输我的H.265流,所以我想应该正确格式化流