SurfaceTextureHelper.startListening() is asynchronous and posts a Runnable to the handler thread. If stopListening() is called before that Runnable is executed, the Runnable will set the listener after stopListening() has been called. Then the next call to startListening() will fail with "SurfaceTextureHelper listener has already been set."
This CL adds a test to reproduce this bug, and a fix.
BUG=5519,b/27677772
Review URL: https://codereview.webrtc.org/1806013003
Cr-Commit-Position: refs/heads/master@{#12030}