avformat/ifv: Check that total frames do not overflow