OLD | NEW |
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 "content/renderer/media/cdm/render_cdm_factory.h" | 5 #include "content/renderer/media/cdm/render_cdm_factory.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 | 50 |
51 if (!security_origin.is_valid()) { | 51 if (!security_origin.is_valid()) { |
52 base::ThreadTaskRunnerHandle::Get()->PostTask( | 52 base::ThreadTaskRunnerHandle::Get()->PostTask( |
53 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); | 53 FROM_HERE, base::Bind(cdm_created_cb, nullptr, "Invalid origin.")); |
54 return; | 54 return; |
55 } | 55 } |
56 | 56 |
57 if (media::CanUseAesDecryptor(key_system)) { | 57 if (media::CanUseAesDecryptor(key_system)) { |
58 DCHECK(!cdm_config.allow_distinctive_identifier); | 58 DCHECK(!cdm_config.allow_distinctive_identifier); |
59 DCHECK(!cdm_config.allow_persistent_state); | 59 DCHECK(!cdm_config.allow_persistent_state); |
60 scoped_refptr<media::ContentDecryptionModule> cdm( | 60 scoped_refptr<media::ContentDecryptionModule> cdm(new media::AesDecryptor( |
61 new media::AesDecryptor(security_origin, session_message_cb, | 61 security_origin, session_message_cb, session_closed_cb, |
62 session_closed_cb, session_keys_change_cb)); | 62 session_keys_change_cb, session_expiration_update_cb)); |
63 base::ThreadTaskRunnerHandle::Get()->PostTask( | 63 base::ThreadTaskRunnerHandle::Get()->PostTask( |
64 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); | 64 FROM_HERE, base::Bind(cdm_created_cb, cdm, "")); |
65 return; | 65 return; |
66 } | 66 } |
67 | 67 |
68 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 68 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
69 DCHECK(!cdm_config.use_hw_secure_codecs); | 69 DCHECK(!cdm_config.use_hw_secure_codecs); |
70 PpapiDecryptor::Create( | 70 PpapiDecryptor::Create( |
71 key_system, security_origin, cdm_config.allow_distinctive_identifier, | 71 key_system, security_origin, cdm_config.allow_distinctive_identifier, |
72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, | 72 cdm_config.allow_persistent_state, create_pepper_cdm_cb_, |
73 session_message_cb, session_closed_cb, session_keys_change_cb, | 73 session_message_cb, session_closed_cb, session_keys_change_cb, |
74 session_expiration_update_cb, cdm_created_cb); | 74 session_expiration_update_cb, cdm_created_cb); |
75 #else | 75 #else |
76 // No possible CDM to create, so fail the request. | 76 // No possible CDM to create, so fail the request. |
77 base::ThreadTaskRunnerHandle::Get()->PostTask( | 77 base::ThreadTaskRunnerHandle::Get()->PostTask( |
78 FROM_HERE, | 78 FROM_HERE, |
79 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); | 79 base::Bind(cdm_created_cb, nullptr, "Key system not supported.")); |
80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 80 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
81 } | 81 } |
82 | 82 |
83 } // namespace content | 83 } // namespace content |
OLD | NEW |