| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "webencryptedmediaclient_impl.h" | 5 #include "webencryptedmediaclient_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // Check that |container_mime_type| and |codecs| are supported by the CDM. | 139 // Check that |container_mime_type| and |codecs| are supported by the CDM. |
| 140 // This check does not handle extended codecs, so extended codec information | 140 // This check does not handle extended codecs, so extended codec information |
| 141 // is stripped. | 141 // is stripped. |
| 142 std::vector<std::string> codec_vector; | 142 std::vector<std::string> codec_vector; |
| 143 net::ParseCodecString(codecs, &codec_vector, true); | 143 net::ParseCodecString(codecs, &codec_vector, true); |
| 144 if (!key_systems.IsSupportedCodecCombination( | 144 if (!key_systems.IsSupportedCodecCombination( |
| 145 key_system, media_type, container_lower, codec_vector)) { | 145 key_system, media_type, container_lower, codec_vector)) { |
| 146 return false; | 146 return false; |
| 147 } | 147 } |
| 148 | 148 |
| 149 if (codec_vector.empty()) | 149 // Check that |container_mime_type| is supported by Chrome. This can only |
| 150 return true; | 150 // happen if the CDM declares support for a container that Chrome does not. |
| 151 if (!net::IsSupportedMediaMimeType(container_lower)) { |
| 152 NOTREACHED(); |
| 153 return false; |
| 154 } |
| 151 | 155 |
| 152 // Check that |codecs| are supported by Chrome. This is done primarily to | 156 // Check that |codecs| are supported by Chrome. This is done primarily to |
| 153 // validate extended codecs, but it also ensures that the CDM cannot support | 157 // validate extended codecs, but it also ensures that the CDM cannot support |
| 154 // codecs that Chrome does not (which could complicate the robustness | 158 // codecs that Chrome does not (which could complicate the robustness |
| 155 // algorithm). | 159 // algorithm). |
| 160 if (codec_vector.empty()) |
| 161 return true; |
| 156 codec_vector.clear(); | 162 codec_vector.clear(); |
| 157 net::ParseCodecString(codecs, &codec_vector, false); | 163 net::ParseCodecString(codecs, &codec_vector, false); |
| 158 return (net::IsSupportedStrictMediaMimeType(container_lower, codec_vector) == | 164 return (net::IsSupportedStrictMediaMimeType(container_lower, codec_vector) == |
| 159 net::IsSupported); | 165 net::IsSupported); |
| 160 } | 166 } |
| 161 | 167 |
| 162 static bool GetSupportedCapabilities( | 168 static bool GetSupportedCapabilities( |
| 163 const KeySystems& key_systems, | 169 const KeySystems& key_systems, |
| 164 const std::string& key_system, | 170 const std::string& key_system, |
| 165 EmeMediaType media_type, | 171 EmeMediaType media_type, |
| (...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 return reporter; | 698 return reporter; |
| 693 | 699 |
| 694 // Reporter not found, so create one. | 700 // Reporter not found, so create one. |
| 695 auto result = | 701 auto result = |
| 696 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); | 702 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); |
| 697 DCHECK(result.second); | 703 DCHECK(result.second); |
| 698 return result.first->second; | 704 return result.first->second; |
| 699 } | 705 } |
| 700 | 706 |
| 701 } // namespace media | 707 } // namespace media |
| OLD | NEW |