 					break;
 				case _pmtId:
 					todo -= _readPMT();
+			    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 recovering bad segmented content
+			    // in theory there should be no A/V packets before PAT/PMT)
+			      if (_packetsBeforePMT) {
+			        Log.txt("late PMT found, rewinding at beginning of TS");
+			        _data.position = 0;
+			        return;
+			      }
+		      }
 					break;
 				case _aacId:
 				case _mp3Id:

		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;
		/** Packet ID of the video stream. **/
		private var _avcId:Number = -1;
		/** PES packet that contains the first keyframe. **/

			var todo:uint = TS.PACKETSIZE;
			// Sync byte.
			if(_data.readByte() != TS.SYNCBYTE) {
			  var pos:Number = _data.position;
			  if(probe(_data) == true) {
			    Log.txt("lost sync in TS, between offsets:" + pos + "/" + _data.position);
			    _data.position++;
			  } else {
				  throw new Error("Could not parse TS file: sync byte not found @ offset/len " + _data.position + "/"+ _data.length);
				}
			}
			todo--;
			// Payload unit start indicator.
