             // Parse the PES, split by Packet ID.
             switch (pid) {
                 case PAT_ID:
-                    todo -= _parsePAT(stt);
+                    todo -= _parsePAT(stt,data);
                     CONFIG::LOGGING {
                         if (_pmtParsed == false) {
                             Log.debug("TS: PAT found.PMT PID:" + _pmtId);

            return (_pmtParsed == false || _avcId != -1);
        }

        /** Parse a limited amount of packets each time to avoid blocking **/
        private function _parseTimer(e : Event) : void {
            var start_time : int = getTimer();
            _data.position = _read_position;
            // dont spend more than 20ms demuxing TS packets to avoid loosing frames
            while ((_data.bytesAvailable >= 188) && ((getTimer() - start_time) < 20)) {
                _parseTSPacket();
            }
            if (_tags.length) {
                _callback_progress(_tags);
                _tags = new Vector.<FLVTag>();
            }
            if (_data) {
                _read_position = _data.position;
                // finish reading TS fragment
                if (_data_complete && _data.bytesAvailable < 188) {
                    // free ByteArray
                    _data = null;
                    // first check if TS parsing was successful
                    CONFIG::LOGGING {
                        if (_pmtParsed == false) {
                            Log.error("TS: no PMT found, report parsing complete");
                        }
                    }
                    _displayObject.removeEventListener(Event.ENTER_FRAME, _parseTimer);
                    _flush();
                    _callback_complete();
                }
            }
        }


                    }
                }
                // es_info_length
                var sel : uint = data.readUnsignedShort() & 0xFFF;
                data.position += sel;
                // loop to next stream
                read += sel + 5;
            }
