From 8397ada45576bd6a32b40b90df10e22480ae19f7 Mon Sep 17 00:00:00 2001 From: Ramji Chandramouli Date: Tue, 5 Feb 2019 15:38:34 -0800 Subject: [PATCH] Fixed - 'example' deps. - exposing 'internal' include files in external headers. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=232572457 --- example/BUILD | 1 + .../common/wvpl/wvpl_cas_proxy_session.cc | 9 ++++++--- .../common/wvpl/wvpl_cas_proxy_session.h | 19 +++++++++++++------ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/example/BUILD b/example/BUILD index 77ad63a..e93d28d 100644 --- a/example/BUILD +++ b/example/BUILD @@ -38,5 +38,6 @@ cc_binary( deps = [ "//media_cas_proxy_sdk/external/common/wvpl:wvpl_cas_proxy_environment", "//media_cas_proxy_sdk/external/common/wvpl:wvpl_cas_proxy_session", + "//sdk/external/common/wvpl:wvpl_sdk_environment", ], ) diff --git a/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.cc b/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.cc index dd4df34..aabb5ca 100644 --- a/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.cc +++ b/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.cc @@ -10,6 +10,7 @@ #include #include "google/protobuf/util/json_util.h" #include "absl/strings/escaping.h" +#include "absl/synchronization/mutex.h" #include "common/error_space.h" #include "common/status.h" #include "sdk/external/common/wvpl/wvpl_types.h" @@ -105,7 +106,7 @@ WvPLStatus WvPLCASProxySession::BuildCasDrmLicenseRequest( cas_drm_license_request->set_payload(license_request_from_cdm_); cas_drm_license_request->set_provider_id(provider_); cas_drm_license_request->set_content_id(pssh_data_.content_id()); - absl::ReaderMutexLock lock(&cas_keys_mutex_); + absl::ReaderMutexLock lock(cas_keys_mutex_.get()); for (const auto& it : cas_keys_) { if (it.even_key_bytes().empty()) { return WvPLStatus(error_space, widevine::MISSING_EVEN_KEY, @@ -146,7 +147,7 @@ WvPLStatus WvPLCASProxySession::BuildCasDrmLicenseRequest( } WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) { - absl::WriterMutexLock lock(&cas_keys_mutex_); + absl::WriterMutexLock lock(cas_keys_mutex_.get()); cas_keys_.push_back(key); return OkStatus(); } @@ -154,9 +155,11 @@ WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) { WvPLCASProxySession::WvPLCASProxySession( const widevine::DrmRootCertificate* drm_root_certificate, const std::string& cas_license_request_from_cdm) - : WvPLSDKSession(drm_root_certificate) { + : WvPLSDKSession(drm_root_certificate), cas_keys_mutex_(new absl::Mutex()) { license_request_from_cdm_ = cas_license_request_from_cdm; } +WvPLCASProxySession::~WvPLCASProxySession() = default; + } // namespace wv_pl_sdk } // namespace widevine_server diff --git a/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h b/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h index 9fadd05..41af1a9 100644 --- a/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h +++ b/media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h @@ -9,11 +9,18 @@ #ifndef MEDIA_CAS_PROXY_SDK_EXTERNAL_COMMON_WVPL_WVPL_CAS_PROXY_SESSION_H_ #define MEDIA_CAS_PROXY_SDK_EXTERNAL_COMMON_WVPL_WVPL_CAS_PROXY_SESSION_H_ +#include #include #include -#include "absl/synchronization/mutex.h" #include "sdk/external/common/wvpl/wvpl_sdk_session.h" -#include "protos/public/media_cas_license.pb.h" + +namespace absl { +class Mutex; +} // namespace absl + +namespace widevine { +class CasDrmLicenseRequest; +} // namespace widevine namespace widevine_server { namespace wv_pl_sdk { @@ -48,7 +55,7 @@ constexpr uint32_t kRelease = 2; */ class WvPLCASProxySession : public WvPLSDKSession { public: - ~WvPLCASProxySession() override {} + ~WvPLCASProxySession() override; /** * Returns a std::string containing the version in the form - @@ -101,10 +108,10 @@ class WvPLCASProxySession : public WvPLSDKSession { std::string provider_; // holds all the WvPLCasKey objects. Used when generating a CAS License. - std::vector cas_keys_ GUARDED_BY(cas_keys_mutex_); + std::vector cas_keys_; - // Mutex to protect the keys owned by this session. - mutable absl::Mutex cas_keys_mutex_; + // Mutex to protect the keys, |cas_keys_|, owned by this session. + mutable std::unique_ptr cas_keys_mutex_; }; } // namespace wv_pl_sdk