I'm trying to decode a raw stream of .H264 video data but I can't find a way to create a proper
    - (void)decodeFrameWithNSData:(NSData*)data presentationTime:
(CMTime)presentationTime
{
    @autoreleasepool {
    CMSampleBufferRef sampleBuffer = NULL;
    CMBlockBufferRef blockBuffer = NULL;
    VTDecodeInfoFlags infoFlags;
    int sourceFrame;
    if( dSessionRef == NULL )
        [self createDecompressionSession];
    CMSampleTimingInfo timingInfo ;
    timingInfo.presentationTimeStamp = presentationTime;
    timingInfo.duration =  CMTimeMake(1,100000000);
    timingInfo.decodeTimeStamp = kCMTimeInvalid;
    //Creates block buffer from NSData
    OSStatus status  = CMBlockBufferCreateWithMemoryBlock(CFAllocatorGetDefault(), (void*)data.bytes,data.length*sizeof(char), CFAllocatorGetDefault(), NULL, 0, data.length*sizeof(char), 0, &blockBuffer);
    //Creates CMSampleBuffer to feed decompression session    
    status = CMSampleBufferCreateReady(CFAllocatorGetDefault(), blockBuffer,self.encoderVideoFormat,1,1,&timingInfo, 0, 0, &sampleBuffer);
    status = VTDecompressionSessionDecodeFrame(dSessionRef,sampleBuffer, kVTDecodeFrame_1xRealTimePlayback, &sourceFrame,&infoFlags);
    if(status != noErr) {
        NSLog(@"Decode with data error %d",status);
    }
    }
}
At the end of the call I'm getting -12911 error in VTDecompressionSessionDecodeFrame that translates to kVTVideoDecoderMalfunctionErr which after reading this [post] pointed me that I should make a VideoFormatDescriptor using CMVideoFormatDescriptionCreateFromH264ParameterSets. But how can I create a new VideoFormatDescription if I don't have information of the currentSps or currentPps? How can I get that information from my raw .H264 streaming?
CMFormatDescriptionRef decoderFormatDescription;
const uint8_t* const parameterSetPointers[2] = 
    { (const uint8_t*)[currentSps bytes], (const uint8_t*)[currentPps bytes] };
const size_t parameterSetSizes[2] = 
    { [currentSps length], [currentPps length] };
status = CMVideoFormatDescriptionCreateFromH264ParameterSets(NULL,
       2,
       parameterSetPointers,
       parameterSetSizes,
       4,
       &decoderFormatDescription);
Thanks in advance,
Marcos
[post] : Decoding H264 VideoToolkit API fails with Error -8971 in VTDecompressionSessionCreate