Ответ:
2) I had been waiting for 20 minutes when I suddenly realized I was in the wrong restaurant.
3) At the time the factory had been working, Sara got a job there for 5 years.
4) The orchestra had been playing when the man in audience started to shout.