[M65] media: handle StopAndDeAllocate after suspend correctly

Some application (e.g. Hangouts) closes the camera explicitly on system
suspend. As the Chrome OS VCD also closes the camera on system suspend
without going through the full destruction of the VideoCaptureDevice,
this results in StopAndDeAllocate being called back-to-back. The second
call to StopAndDeAllocate should simply return if the device context is
already destroyed.

BUG=b:73436939
TEST=unit tests
TEST=Verify that Hangouts call works correctly on Soraka when system
     suspends

Change-Id: Id6127b751ccc5bc71538d622bc0905bf03951e0d
Reviewed-on: https://chromium-review.googlesource.com/930605
Reviewed-by: Wu-Cheng Li <wuchengli@chromium.org>
Commit-Queue: Ricky Liang <jcliang@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#539091}(cherry picked from commit 7b94276046ba4b6fd719f07706fa102a62a5c366)
Reviewed-on: https://chromium-review.googlesource.com/939061
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Cr-Commit-Position: refs/branch-heads/3325@{#602}
Cr-Branched-From: bc084a8b5afa3744a74927344e304c02ae54189f-refs/heads/master@{#530369}
4 files changed