MediaSet: Reduce critical region

Change-Id: Ifd9ddbe29d409c9042629939a3008c3830ebdbf3
MediaSet: Catch exceptions while doing garbage collection

Change-Id: Ibe68e3242bf75c1a613f9b311bdc1caa8718972e
MediaSet: Fix format with astyle

Change-Id: I40d81805db6de2f5fdd680d82908ae898f79ccda