I am implementing an app that receives an h264 video stream in not-NAL-packaged chunks from a hardware accessory (an abritrarily divided stream of bytes), but it's not working for me. The stream does not contain IDRs, though one is provided by the accessory manufacturer to be loaded at runtime. I have successfully decompressed the IDR by concatenating all the 0x05 (IDR image slice) NALs together and supplying an appropriate CMVideoFormatDescriptionRef generated from the SPS and PPS in the reference IDR.
I can extract the NALs received from the byte stream by hunting for 0x00000001 start codes. However, when I try to concatenate all of the following 0x01 (non-IDR video slice) NALs into a CMBlockBuffer into a CMSampleBuffer and decompress that, the decompression nearly always fails (the specific error varies, I recall most of the time with
-12911
). I am applying the same transformation to the 0x01 NALs as the 0x05 NALs to generate AVCC NALs (strip off the header, package the size as a 4-byte big endian header preceeding the payload). Is there something I'm missing? There is a 0x00 NAL every 9th NAL, which I've been using as the delimeter between CMSampleBuffer decompress attempts, though perhaps that's not the appropriate boundary to be using.This video stream is decompressed successfully (slowly) by libav, with FLAG2_SHOW_ALL. I don't have information about the configuration used to generate the h264 stream or the specific libav compilation configuration, though it's clear there's no hardware codecs included.
Any advice would be appreciated. I've read through the WWDC 513 talk and http://stackoverflow.com/questions/29525000/how-to-use-************-to-decompress-h-264-video-stream/29525001#29525001, which got me this far, but I feel like there's something I'm missing. A reference implementation of an app that displays an h264 stream received as bytes would be invaluable, for instance.