Chromium Code Reviews| Index: media/blink/webmediacapabilitiesclient_impl.cc |
| diff --git a/media/blink/webmediacapabilitiesclient_impl.cc b/media/blink/webmediacapabilitiesclient_impl.cc |
| index a407f88b06549f04bc3b23651b2c2d46e175895b..2ccd03b979c5087d18851f6371e59f49e6971d9d 100644 |
| --- a/media/blink/webmediacapabilitiesclient_impl.cc |
| +++ b/media/blink/webmediacapabilitiesclient_impl.cc |
| @@ -4,7 +4,11 @@ |
| #include "media/blink/webmediacapabilitiesclient_impl.h" |
| +#include "media/base/mime_util.h" |
| +#include "third_party/WebKit/public/platform/modules/media_capabilities/WebAudioConfiguration.h" |
| #include "third_party/WebKit/public/platform/modules/media_capabilities/WebMediaCapabilitiesInfo.h" |
| +#include "third_party/WebKit/public/platform/modules/media_capabilities/WebMediaConfiguration.h" |
| +#include "third_party/WebKit/public/platform/modules/media_capabilities/WebVideoConfiguration.h" |
| namespace media { |
| @@ -15,13 +19,53 @@ WebMediaCapabilitiesClientImpl::~WebMediaCapabilitiesClientImpl() = default; |
| void WebMediaCapabilitiesClientImpl::DecodingInfo( |
| const blink::WebMediaConfiguration& configuration, |
| std::unique_ptr<blink::WebMediaCapabilitiesQueryCallbacks> callbacks) { |
| - // TODO(chcunningham, mlamouri): this is a dummy implementation that returns |
| - // true for all the fields. |
| std::unique_ptr<blink::WebMediaCapabilitiesInfo> info( |
| new blink::WebMediaCapabilitiesInfo()); |
| - info->supported = true; |
| - info->smooth = true; |
| - info->power_efficient = true; |
| + |
| + SupportsType audio_support = IsSupported; |
| + SupportsType video_support = IsSupported; |
| + |
| + if (configuration.audio_configuration.has_value()) { |
|
mlamouri (slow - plz ping)
2017/04/25 12:48:43
nit: up to you but you can drop |has_value()| FWIW
chcunningham
2017/04/25 20:53:51
Done.
|
| + const blink::WebAudioConfiguration& audio_config = |
| + configuration.audio_configuration.value(); |
| + std::vector<std::string> codec_vector; |
| + SplitCodecsToVector(audio_config.codec.Ascii(), &codec_vector, false); |
| + |
| + // TODO(chcunningham): Update to throw exception pending outcome of |
| + // https://github.com/WICG/media-capabilities/issues/32 |
| + DCHECK_LE(codec_vector.size(), 1U); |
|
mlamouri (slow - plz ping)
2017/04/25 12:48:43
I think we should implement the parsing on Blink s
chcunningham
2017/04/25 20:53:51
ACK. Will follow up. See my earlier comment about
|
| + |
| + audio_support = |
| + IsSupportedMediaFormat(audio_config.mime_type.Ascii(), codec_vector); |
| + } |
| + |
| + if (configuration.video_configuration.has_value()) { |
| + const blink::WebVideoConfiguration& video_config = |
| + configuration.video_configuration.value(); |
| + std::vector<std::string> codec_vector; |
| + SplitCodecsToVector(video_config.codec.Ascii(), &codec_vector, false); |
| + |
| + // TODO(chcunningham): Update to throw exception pending outcome of |
| + // https://github.com/WICG/media-capabilities/issues/32 |
| + DCHECK_LE(codec_vector.size(), 1U); |
| + |
| + video_support = |
| + IsSupportedMediaFormat(video_config.mime_type.Ascii(), codec_vector); |
| + } |
| + |
| + // TODO(chcunningham): API should never have to mask uncertainty. Log a metric |
| + // for any content type that is "maybe" supported. |
| + if (video_support == MayBeSupported) |
| + video_support = IsSupported; |
| + if (audio_support == MayBeSupported) |
| + audio_support = IsSupported; |
| + |
| + info->supported = |
| + audio_support == IsSupported && video_support == IsSupported; |
|
mlamouri (slow - plz ping)
2017/04/25 12:48:43
Should we expect code that will check if we can su
chcunningham
2017/04/25 20:53:51
Not for now. For the unencrypted MSE case, all cod
|
| + |
| + // TODO(chcunningham, mlamouri): real implementation for these. |
| + info->smooth = info->power_efficient = info->supported; |
| + |
| callbacks->OnSuccess(std::move(info)); |
| } |