OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/media/crypto/key_systems.h" | 5 #include "content/renderer/media/crypto/key_systems.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/containers/hash_tables.h" | 9 #include "base/containers/hash_tables.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 DCHECK(!container.empty()); | 274 DCHECK(!container.empty()); |
275 DCHECK(!codecs.empty()); | 275 DCHECK(!codecs.empty()); |
276 DCHECK(IsSupportedContainer(container, key_system_supported_codecs)); | 276 DCHECK(IsSupportedContainer(container, key_system_supported_codecs)); |
277 | 277 |
278 CodecMaskMap::const_iterator container_iter = | 278 CodecMaskMap::const_iterator container_iter = |
279 container_codec_masks_.find(container); | 279 container_codec_masks_.find(container); |
280 EmeCodec container_codec_mask = container_iter->second; | 280 EmeCodec container_codec_mask = container_iter->second; |
281 | 281 |
282 for (size_t i = 0; i < codecs.size(); ++i) { | 282 for (size_t i = 0; i < codecs.size(); ++i) { |
283 const std::string& codec = codecs[i]; | 283 const std::string& codec = codecs[i]; |
284 DCHECK(!codec.empty()); | 284 if (codec.empty()) |
ddorwin
2014/04/26 00:51:36
Does this cause use to accept a real string like "
| |
285 continue; | |
285 CodecMaskMap::const_iterator codec_iter = codec_masks_.find(codec); | 286 CodecMaskMap::const_iterator codec_iter = codec_masks_.find(codec); |
286 if (codec_iter == codec_masks_.end()) // Unrecognized codec. | 287 if (codec_iter == codec_masks_.end()) // Unrecognized codec. |
287 return false; | 288 return false; |
288 | 289 |
289 EmeCodec codec_mask = codec_iter->second; | 290 EmeCodec codec_mask = codec_iter->second; |
290 if (!(codec_mask & key_system_supported_codecs)) // Unsupported codec. | 291 if (!(codec_mask & key_system_supported_codecs)) // Unsupported codec. |
291 return false; | 292 return false; |
292 | 293 |
293 // Unsupported codec/container combination, e.g. "video/webm" and "avc1". | 294 // Unsupported codec/container combination, e.g. "video/webm" and "avc1". |
294 if (!(codec_mask & container_codec_mask)) | 295 if (!(codec_mask & container_codec_mask)) |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 CONTENT_EXPORT void AddContainerMask(const std::string& container, | 445 CONTENT_EXPORT void AddContainerMask(const std::string& container, |
445 uint32 mask) { | 446 uint32 mask) { |
446 KeySystems::GetInstance().AddContainerMask(container, mask); | 447 KeySystems::GetInstance().AddContainerMask(container, mask); |
447 } | 448 } |
448 | 449 |
449 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { | 450 CONTENT_EXPORT void AddCodecMask(const std::string& codec, uint32 mask) { |
450 KeySystems::GetInstance().AddCodecMask(codec, mask); | 451 KeySystems::GetInstance().AddCodecMask(codec, mask); |
451 } | 452 } |
452 | 453 |
453 } // namespace content | 454 } // namespace content |
OLD | NEW |