Today the CDM is hosted by a pepper plugin (CDM adapter). Since we can register a pepper plugin through command line (--register-pepper-plugins), we can also register a CDM this way. Today this is used for testing external clear key.
When using --register-pepper-plugins, we must provide file_path, name, description, version, and mime-type. |file_path| is critical, telling the browser where the CDM is. |mime-type| is also critical because when we register a key system, we also provide the PepperType (mime-type), this is how we know which CDM to load for a given key system (key system -> mime-type -> CDM) [1].
This means that |mime-type| must be consistent with the PepperType of a registered key system, which is usually hardcoded in the code. For example, in Chrome, for pepper based CDM, we only add Widevine and External Clear Key key system support, and the mime-type for these two CDMs are fixed.
Also, when we register a CDM, we need to provide extra information like supported codecs. This is not possible through --register-pepper-plugins today.
In summary, the current way of registering CDM through command line is not generic, probably it never intended to be. We can only register two types of CDM and tell chrome where the CDM path is, and a lot of information are missing (e.g. supported codecs). For Widevine, this is not used anywhere. For ECK, actually we know where the CDM is, and the supported codecs are hardcoded.
When we switch from pepper CDM to mojo CDM, we need a new solution to register CDMs (in CdmRegistry) through command line. The simplest solution is to just use a simple boolean switch to enable External Clear Key (actually we already have one: kExternalClearKeyForTesting).
In the future, we could provide a generic mechanism for registering a CDM through command line, e.g. CDM path, name, supported key systems, supported codecs etc. Most of these information can be provided in a manifest.json file, which pretty much covers everything we need to know in KeySystemProperties [2].
[1] https://cs.chromium.org/chromium/src/content/renderer/media/cdm/ppapi_decryptor.cc?rcl=bd7a01773b15d07a9bfea44177e3793f2a778d21&l=40
[2] https://cs.chromium.org/chromium/src/media/base/key_system_properties.h?rcl=2eff7cfefdef090f2d7190dccd55dcc467601cea&l=17
Comment 1 by xhw...@chromium.org
, Oct 10 2017