media: Use the actual cdm type when querying a key systems capabilities.
A service key is generated by `cdm_type`, `browser_context` and `site` in content/browser/media/service_factory.cc. A registered CDM's `cdm_type` will always be a unique non-empty value (i.e. `kMediaFoundationWidevineCdmType`). However, when determining a key systems capabilities, the actual CdmType which corresponds to a Cdm is not used and a default CdmType is used instead. When more than one media foundation cdm is registered, this leads to non-unique ServiceKey's in service_factory.cc when creating the media foundation utility processes which causes different CDM's to use the same utility process and fails when attempting to retrieve the remote media foundation service. Taking CdmType into consideration when querying for key system capabilities addresses the problem. Bug: 394906654 Change-Id: Ie135caf8c06500cf1161ae5c4c1cc687347ba490 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6265506 Reviewed-by: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Sangbaek Park <sangbaekpark@chromium.org> Commit-Queue: Piet Schouten <Piet.Schouten@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1422064}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
4857181b00
commit
d5ca067e2e
@ -583,9 +583,9 @@ void CdmRegistryImpl::LazyInitializeCapability(
|
||||
auto cdm_info =
|
||||
GetCdmInfo(key_system, CdmInfo::Robustness::kHardwareSecure);
|
||||
DCHECK(cdm_info && !cdm_info->capability);
|
||||
GetMediaFoundationServiceCdmCapability(key_system, cdm_info->path,
|
||||
/*is_hw_secure=*/true,
|
||||
std::move(cdm_capability_cb));
|
||||
GetMediaFoundationServiceCdmCapability(
|
||||
key_system, cdm_info->type, cdm_info->path,
|
||||
/*is_hw_secure=*/true, std::move(cdm_capability_cb));
|
||||
} else {
|
||||
// kSoftwareSecure should have been determined from the manifest.
|
||||
std::move(cdm_capability_cb)
|
||||
|
@ -61,6 +61,7 @@ void OnKeySystemCapability(
|
||||
|
||||
void GetMediaFoundationServiceCdmCapability(
|
||||
const std::string& key_system,
|
||||
const media::CdmType& cdm_type,
|
||||
const base::FilePath& cdm_path,
|
||||
bool is_hw_secure,
|
||||
media::CdmCapabilityCB cdm_capability_cb) {
|
||||
@ -75,7 +76,8 @@ void GetMediaFoundationServiceCdmCapability(
|
||||
}
|
||||
|
||||
// CDM capability is global, use a generic BrowserContext and Site to query.
|
||||
auto& mf_service = GetMediaFoundationService(nullptr, GURL(), cdm_path);
|
||||
auto& mf_service =
|
||||
GetMediaFoundationService(cdm_type, nullptr, GURL(), cdm_path);
|
||||
mf_service.IsKeySystemSupported(
|
||||
key_system,
|
||||
mojo::WrapCallbackWithDefaultInvokeIfNotRun(
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/functional/callback.h"
|
||||
#include "media/base/cdm_capability.h"
|
||||
#include "media/cdm/cdm_type.h"
|
||||
|
||||
namespace content {
|
||||
|
||||
@ -17,6 +18,7 @@ namespace content {
|
||||
// MediaFoundationService for `key_system` by the CDM located in `cdm_path`.
|
||||
void GetMediaFoundationServiceCdmCapability(
|
||||
const std::string& key_system,
|
||||
const media::CdmType& cdm_type,
|
||||
const base::FilePath& cdm_path,
|
||||
bool is_hw_secure,
|
||||
media::CdmCapabilityCB cdm_capability_cb);
|
||||
|
@ -539,8 +539,9 @@ void MediaInterfaceProxy::ConnectToMediaFoundationService(
|
||||
DVLOG(1) << __func__ << ": this=" << this << ", cdm_path=" << cdm_path;
|
||||
DCHECK(!mf_interface_factory_remote_);
|
||||
|
||||
// Passing an empty CdmType since it is not needed in this scenario.
|
||||
auto& mf_service = GetMediaFoundationService(
|
||||
render_frame_host().GetBrowserContext(),
|
||||
media::CdmType(), render_frame_host().GetBrowserContext(),
|
||||
render_frame_host().GetSiteInstance()->GetSiteURL(), cdm_path);
|
||||
|
||||
// Passing an empty CdmType as MediaFoundation-based CDMs don't use CdmStorage
|
||||
|
@ -287,12 +287,12 @@ media::mojom::CdmService& GetCdmService(BrowserContext* browser_context,
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
media::mojom::MediaFoundationService& GetMediaFoundationService(
|
||||
const media::CdmType& cdm_type,
|
||||
BrowserContext* browser_context,
|
||||
const GURL& site,
|
||||
const base::FilePath& cdm_path) {
|
||||
return GetService<media::mojom::MediaFoundationService>(
|
||||
media::CdmType(), browser_context, site, "Media Foundation Service",
|
||||
cdm_path);
|
||||
cdm_type, browser_context, site, "Media Foundation Service", cdm_path);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_WIN)
|
||||
|
||||
|
@ -31,6 +31,7 @@ media::mojom::CdmService& GetCdmService(BrowserContext* browser_context,
|
||||
// the `site`. Instances are started lazily as needed. The CDM located at
|
||||
// `cdm_path` is loaded in the sandboxed process to be used by the service.
|
||||
media::mojom::MediaFoundationService& GetMediaFoundationService(
|
||||
const media::CdmType& cdm_type,
|
||||
BrowserContext* browser_context,
|
||||
const GURL& site,
|
||||
const base::FilePath& cdm_path);
|
||||
|
Reference in New Issue
Block a user