Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(666)

Issue 1878103002: Plumb a Browser->GPU surface destruction message for Android VDAs (Closed)

Created:
4 years, 8 months ago by watk
Modified:
4 years, 7 months ago
CC:
avayvod+watch_chromium.org, chromium-reviews, darin-cc_chromium.org, feature-media-reviews_chromium.org, mcasas+watch_chromium.org, mlamouri+watch-media_chromium.org, piman+watch_chromium.org, posciak+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Plumb 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 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+214 lines, -0 lines) Patch
M base/threading/thread_restrictions.h View 2 chunks +2 lines, -0 lines 0 comments Download
M content/browser/gpu/gpu_process_host.h View 1 2 3 3 chunks +12 lines, -0 lines 0 comments Download
M content/browser/gpu/gpu_process_host.cc View 1 2 3 4 5 4 chunks +29 lines, -0 lines 0 comments Download
M content/browser/media/android/browser_surface_view_manager.h View 1 2 3 1 chunk +8 lines, -0 lines 0 comments Download
M content/browser/media/android/browser_surface_view_manager.cc View 1 2 3 4 chunks +36 lines, -0 lines 0 comments Download
M content/common/BUILD.gn View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
A content/common/gpu/media/avda_surface_tracker.h View 1 2 3 4 5 6 1 chunk +52 lines, -0 lines 0 comments Download
A content/common/gpu/media/avda_surface_tracker.cc View 1 2 3 4 5 6 1 chunk +49 lines, -0 lines 0 comments Download
M content/common/gpu_host_messages.h View 1 2 3 4 2 chunks +10 lines, -0 lines 0 comments Download
M content/content_common.gypi View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/gpu/gpu_child_thread.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M content/gpu/gpu_child_thread.cc View 1 2 3 4 3 chunks +11 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 40 (14 generated)
watk
Hey Sievers, WDYT about this approach for plumbing the onSurfaceDestroyed callback for AVDA? I hate ...
4 years, 8 months ago (2016-04-12 01:33:47 UTC) #2
watk
Friendly ping sievers. jam@: PTAL at this usage of ScopedAllowWait. We have a similar sync ...
4 years, 8 months ago (2016-04-18 18:50:54 UTC) #4
jam
On 2016/04/18 18:50:54, watk wrote: > Friendly ping sievers. > > jam@: PTAL at this ...
4 years, 8 months ago (2016-04-18 22:48:57 UTC) #5
no sievers
On 2016/04/18 22:48:57, jam wrote: > if there's absolutely no other way to do this, ...
4 years, 8 months ago (2016-04-18 23:41:25 UTC) #6
watk
I tried making the message sync, but it didn't work. I believe because the child ...
4 years, 8 months ago (2016-04-19 21:14:47 UTC) #7
watk
https://codereview.chromium.org/1878103002/diff/20001/content/common/gpu/media/avda_surface_tracker.h File content/common/gpu/media/avda_surface_tracker.h (right): https://codereview.chromium.org/1878103002/diff/20001/content/common/gpu/media/avda_surface_tracker.h#newcode35 content/common/gpu/media/avda_surface_tracker.h:35: void AddSurfaceDestructionObserver(SurfaceDestructionObserver* observer); On 2016/04/18 23:41:25, sievers wrote: > ...
4 years, 8 months ago (2016-04-19 21:15:08 UTC) #8
watk
On 2016/04/19 21:15:08, watk wrote: > https://codereview.chromium.org/1878103002/diff/20001/content/common/gpu/media/avda_surface_tracker.h > File content/common/gpu/media/avda_surface_tracker.h (right): > > https://codereview.chromium.org/1878103002/diff/20001/content/common/gpu/media/avda_surface_tracker.h#newcode35 > ...
4 years, 8 months ago (2016-04-19 21:52:46 UTC) #9
no sievers
ok let's just do as you suggested then. https://codereview.chromium.org/1878103002/diff/20001/content/browser/gpu/gpu_process_host.cc File content/browser/gpu/gpu_process_host.cc (right): https://codereview.chromium.org/1878103002/diff/20001/content/browser/gpu/gpu_process_host.cc#newcode798 content/browser/gpu/gpu_process_host.cc:798: TRACE_EVENT0("gpu", ...
4 years, 8 months ago (2016-04-19 23:30:18 UTC) #10
watk
Thanks! PTAL https://codereview.chromium.org/1878103002/diff/20001/content/browser/gpu/gpu_process_host.cc File content/browser/gpu/gpu_process_host.cc (right): https://codereview.chromium.org/1878103002/diff/20001/content/browser/gpu/gpu_process_host.cc#newcode798 content/browser/gpu/gpu_process_host.cc:798: TRACE_EVENT0("gpu", "GpuProcessHost::DestroyingVideoSurface"); On 2016/04/19 23:30:17, sievers wrote: ...
4 years, 8 months ago (2016-04-22 02:48:56 UTC) #12
DaleCurtis
This doesn't seem to hook up the call to AVDA right now? https://codereview.chromium.org/1878103002/diff/80001/content/common/gpu/media/avda_surface_tracker.h File content/common/gpu/media/avda_surface_tracker.h ...
4 years, 8 months ago (2016-04-22 18:17:14 UTC) #14
watk
On 2016/04/22 18:17:14, DaleCurtis wrote: > This doesn't seem to hook up the call to ...
4 years, 8 months ago (2016-04-22 18:29:57 UTC) #15
liberato (no reviews please)
https://codereview.chromium.org/1878103002/diff/80001/content/common/gpu/media/avda_surface_tracker.h File content/common/gpu/media/avda_surface_tracker.h (right): https://codereview.chromium.org/1878103002/diff/80001/content/common/gpu/media/avda_surface_tracker.h#newcode14 content/common/gpu/media/avda_surface_tracker.h:14: // AVDASurfaceTracker provides AndroidVideoDecodeAccelerators a way to register On ...
4 years, 8 months ago (2016-04-22 20:31:30 UTC) #17
watk
On 2016/04/22 20:31:30, liberato wrote: > https://codereview.chromium.org/1878103002/diff/80001/content/common/gpu/media/avda_surface_tracker.h > File content/common/gpu/media/avda_surface_tracker.h (right): > > https://codereview.chromium.org/1878103002/diff/80001/content/common/gpu/media/avda_surface_tracker.h#newcode14 > ...
4 years, 8 months ago (2016-04-22 21:39:51 UTC) #20
no sievers
lgtm
4 years, 8 months ago (2016-04-22 21:50:11 UTC) #21
DaleCurtis
lgtm
4 years, 8 months ago (2016-04-22 22:19:59 UTC) #22
watk
wfh@chromium.org: Please review changes in gpu_host_messages
4 years, 8 months ago (2016-04-22 22:41:01 UTC) #24
Will Harris
lgtm % nit/suggestion. https://codereview.chromium.org/1878103002/diff/140001/content/common/gpu/media/avda_surface_tracker.h File content/common/gpu/media/avda_surface_tracker.h (right): https://codereview.chromium.org/1878103002/diff/140001/content/common/gpu/media/avda_surface_tracker.h#newcode22 content/common/gpu/media/avda_surface_tracker.h:22: // This is not thread safe. ...
4 years, 8 months ago (2016-04-22 23:31:10 UTC) #25
watk
Thanks https://codereview.chromium.org/1878103002/diff/140001/content/common/gpu/media/avda_surface_tracker.h File content/common/gpu/media/avda_surface_tracker.h (right): https://codereview.chromium.org/1878103002/diff/140001/content/common/gpu/media/avda_surface_tracker.h#newcode22 content/common/gpu/media/avda_surface_tracker.h:22: // This is not thread safe. All access ...
4 years, 8 months ago (2016-04-23 00:48:58 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1878103002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1878103002/160001
4 years, 8 months ago (2016-04-23 00:49:41 UTC) #29
commit-bot: I haz the power
Try jobs failed on following builders: chromium_presubmit on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presubmit/builds/172392)
4 years, 8 months ago (2016-04-23 00:57:36 UTC) #31
watk
On 2016/04/23 00:57:36, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 8 months ago (2016-04-23 01:02:24 UTC) #32
watk
On 2016/04/23 01:02:24, watk wrote: > On 2016/04/23 00:57:36, commit-bot: I haz the power wrote: ...
4 years, 8 months ago (2016-04-26 18:54:26 UTC) #33
jam
lgtm
4 years, 7 months ago (2016-04-27 19:10:53 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1878103002/160001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1878103002/160001
4 years, 7 months ago (2016-04-27 19:19:51 UTC) #36
commit-bot: I haz the power
Committed patchset #7 (id:160001)
4 years, 7 months ago (2016-04-27 20:28:00 UTC) #38
commit-bot: I haz the power
4 years, 7 months ago (2016-04-30 17:12:35 UTC) #39
Message was sent while issue was closed.
Patchset 7 (id:??) landed as
https://crrev.com/ad8743d5832349034e92739052be79e913f6b06e
Cr-Commit-Position: refs/heads/master@{#390167}

Powered by Google App Engine
This is Rietveld 408576698