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

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

Issue 877323009: Extracted media mime type checks from net/base/ into media/base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fixes #1 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
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"
11 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
12 #include "media/base/key_systems.h" 12 #include "media/base/key_systems.h"
13 #include "media/base/media_permission.h" 13 #include "media/base/media_permission.h"
14 #include "media/base/mime_util.h"
14 #include "media/blink/webcontentdecryptionmodule_impl.h" 15 #include "media/blink/webcontentdecryptionmodule_impl.h"
15 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h" 16 #include "media/blink/webcontentdecryptionmoduleaccess_impl.h"
16 #include "net/base/mime_util.h"
17 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h" 17 #include "third_party/WebKit/public/platform/WebEncryptedMediaRequest.h"
18 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h" 18 #include "third_party/WebKit/public/platform/WebMediaKeySystemConfiguration.h"
19 #include "third_party/WebKit/public/platform/WebString.h" 19 #include "third_party/WebKit/public/platform/WebString.h"
20 #include "third_party/WebKit/public/platform/WebVector.h" 20 #include "third_party/WebKit/public/platform/WebVector.h"
21 21
22 namespace media { 22 namespace media {
23 23
24 // These names are used by UMA. 24 // These names are used by UMA.
25 const char kKeySystemSupportUMAPrefix[] = 25 const char kKeySystemSupportUMAPrefix[] =
26 "Media.EME.RequestMediaKeySystemAccess."; 26 "Media.EME.RequestMediaKeySystemAccess.";
(...skipping 17 matching lines...) Expand all
44 // parameters can be rejected. http://crbug.com/417561 44 // parameters can be rejected. http://crbug.com/417561
45 // TODO(sandersd): Pass in the media type (audio or video) and check that the 45 // TODO(sandersd): Pass in the media type (audio or video) and check that the
46 // container type matches. http://crbug.com/457384 46 // container type matches. http://crbug.com/457384
47 std::string container = base::StringToLowerASCII(mime_type); 47 std::string container = base::StringToLowerASCII(mime_type);
48 48
49 // Check that |codecs| are supported by the CDM. This check does not handle 49 // Check that |codecs| are supported by the CDM. This check does not handle
50 // extended codecs, so extended codec information is stripped. 50 // extended codecs, so extended codec information is stripped.
51 // TODO(sandersd): Reject codecs that do not match the media type. 51 // TODO(sandersd): Reject codecs that do not match the media type.
52 // http://crbug.com/457386 52 // http://crbug.com/457386
53 std::vector<std::string> codec_vector; 53 std::vector<std::string> codec_vector;
54 net::ParseCodecString(codecs, &codec_vector, true); 54 media::ParseCodecString(codecs, &codec_vector, true);
55 if (!IsSupportedKeySystemWithMediaMimeType(container, codec_vector, 55 if (!IsSupportedKeySystemWithMediaMimeType(container, codec_vector,
56 key_system)) { 56 key_system)) {
57 return false; 57 return false;
58 } 58 }
59 59
60 // Check that |codecs| are supported by Chrome. This is done primarily to 60 // Check that |codecs| are supported by Chrome. This is done primarily to
61 // validate extended codecs, but it also ensures that the CDM cannot support 61 // validate extended codecs, but it also ensures that the CDM cannot support
62 // codecs that Chrome does not (which would be bad because it would require 62 // codecs that Chrome does not (which would be bad because it would require
63 // considering the accumulated configuration, and could affect whether secure 63 // considering the accumulated configuration, and could affect whether secure
64 // decode is required). 64 // decode is required).
65 // TODO(sandersd): Reject ambiguous codecs. http://crbug.com/374751 65 // TODO(sandersd): Reject ambiguous codecs. http://crbug.com/374751
66 codec_vector.clear(); 66 codec_vector.clear();
67 net::ParseCodecString(codecs, &codec_vector, false); 67 media::ParseCodecString(codecs, &codec_vector, false);
68 return net::AreSupportedMediaCodecs(codec_vector); 68 return media::AreSupportedMediaCodecs(codec_vector);
69 } 69 }
70 70
71 static bool GetSupportedCapabilities( 71 static bool GetSupportedCapabilities(
72 const std::string& key_system, 72 const std::string& key_system,
73 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>& 73 const blink::WebVector<blink::WebMediaKeySystemMediaCapability>&
74 capabilities, 74 capabilities,
75 std::vector<blink::WebMediaKeySystemMediaCapability>* 75 std::vector<blink::WebMediaKeySystemMediaCapability>*
76 media_type_capabilities) { 76 media_type_capabilities) {
77 // From 77 // From
78 // https://w3c.github.io/encrypted-media/#get-supported-capabilities-for-media -type 78 // https://w3c.github.io/encrypted-media/#get-supported-capabilities-for-media -type
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 return reporter; 510 return reporter;
511 511
512 // Reporter not found, so create one. 512 // Reporter not found, so create one.
513 auto result = 513 auto result =
514 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name))); 514 reporters_.add(uma_name, make_scoped_ptr(new Reporter(uma_name)));
515 DCHECK(result.second); 515 DCHECK(result.second);
516 return result.first->second; 516 return result.first->second;
517 } 517 }
518 518
519 } // namespace media 519 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mime_util_unittest.cc ('k') | media/media.gyp » ('j') | net/base/mime_util.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698