Chromium Code Reviews
DescriptionPlumb a surface destruction callback for AVDAs on Android
This plumbs the SurfaceHolder.Callback#surfaceDestroyed() callback,
that comes from the Android framework when our video SurfaceView surface
is being destroyed, from the Browser UI thread to the GPU main thread.
The code to handle this callback in AVDA will be added in a future CL.
It's not ideal that we have to do this, but we don't really have a choice.
We don't control the lifetime of SurfaceView surfaces directly, so we have
to be prepared to handle their destruction.
Currently, AVDA handles the loss of surface by not immediately reporting
an error when its MediaCodec starts throwing IllegalStateException. In
some cases, the ISE is due to losing the surface, and in others it's a
real error. By deferring reporting the error to the VDA client, the client
has a window of time where it can Destroy the VDA (which it does on
fullscreen transitions) without seeing the error.
However, on JB devices it's not enough to defer errors. Letting the
surface be destroyed while the MediaCodec is still active can cause it
to hit an internal CHECK, which kills the GPU process. So this CL
introduces a path for AVDAs to get a synchronous callback in which they
can tear down their MediaCodecs before the surface is destroyed (which
is what the surfaceDestroyed() callback is for).
BUG=598408
Committed: https://crrev.com/ad8743d5832349034e92739052be79e913f6b06e
Cr-Commit-Position: refs/heads/master@{#390167}
Patch Set 1 #Patch Set 2 : Add missing ifdefs #
Total comments: 14
Patch Set 3 : Rebase #Patch Set 4 : Addressed sievers comments. #
Total comments: 2
Patch Set 5 : Rebase to run try bots #Patch Set 6 : Fix typos/add missing includes #
Total comments: 2
Patch Set 7 : Add a threadchecker #Dependent Patchsets: Messages
Total messages: 40 (14 generated)
|