 		private var _audioPES:Vector.<PES> = new Vector.<PES>();
 		/** has PMT been parsed ? **/
 		private var _pmtParsed:Boolean= false;
-		/** nb of AV packets before PMT **/
-		private var _AVpacketsBeforePMT:Number = 0;
+		/** any TS packets before PMT ? **/
+		private var _packetsBeforePMT:Boolean = false;
 		/** Packet ID of the video stream. **/
 		private var _avcId:Number = -1;
 		/** PES packet that contains the first keyframe. **/

				_data.position += sel;
				read += sel + 5;
			}
			if(_pmtParsed == false) {
			  _pmtParsed = true;
			// if PMT was not parsed before, and some unknown packets have been skipped in between, rewind to beginning of the stream
			// it helps with fragment not segmented properly (in theory there should be no A/V packets before PAT/PMT)
			  if (_AVpacketsBeforePMT > 1) {
			    Log.txt("late PMT found, rewinding at beginning of TS");
			    return (-_data.position);
			  }
		  }
			return len;
		};
	}

		
		
		/** TS Sync byte. **/
		private static const SYNCBYTE:uint = 0x47;
		/** TS Packet size in byte. **/
		private static const PACKETSIZE:uint = 188;
		/** loop counter to avoid blocking **/
