             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)) {
+            while ((_data.bytesAvailable >= PACKETSIZE) && ((getTimer() - start_time) < 20)) {
                 _parseTSPacket();
             }
             if (_tags.length) {

            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

            return len + pointerField;
        };
    }
}
