This analysis is cool, but, it doesn't mention duty cycle.
If we were to use a 50% duty cycle, say in the case of an IR transmitter switching at 36KHz, then, since the LED is off half the time, we could effectively double the power in the LED during the on time.
Since power (watts) is volts * amps, and using the a fore mentioned calculations limiting the average current to 20Ma, then we could recalculate the resistor to allow 40Ma when the LED is on.
(5V - 2.2V) / .04A
2.8V / 0.04 = 70 ohms
Standard 5% values have a 75 ohm step, reverse calculating yields:
75 ohms * 2.8 volts =37 Ma.
As far as I know, it might be possible to reduce the duty cycle to at least 30%, maybe 20% (experimentation recommended), if we choose 25%, that would further reduce the resistor to about 36 ohms or 77Ma.
But, you better make sure your software doesn't accidentally leave the LED on for very long, at that current, one second may be enough to let the smoke out. If I were designing it I would use a transistor to power the LED, and feed the transistor with a cap, so in case the software locked up, the transistor would turn off by itself.