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

Issue 650883 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner:
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

Merge mojo MediaService and ServiceFactory interfaces

Project Member Reported by xhw...@chromium.org, Sep 27 2016

Issue description

Today MediaService creates ServiceFactory and passes in |frame_interfaces|. Through |frame_interfaces| media services can connect to services hosted by the frame host in the browser. Since ServiceFactory is also a factory interface, it turns out we have too many layers of factories.

The fundamental issue here is that when we connect to a mojo service, we can't pass in additional parameters. So either we have to use a factory, or we need to pass it later.

In this case, we should be able to merge these two interfaces, and add an additional call in ServiceFactory to help pass in the |frame_interfaces| later, something like:

interface ServiceFactory {

....

SetFrameServiceProvider(shell.mojom.InterfaceProvider frame_interfaces)

}
 

Comment 1 by xhw...@chromium.org, Oct 11 2016

Status: Started (was: Assigned)
Also, now MojoMediaApplication is actual a Service implementation. Maybe we should rename MojoMediaApplication to be MediaService. This is also more consistent with the new name of the media service "service:media".

Comment 2 by xhw...@chromium.org, Oct 12 2016

Cc: roc...@chromium.org
Status: WontFix (was: Started)
okay, I think I was confused when filing this bug. The MediaService is added so that we can pass in "frame services" when binding the service request. There's no other way to work around this since when connecting to the service we cannot pass in additional parameters.

I'll mark this as WontFix for now and keep thinking about it. I'll still do some renaming as mentioned in #1.

alokp/slan/rockot: let me know if you have better ideas.

Comment 3 by alokp@chromium.org, Oct 12 2016

If those frame services are only needed for one or a subset of services, may be we can pass them when creating the service? Something like ServiceFactory::CreateCdm(InterfaceProvider, ContentDecryptionModule& cdm).

Comment 4 by xhw...@chromium.org, Oct 12 2016

Yes, I thought about that. But since ServiceFactory::CreateCdm() is called from the render process side, this means that the render process will provide services to the CDM, which is wrong.

Right now I am refactoring how we connect to the media services. After that, we should have a chance to call Foo::CreateCdm(InterfaceProvider, ContentDecryptionModule& cdm) to forward the |cdm| request and provide frame service hosted by RenderFrameHostImpl. But that means that we need another interface (Foo), and this approach is not generic (other services may need the frame service in the future as well). Since we need to add a different interface anyways, I decided to just keep the existing MediaService.

Comment 5 by alokp@chromium.org, Oct 13 2016

Does this mean that ServiceFactory can only be created from the browser process because no other process can provide the "frame services".

For chromecast, we need to connect to the media service from other standalone mojo services (independent of browser/renderer/utility processes). We probably do not need CDM support for that usecase, so it should still be OK. But it is unfortunate that media service is implicitly dependent on the browser process.

Comment 6 by xhw...@chromium.org, Oct 13 2016

Conceptually it makes sense that media services needs other services from the shell (ServiceManager) to work properly. In Chrome, the browser is the shell. In your case, you should still have a ServiceManager somewhere. So I don't think media service is implicitly dependent on the browser process. Rather, whoever connects to media services in the app should provide the services. In Chrome, the browser process will provide them.

Comment 7 by alokp@chromium.org, Oct 13 2016

That makes sense. Is there a documented list of services required by the media service? Are those services currently (potentially) available outside the browser process?

Comment 8 by xhw...@chromium.org, Oct 13 2016

Sorry documentation is lacking. I am working on it.

Currently only the CDM service needs other services:
- OutputProtection: to check output protection status
- PlatformVerification: to check whether the platform is secure
- CdmFileIO: for the CDM to store persistent data
- MediaPermission: to check media related permission
- ProvisionFetcher: for Android MediaDrm device provisioning

All these services are provided by the Browser currently. Conceptually they could be provided by other type of hosts, but since I always work in Chromium I don't really know how that would work.

Sign in to add a comment