                     if(unit_type == 1 || unit_type == 5) { break; }
                 // Match three-byte startcodes
                 } else if((window & 0xFFFFFF00) == 0x100) {
-                    if(unit_start) {
+                    // push previous NAL unit if new start delimiter found, dont push unit with type = 0
+                    if(unit_start && unit_type) {
                         units.push({
                             header: unit_header,
                             length: nalu.position - 4 - unit_start,


        /** H264 NAL unit names. **/
        public static const NAMES:Array = [
            'Unspecified',
            'NDR',
            'Partition A',
            'Partition B',
            'Partition C',
            'IDR',
            'SEI',
            'SPS',
            'PPS',
            'AUD',
            'End of Sequence',
            'End of Stream',
            'Filler Data'
        ];
        /** H264 profiles. **/
        public static const PROFILES:Object = {

        };


        /** Get Avcc header from AVC stream 
        See ISO 14496-15, 5.2.4.1 for the description of AVCDecoderConfigurationRecord
        **/
        public static function getAVCC(nalu:ByteArray,position:Number=0):ByteArray {
            // Find SPS and PPS units in AVC stream.
            var units:Array = AVC.getNALU(nalu,position,false);
