OLD | NEW |
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 "chromecast/browser/media/cast_browser_cdm_factory.h" | 5 #include "chromecast/browser/media/cast_browser_cdm_factory.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "chromecast/media/cdm/cast_cdm.h" | 10 #include "chromecast/media/cdm/cast_cdm.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 CastBrowserCdmFactory::~CastBrowserCdmFactory() {} | 31 CastBrowserCdmFactory::~CastBrowserCdmFactory() {} |
32 | 32 |
33 void CastBrowserCdmFactory::Create( | 33 void CastBrowserCdmFactory::Create( |
34 const std::string& key_system, | 34 const std::string& key_system, |
35 const GURL& security_origin, | 35 const GURL& security_origin, |
36 const ::media::CdmConfig& cdm_config, | 36 const ::media::CdmConfig& cdm_config, |
37 const ::media::SessionMessageCB& session_message_cb, | 37 const ::media::SessionMessageCB& session_message_cb, |
38 const ::media::SessionClosedCB& session_closed_cb, | 38 const ::media::SessionClosedCB& session_closed_cb, |
39 const ::media::LegacySessionErrorCB& legacy_session_error_cb, | |
40 const ::media::SessionKeysChangeCB& session_keys_change_cb, | 39 const ::media::SessionKeysChangeCB& session_keys_change_cb, |
41 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb, | 40 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb, |
42 const ::media::CdmCreatedCB& cdm_created_cb) { | 41 const ::media::CdmCreatedCB& cdm_created_cb) { |
43 // Bound |cdm_created_cb| so we always fire it asynchronously. | 42 // Bound |cdm_created_cb| so we always fire it asynchronously. |
44 ::media::CdmCreatedCB bound_cdm_created_cb = | 43 ::media::CdmCreatedCB bound_cdm_created_cb = |
45 ::media::BindToCurrentLoop(cdm_created_cb); | 44 ::media::BindToCurrentLoop(cdm_created_cb); |
46 | 45 |
47 DCHECK(!cdm_config.use_hw_secure_codecs) | 46 DCHECK(!cdm_config.use_hw_secure_codecs) |
48 << "Chromecast does not use |use_hw_secure_codecs|"; | 47 << "Chromecast does not use |use_hw_secure_codecs|"; |
49 | 48 |
(...skipping 10 matching lines...) Expand all Loading... |
60 LOG(INFO) << "No matching key system found: " << cast_key_system; | 59 LOG(INFO) << "No matching key system found: " << cast_key_system; |
61 bound_cdm_created_cb.Run(nullptr, "No matching key system found."); | 60 bound_cdm_created_cb.Run(nullptr, "No matching key system found."); |
62 return; | 61 return; |
63 } | 62 } |
64 | 63 |
65 task_runner_->PostTask( | 64 task_runner_->PostTask( |
66 FROM_HERE, | 65 FROM_HERE, |
67 base::Bind(&CastCdm::Initialize, base::Unretained(cast_cdm.get()), | 66 base::Bind(&CastCdm::Initialize, base::Unretained(cast_cdm.get()), |
68 ::media::BindToCurrentLoop(session_message_cb), | 67 ::media::BindToCurrentLoop(session_message_cb), |
69 ::media::BindToCurrentLoop(session_closed_cb), | 68 ::media::BindToCurrentLoop(session_closed_cb), |
70 ::media::BindToCurrentLoop(legacy_session_error_cb), | |
71 ::media::BindToCurrentLoop(session_keys_change_cb), | 69 ::media::BindToCurrentLoop(session_keys_change_cb), |
72 ::media::BindToCurrentLoop(session_expiration_update_cb))); | 70 ::media::BindToCurrentLoop(session_expiration_update_cb))); |
73 | 71 |
74 // When using Mojo media, we do not need to proxy calls to the CMA thread. All | 72 // When using Mojo media, we do not need to proxy calls to the CMA thread. All |
75 // calls are made on that thread already. | 73 // calls are made on that thread already. |
76 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 74 #if defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
77 bound_cdm_created_cb.Run(cast_cdm, ""); | 75 bound_cdm_created_cb.Run(cast_cdm, ""); |
78 #else | 76 #else |
79 bound_cdm_created_cb.Run(new CastCdmProxy(cast_cdm, task_runner_), ""); | 77 bound_cdm_created_cb.Run(new CastCdmProxy(cast_cdm, task_runner_), ""); |
80 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) | 78 #endif // defined(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
81 } | 79 } |
82 | 80 |
83 scoped_refptr<CastCdm> CastBrowserCdmFactory::CreatePlatformBrowserCdm( | 81 scoped_refptr<CastCdm> CastBrowserCdmFactory::CreatePlatformBrowserCdm( |
84 const CastKeySystem& cast_key_system, | 82 const CastKeySystem& cast_key_system, |
85 const GURL& security_origin) { | 83 const GURL& security_origin) { |
86 return nullptr; | 84 return nullptr; |
87 } | 85 } |
88 | 86 |
89 } // namespace media | 87 } // namespace media |
90 } // namespace chromecast | 88 } // namespace chromecast |
OLD | NEW |