I replaced quitSafely() with a CountDownLatch. The reason for not using ThreadUtils.invokeUninterruptibly() is that I want to stop accepting frames asap, and invokeUninterruptibly() would still accept frames during the waiting time. BUG=webrtc:4742 Review URL: https://codereview.webrtc.org/1418223002 Cr-Commit-Position: refs/heads/master@{#10393}