Index: content/renderer/media/cdm_session_adapter.cc |
diff --git a/content/renderer/media/cdm_session_adapter.cc b/content/renderer/media/cdm_session_adapter.cc |
index 312a1a6fbceb0759b159f4435c9f67ff1ced326a..50b3597eff8a46dba070a1cb2d02eb7b7e75e210 100644 |
--- a/content/renderer/media/cdm_session_adapter.cc |
+++ b/content/renderer/media/cdm_session_adapter.cc |
@@ -8,13 +8,17 @@ |
#include "base/logging.h" |
#include "base/memory/weak_ptr.h" |
#include "base/stl_util.h" |
-#include "content/renderer/media/crypto/content_decryption_module_factory.h" |
#include "content/renderer/media/crypto/key_systems.h" |
#include "content/renderer/media/webcontentdecryptionmodulesession_impl.h" |
+#include "media/base/cdm_factory.h" |
#include "media/base/cdm_promise.h" |
#include "media/base/media_keys.h" |
#include "url/gurl.h" |
+#if defined(ENABLE_BROWSER_CDMS) |
+#include "content/renderer/media/crypto/renderer_cdm_manager.h" |
+#endif // defined(ENABLE_BROWSER_CDMS) |
+ |
namespace content { |
const char kMediaEME[] = "Media.EME."; |
@@ -22,29 +26,26 @@ const char kDot[] = "."; |
CdmSessionAdapter::CdmSessionAdapter() : |
#if defined(ENABLE_BROWSER_CDMS) |
- cdm_id_(0), |
+ // TODO(xhwang): Move kInvalidCdmId to src/media. |
+ cdm_id_(RendererCdmManager::kInvalidCdmId), |
#endif |
weak_ptr_factory_(this) {} |
CdmSessionAdapter::~CdmSessionAdapter() {} |
-bool CdmSessionAdapter::Initialize( |
-#if defined(ENABLE_PEPPER_CDMS) |
- const CreatePepperCdmCB& create_pepper_cdm_cb, |
-#elif defined(ENABLE_BROWSER_CDMS) |
- RendererCdmManager* manager, |
-#endif // defined(ENABLE_PEPPER_CDMS) |
- const std::string& key_system, |
- const GURL& security_origin) { |
+bool CdmSessionAdapter::Initialize(scoped_ptr<media::CdmFactory> cdm_factory, |
ddorwin
2014/10/16 17:32:51
It seems odd to pass ownership of a factory. It fo
xhwang
2014/10/16 20:08:39
Good point. Done.
Currently we are still creating
|
+ const std::string& key_system, |
+ const GURL& security_origin) { |
+ // TODO(xhwang): This is why we need to include "key_systems.h". Move |
+ // KeySystemNameForUMA out of src/content so we can move CdmSessionAdapter to |
ddorwin
2014/10/16 17:32:51
We probably need to inject the key systems into me
xhwang
2014/10/16 20:08:39
Acknowledged.
|
+ // src/media. |
key_system_uma_prefix_ = kMediaEME + KeySystemNameForUMA(key_system) + kDot; |
+ |
base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); |
- media_keys_ = ContentDecryptionModuleFactory::Create( |
+ media_keys_ = cdm_factory->Create( |
key_system, |
security_origin, |
-#if defined(ENABLE_PEPPER_CDMS) |
- create_pepper_cdm_cb, |
-#elif defined(ENABLE_BROWSER_CDMS) |
- manager, |
+#if defined(ENABLE_BROWSER_CDMS) |
ddorwin
2014/10/16 17:32:51
We've eliminated other ifdef's. Can we eliminate t
xhwang
2014/10/16 20:08:39
Totally agreed. I am thinking about it...
This is
ddorwin
2014/10/16 20:33:20
Sounds good. Please make a separate CL after this
xhwang
2014/10/17 00:11:48
Acknowledged.
|
&cdm_id_, |
#endif // defined(ENABLE_PEPPER_CDMS) |
base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this), |