#include "media/mojo/services/mojo_cdm_service.h"
#include <map>
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/synchronization/lock.h"
#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "media/base/cdm_config.h"
#include "media/base/cdm_context.h"
#include "media/base/cdm_factory.h"
#include "media/base/cdm_key_information.h"
#include "media/base/content_decryption_module.h"
#include "media/base/key_systems.h"
#include "media/mojo/common/media_type_converters.h"
#include "media/mojo/services/mojo_cdm_service_context.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
namespace media {
SimpleMojoCdmPromise;
KeyStatusMojoCdmPromise;
NewSessionMojoCdmPromise;
MojoCdmService::MojoCdmService(MojoCdmServiceContext* context)
: … { … }
MojoCdmService::~MojoCdmService() { … }
void MojoCdmService::Initialize(CdmFactory* cdm_factory,
const CdmConfig& cdm_config,
InitializeCB init_cb) { … }
void MojoCdmService::SetClient(
mojo::PendingAssociatedRemote<mojom::ContentDecryptionModuleClient>
client) { … }
void MojoCdmService::SetServerCertificate(
const std::vector<uint8_t>& certificate_data,
SetServerCertificateCallback callback) { … }
void MojoCdmService::GetStatusForPolicy(HdcpVersion min_hdcp_version,
GetStatusForPolicyCallback callback) { … }
void MojoCdmService::CreateSessionAndGenerateRequest(
CdmSessionType session_type,
EmeInitDataType init_data_type,
const std::vector<uint8_t>& init_data,
CreateSessionAndGenerateRequestCallback callback) { … }
void MojoCdmService::LoadSession(CdmSessionType session_type,
const std::string& session_id,
LoadSessionCallback callback) { … }
void MojoCdmService::UpdateSession(const std::string& session_id,
const std::vector<uint8_t>& response,
UpdateSessionCallback callback) { … }
void MojoCdmService::CloseSession(const std::string& session_id,
CloseSessionCallback callback) { … }
void MojoCdmService::RemoveSession(const std::string& session_id,
RemoveSessionCallback callback) { … }
scoped_refptr<ContentDecryptionModule> MojoCdmService::GetCdm() { … }
void MojoCdmService::OnCdmCreated(
InitializeCB init_cb,
const scoped_refptr<::media::ContentDecryptionModule>& cdm,
CreateCdmStatus status) { … }
void MojoCdmService::OnSessionMessage(const std::string& session_id,
::media::CdmMessageType message_type,
const std::vector<uint8_t>& message) { … }
void MojoCdmService::OnSessionKeysChange(const std::string& session_id,
bool has_additional_usable_key,
CdmKeysInfo keys_info) { … }
void MojoCdmService::OnSessionExpirationUpdate(const std::string& session_id,
base::Time new_expiry_time_sec) { … }
void MojoCdmService::OnSessionClosed(const std::string& session_id,
CdmSessionClosedReason reason) { … }
void MojoCdmService::OnDecryptorConnectionError() { … }
}