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

Side by Side Diff: chrome/renderer/media/chrome_key_systems.cc

Issue 23828007: Check whether the Pepper CDM is available before adding the key system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
OLDNEW
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 "chrome/renderer/media/chrome_key_systems.h" 5 #include "chrome/renderer/media/chrome_key_systems.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/render_messages.h"
9 #include "content/public/renderer/render_thread.h"
8 10
9 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. 11 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
10 12
11 // The following must be after widevine_cdm_version.h. 13 // The following must be after widevine_cdm_version.h.
12 14
13 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) 15 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
14 #include <gnu/libc-version.h> 16 #include <gnu/libc-version.h>
15 #include "base/version.h" 17 #include "base/version.h"
16 #endif 18 #endif
17 19
(...skipping 26 matching lines...) Expand all
44 static void AddWidevineForCodecs( 46 static void AddWidevineForCodecs(
45 SupportedCodecs supported_codecs, 47 SupportedCodecs supported_codecs,
46 std::vector<KeySystemInfo>* concrete_key_systems) { 48 std::vector<KeySystemInfo>* concrete_key_systems) {
47 static const char kWidevineParentKeySystem[] = "com.widevine"; 49 static const char kWidevineParentKeySystem[] = "com.widevine";
48 #if defined(OS_ANDROID) 50 #if defined(OS_ANDROID)
49 static const uint8 kWidevineUuid[16] = { 51 static const uint8 kWidevineUuid[16] = {
50 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, 52 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
51 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; 53 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
52 #endif 54 #endif
53 55
54 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
55 Version glibc_version(gnu_get_libc_version());
56 DCHECK(glibc_version.IsValid());
57 if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION))
58 return;
59 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
60
61 KeySystemInfo info(kWidevineKeySystem); 56 KeySystemInfo info(kWidevineKeySystem);
62 57
63 if (supported_codecs & WEBM_VP8_AND_VORBIS) { 58 if (supported_codecs & WEBM_VP8_AND_VORBIS) {
64 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis)); 59 info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis));
65 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8)); 60 info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8));
66 } 61 }
67 62
68 #if defined(USE_PROPRIETARY_CODECS) 63 #if defined(USE_PROPRIETARY_CODECS)
69 if (supported_codecs & MP4_AAC) 64 if (supported_codecs & MP4_AAC)
70 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a)); 65 info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
71 66
72 if (supported_codecs & MP4_AVC1) { 67 if (supported_codecs & MP4_AVC1) {
73 const char* video_codecs = (supported_codecs & MP4_AAC) ? kMp4aAvc1 : kAvc1; 68 const char* video_codecs = (supported_codecs & MP4_AAC) ? kMp4aAvc1 : kAvc1;
74 info.supported_types.push_back(std::make_pair(kVideoMp4, video_codecs)); 69 info.supported_types.push_back(std::make_pair(kVideoMp4, video_codecs));
75 } 70 }
76 #endif // defined(USE_PROPRIETARY_CODECS) 71 #endif // defined(USE_PROPRIETARY_CODECS)
77 72
78 info.parent_key_system = kWidevineParentKeySystem; 73 info.parent_key_system = kWidevineParentKeySystem;
79 74
80 #if defined(ENABLE_PEPPER_CDMS) 75 #if defined(ENABLE_PEPPER_CDMS)
81 info.pepper_type = kWidevineCdmPluginMimeType; 76 info.pepper_type = kWidevineCdmPluginMimeType;
82 #elif defined(OS_ANDROID) 77 #elif defined(OS_ANDROID)
83 info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid)); 78 info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid));
84 #endif // defined(ENABLE_PEPPER_CDMS) 79 #endif // defined(ENABLE_PEPPER_CDMS)
85 80
86 concrete_key_systems->push_back(info); 81 concrete_key_systems->push_back(info);
87 } 82 }
88 83
89 #if defined(ENABLE_PEPPER_CDMS) 84 #if defined(ENABLE_PEPPER_CDMS)
85 static bool IsPepperCdmAvailable(const std::string& pepper_type) {
86 bool is_available = false;
scherkus (not reviewing) 2013/09/11 22:34:41 do you want cache this value?
ddorwin 2013/09/16 17:17:58 It's not really necessary. This should only happen
scherkus (not reviewing) 2013/09/16 17:42:05 seems fine as is
87 content::RenderThread::Get()->Send(
88 new ChromeViewHostMsg_IsSupportingPluginAvailable(pepper_type,
89 &is_available));
90
91 return is_available;
92 }
93
90 // Supported types are determined at compile time. 94 // Supported types are determined at compile time.
91 static void AddPepperBasedWidevine( 95 static void AddPepperBasedWidevine(
92 std::vector<KeySystemInfo>* concrete_key_systems) { 96 std::vector<KeySystemInfo>* concrete_key_systems) {
97 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
98 Version glibc_version(gnu_get_libc_version());
99 DCHECK(glibc_version.IsValid());
100 if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION))
101 return;
102 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
103
104 if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType)) {
105 DVLOG(1) << "Widevine CDM is not currently available.";
106 return;
107 }
108
93 SupportedCodecs supported_codecs = WEBM_VP8_AND_VORBIS; 109 SupportedCodecs supported_codecs = WEBM_VP8_AND_VORBIS;
94 110
95 #if defined(USE_PROPRIETARY_CODECS) 111 #if defined(USE_PROPRIETARY_CODECS)
96 #if defined(WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE) 112 #if defined(WIDEVINE_CDM_AAC_SUPPORT_AVAILABLE)
97 supported_codecs = static_cast<SupportedCodecs>(supported_codecs | MP4_AAC); 113 supported_codecs = static_cast<SupportedCodecs>(supported_codecs | MP4_AAC);
98 #endif 114 #endif
99 #if defined(WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE) 115 #if defined(WIDEVINE_CDM_AVC1_SUPPORT_AVAILABLE)
100 supported_codecs = static_cast<SupportedCodecs>(supported_codecs | MP4_AVC1); 116 supported_codecs = static_cast<SupportedCodecs>(supported_codecs | MP4_AVC1);
101 #endif 117 #endif
102 #endif // defined(USE_PROPRIETARY_CODECS) 118 #endif // defined(USE_PROPRIETARY_CODECS)
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 #endif 175 #endif
160 176
161 #if defined(WIDEVINE_CDM_AVAILABLE) 177 #if defined(WIDEVINE_CDM_AVAILABLE)
162 #if defined(ENABLE_PEPPER_CDMS) 178 #if defined(ENABLE_PEPPER_CDMS)
163 AddPepperBasedWidevine(key_systems_info); 179 AddPepperBasedWidevine(key_systems_info);
164 #elif defined(OS_ANDROID) 180 #elif defined(OS_ANDROID)
165 AddAndroidWidevine(key_systems_info); 181 AddAndroidWidevine(key_systems_info);
166 #endif 182 #endif
167 #endif 183 #endif
168 } 184 }
OLDNEW
« chrome/common/render_messages.h ('K') | « chrome/common/render_messages.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698