BBC at risk of losing generation of viewers, Ofcom warns