handle AVERROR_IO and AVERROR_NOMEM patch by (Kostya <cannonball bw-team com>)