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

Issue 672327 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug

Blocking:
issue 672337
issue 671858



Sign in to add a comment

Media: Unify and clean up logic related to checking codec platform support

Project Member Reported by ddorwin@chromium.org, Dec 8 2016

Issue description

media::MimeUtil has too many paths responsible for checking whether a platform supports a given codec, profile, etc. Also, the responsibility for parsing a codec string into various properties is conflated with some of those checks. The result is that it is difficult to get a picture of what is supported and whether the logic is correct.

We need to establish clear responsibilities and expectations.

Current issues include:
1. MimeUtil::StringToCodec() performs some checks and returns whether a codec string is supported and ambiguous. One might assume that it is solely responsible for this.
2. There are multiple paths that check whether the platform supports a codec:
  * MediaClient::IsSupportedVideoConfig()
  * IsCodecSupported() and IsCodecSupportedOnPlatform()
3. The second path is called in cases that the former is not.

 
I think we should change StringToCodec() to only perform parsing and move the other logic out. It should only return whether it was successful / the string was valid. The output parameter |is_ambiguous| should probably be removed. To clarify the responsibility, we should rename it to ParseCodecString().

Note: There is already a ParseCodecString(), which is also inaccurately named. We should rename it to ParseCodecsStringToVector().

The profile, etc. logic currently in StringToCodec() would be moved to another function responsible for _checking_ whether the parsed values are supported.

We should then unify the platform-checking code path and ensure that it is called from all relevant paths. It may help to wrap the new ParseCodecString() and this function in another function since they should probably be used together in (almost?) all cases.

While we will need to defer to MediaClient and various embedders for some of this logic, we should try to ensure/encourage that they will do the right thing. For example, we would want them to check specific profiles and not just check the one that is most interesting or only the subset currently supported by media/ at the moment.
Blocking: 671858
Blocking: 672337
Owner: chcunningham@chromium.org
Status: Assigned (was: Available)
Will take this as part of media capabilities work.
> For example, we would want them to check specific profiles and not just check the one that is most interesting or only the subset currently supported by media/ at the moment.

Can you illustrate your concern here with an example. My current ambition is move all platform checks, including android's, into MediaClient. The contract should be the client says "yes" to any codec it supports, otherwise "no". Not sure if this addresses your concern.
I think the concern was that embedders would implement to the current media/ implementation in a way that does not handle changes to media/, such as adding support for new profiles. Since we don't control all embedders, it's not possible for us to even check whether such changes might break something.

(This comment may have been prompted by a case where code was only checking a single VP9 profile and maybe ignoring the level. That may have been sufficient at the time, but would have been buggy as we added more support.)
Project Member

Comment 7 by bugdroid1@chromium.org, Feb 22 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/38e97f421bcf90b224b895a405f3ba0de3efe5ac

commit 38e97f421bcf90b224b895a405f3ba0de3efe5ac
Author: chcunningham <chcunningham@chromium.org>
Date: Wed Feb 22 22:43:20 2017

Various MimeUtil cleanups.

Cleanly separate roles of codec parsing from checking codec support.
Merge various codec support checks into single function.
Separate notions of ambiguous codec strings from ambiguous support.
Make ambiguous codec strings less extensible (avoid adding more).
Prepare to eliminate notions of ambiguous support.
Naming improvements.

More details in the bug. Kudos to ddorwin.

BUG= 672327 

Review-Url: https://codereview.chromium.org/2700893003
Cr-Commit-Position: refs/heads/master@{#452243}

[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/content/renderer/media/recorder/media_recorder_handler.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/base/mime_util.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/base/mime_util.h
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/base/mime_util_internal.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/base/mime_util_internal.h
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/base/mime_util_unittest.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/blink/key_system_config_selector.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/filters/chunk_demuxer.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/media/filters/source_buffer_state.cc
[modify] https://crrev.com/38e97f421bcf90b224b895a405f3ba0de3efe5ac/third_party/WebKit/Source/platform/network/mime/MIMETypeRegistry.cpp

Status: Fixed (was: Assigned)
Project Member

Comment 9 by bugdroid1@chromium.org, Jan 4 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/06c7c30815f180a0b1279298a933236ffdfed955

commit 06c7c30815f180a0b1279298a933236ffdfed955
Author: Xiaohan Wang <xhwang@chromium.org>
Date: Thu Jan 04 03:55:52 2018

media: Remove MimeUtil::IsSimpleCodecSupported()

It seems this function is not used anywhere.

BUG= 672327 

Change-Id: I8c2f9ddb7d3099f769c33ef7885544fddcdc99af
Reviewed-on: https://chromium-review.googlesource.com/849645
Reviewed-by: Chrome Cunningham <chcunningham@chromium.org>
Commit-Queue: Xiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#526911}
[modify] https://crrev.com/06c7c30815f180a0b1279298a933236ffdfed955/media/base/mime_util_internal.cc
[modify] https://crrev.com/06c7c30815f180a0b1279298a933236ffdfed955/media/base/mime_util_internal.h

Sign in to add a comment