New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 763930 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 618368
issue 660942



Sign in to add a comment

add expliict destroy() to AndroidOverlay mojo client

Project Member Reported by liber...@chromium.org, Sep 11 2017

Issue description

allow a client to destroy() an AndroidOverlay object, to unback it on the server side.  the client object would ignore further calls.

this is helpful to prevent having to clean up refs to codecimage in MCVD, since it's perfectly okay if calls on the object just become a no-op.
 
then again, maybe we could just clear it out of the surface bundle, since it's a unique_ptr.  adding an explicit destroy to a unique_ptr'd object would be a little strange.

Comment 2 by w...@chromium.org, Sep 12 2017

Clearing the pointer and surface from the bundle sgtm. But what is responsible for doing that if MCVD is destroyed and only the images hold the bundle?

Seems like we need a new wrapper class that holds a strong ref to a bundle and, listens to SurfaceDestroyed and deletes its bundle. Then CodecImages hold one of these.
the bundle can register itself with AndroidOverlay::AddSurfaceDestroyedCallback, and delete the overlay unique_ptr from itself.

then again, that might be confusing for MCVD, so maybe each codec image should register itself, and respond by dropping its ref to the bundle.  that makes more sense.

Comment 4 by w...@chromium.org, Sep 12 2017

Hmm, the second one makes sense. But there are some complicated threading concerns :( I'm beginning to think we should 

MCVD is created in the Media Service which is a mojo service that's started and destroyed on demand. When it's started it's given a thread to run on, and when it's done the thread is destroyed. It's possible to hold a ServiceContextRef to extend the lifetime of the thread, which is what MCVD holds as a member so it can live beyond its owner and drain and delete itself. 

So if MCVD goes away but an AO is kept alive by the images, the thread might be stopped. And MojoAndroidOverlay won't receive calls from the browser side.

I'm starting to think we should make the MediaService thread lazily created but never stopped, maybe with an eye towards being able to stop it eventually.

Comment 5 by w...@chromium.org, Sep 12 2017

Maybe the best option is to bind MojoAndroidOverlays on a task scheduler sequence and make them threadsafe.
i'm not sure about how "task scheduler sequence" works, so i'm ignoring it until i go learn more.

otherwise, i think that overlays should be bound to the gpu main thread, not the mcvd thread.  the only accesses in mcvd aren't sensitive to latency.  the SOP work should avoid a thread hop if possible.

allocation via the chooser is already mostly via callbacks anyway, that could thread hop if MCVD wants.

deallocation would currently drop the surface bundle on the MCVD thread, but we could teach the bundle to post a DeleteSoon to main, i suppose.  that's ugly.

i'll go learn about c#4 .

Comment 7 by w...@chromium.org, Oct 3 2017

Blocking: 660942
Status: WontFix (was: Assigned)

Sign in to add a comment