Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(415)

Side by Side Diff: media/blink/webencryptedmediaclient_impl.cc

Issue 1035923004: Check that containers are supported by Chrome in requestMediaKeySystemAccess(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
150 return true; 150 if (!net::IsSupportedMediaMimeType(container_lower))
ddorwin 2015/03/26 17:55:10 This would allow, for example, "video/ogg", which
sandersd (OOO until July 31) 2015/03/26 18:11:05 IsSupportedCodecCombination() already makes sure t
151 return false;
151 152
152 // Check that |codecs| are supported by Chrome. This is done primarily to 153 // 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 154 // validate extended codecs, but it also ensures that the CDM cannot support
154 // codecs that Chrome does not (which could complicate the robustness 155 // codecs that Chrome does not (which could complicate the robustness
155 // algorithm). 156 // algorithm).
157 if (codec_vector.empty())
158 return true;
156 codec_vector.clear(); 159 codec_vector.clear();
157 net::ParseCodecString(codecs, &codec_vector, false); 160 net::ParseCodecString(codecs, &codec_vector, false);
158 return (net::IsSupportedStrictMediaMimeType(container_lower, codec_vector) == 161 return (net::IsSupportedStrictMediaMimeType(container_lower, codec_vector) ==
159 net::IsSupported); 162 net::IsSupported);
160 } 163 }
161 164
162 static bool GetSupportedCapabilities( 165 static bool GetSupportedCapabilities(
163 const KeySystems& key_systems, 166 const KeySystems& key_systems,
164 const std::string& key_system, 167 const std::string& key_system,
165 EmeMediaType media_type, 168 EmeMediaType media_type,
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 return reporter; 695 return reporter;
693 696
694 // Reporter not found, so create one. 697 // Reporter not found, so create one.
695 auto result = 698 auto result =
696 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); 699 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name)));
697 DCHECK(result.second); 700 DCHECK(result.second);
698 return result.first->second; 701 return result.first->second;
699 } 702 }
700 703
701 } // namespace media 704 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698