avcodec/shorten: fix decoding of last frame