requestMediaKeySystemAccess should skip capabilities if unrecognized parameters in media MIME types |
||||
Issue description
Currently NavigatorRequestMediaKeySystemAccess [1] has the following comment when processing the MIME type for audioCapabilities / videoCapabilities:
// FIXME: Fail if there are unrecognized parameters.
This matches tests in encrypted-media-requestmediakeysystemaccess.html [2], which are currently commented out as they don't fail.
However, RFC 2045 (Internet Message Bodies), section 5, states:
Parameters are modifiers of the media subtype, and as such do not
fundamentally affect the nature of the content. The set of
meaningful parameters depends on the media type and subtype. Most
parameters are associated with a single specific subtype. However, a
given top-level media type may define parameters which are applicable
to any subtype of that type. Parameters may be required by their
defining content type or subtype or they may be optional. MIME
implementations must ignore any parameters whose names they do not
recognize.
As well, the classes used for parsing the media MIME types (ContentType/ParsedContentType) do not provide a way to enumerate the parameters, so it is very hard to determine if there are additional parameters.
It appears that the correct behavior is to ignore unrecognized parameters. Update the tests and remove the FIXME.
[1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp?l=52
[2] https://cs.chromium.org/chromium/src/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html?l=278
,
Feb 14 2017
Complicating this is there are (at least) 2 implementations that parse MIME types in the blink code. network/mime/ContentType.cpp, which is used mostly by media code, has limited functionality, and searches for parameters by simply looking for the name somewhere in the MIME type (so it could get confused if the parameter name was used inside a different parameter, e.g. foo=codecs, codecs="avc1.4d401e"). Since it does not parse the full string, it has no list of parameters included in the MIME type, making detection of unrecognized parameters impossible. network/ParsedContentType.cpp, which is used elsewhere, parses the full MIME type, so it does have a list of parameter names (although not exposed publicly). However, the parameter search is case-sensitive ( issue 689731 ), which is a problem. I tried a test where ContentType is simply a wrapper on ParsedContentType, to see if there is any impact. The only tests that fail: media/media-source/mediasource-is-type-supported.html media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html Both files include case-insensitive tests (e.g. CODECS=), which explains the reason they fail. I will also note that ContentType::type() is a trivial implementation (returns the part of the MIME type before ; if it is found, otherwise the whole string), while ParsedContentType::mimeType() has to parse the complete MIME type first. The latter is not used, while the former is used a lot. As there are a significant number of "ContentType(type).type()" calls, there might be a performance hit having to parse |type| every time and/or unexpected failures due to parsing the parameters which aren't needed/checked.
,
Mar 3 2017
Updating title to reflect that the capability should be skipped if unrecognized parameters are detected, in order to match the EME spec.
,
Mar 7 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/59882b5e4f6cdfbaa6b818a29de7212eb8abbf4c commit 59882b5e4f6cdfbaa6b818a29de7212eb8abbf4c Author: jrummell <jrummell@chromium.org> Date: Tue Mar 07 21:50:15 2017 [eme] Ignore capabilities with unrecognized parameters The EME spec notes that if "the user agent does not recognize one or more parameters" in a capability, skip over it. So if additional parameters are present, the capability should be ignored. BUG= 487392 , 690131 TEST=new tests pass Review-Url: https://codereview.chromium.org/2731743003 Cr-Commit-Position: refs/heads/master@{#455230} [modify] https://crrev.com/59882b5e4f6cdfbaa6b818a29de7212eb8abbf4c/third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html [modify] https://crrev.com/59882b5e4f6cdfbaa6b818a29de7212eb8abbf4c/third_party/WebKit/Source/modules/encryptedmedia/NavigatorRequestMediaKeySystemAccess.cpp
,
Mar 7 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by jrumm...@chromium.org
, Feb 8 2017