From 6d341283914f642432e8a67023b1307da3063480 Mon Sep 17 00:00:00 2001 From: Ramji Chandramouli Date: Tue, 21 May 2019 14:51:33 -0700 Subject: [PATCH] Should not expose proto headers in public SDK headers and not include absl mutex.h in public SDK headers. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=249330673 --- .../external/common/wvpl/wvpl_cas_proxy_session.cc | 12 +++++++++--- .../external/common/wvpl/wvpl_cas_proxy_session.h | 4 ---- sdk/external/common/wvpl/wvpl_sdk_environment.cc | 5 ++--- sdk/external/common/wvpl/wvpl_sdk_environment.h | 4 +--- 4 files changed, 12 insertions(+), 13 deletions(-) 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 aabb5ca..91142a3 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 @@ -7,7 +7,9 @@ //////////////////////////////////////////////////////////////////////////////// #include "media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h" + #include + #include "google/protobuf/util/json_util.h" #include "absl/strings/escaping.h" #include "absl/synchronization/mutex.h" @@ -30,6 +32,10 @@ using widevine::SignedCasDrmRequest; namespace error = widevine::error; +namespace { +absl::Mutex cas_keys_mutex; +} // namespace + namespace widevine_server { namespace wv_pl_sdk { @@ -106,7 +112,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_.get()); + absl::ReaderMutexLock lock(&cas_keys_mutex); for (const auto& it : cas_keys_) { if (it.even_key_bytes().empty()) { return WvPLStatus(error_space, widevine::MISSING_EVEN_KEY, @@ -147,7 +153,7 @@ WvPLStatus WvPLCASProxySession::BuildCasDrmLicenseRequest( } WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) { - absl::WriterMutexLock lock(cas_keys_mutex_.get()); + absl::WriterMutexLock lock(&cas_keys_mutex); cas_keys_.push_back(key); return OkStatus(); } @@ -155,7 +161,7 @@ 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), cas_keys_mutex_(new absl::Mutex()) { + : WvPLSDKSession(drm_root_certificate) { license_request_from_cdm_ = cas_license_request_from_cdm; } 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 f4d6f90..0541db4 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 @@ -13,7 +13,6 @@ #include #include -#include "absl/synchronization/mutex.h" #include "sdk/external/common/wvpl/wvpl_sdk_session.h" namespace widevine { @@ -107,9 +106,6 @@ class WvPLCASProxySession : public WvPLSDKSession { // holds all the WvPLCasKey objects. Used when generating a CAS License. std::vector cas_keys_; - - // Mutex to protect the keys, |cas_keys_|, owned by this session. - mutable std::unique_ptr cas_keys_mutex_; }; } // namespace wv_pl_sdk diff --git a/sdk/external/common/wvpl/wvpl_sdk_environment.cc b/sdk/external/common/wvpl/wvpl_sdk_environment.cc index 82ea90b..0151ed5 100644 --- a/sdk/external/common/wvpl/wvpl_sdk_environment.cc +++ b/sdk/external/common/wvpl/wvpl_sdk_environment.cc @@ -214,9 +214,8 @@ WvPLStatus WvPLSDKEnvironment::CheckServiceCertificateType( "Service Certificate is wrong type")); } -widevine::DrmCertificate::ServiceType -WvPLSDKEnvironment::GetExpectedServiceCertificateType() { - return DrmCertificate::UNKNOWN_SERVICE_TYPE; +int WvPLSDKEnvironment::GetExpectedServiceCertificateType() { + return static_cast(DrmCertificate::UNKNOWN_SERVICE_TYPE); } } // namespace wv_pl_sdk diff --git a/sdk/external/common/wvpl/wvpl_sdk_environment.h b/sdk/external/common/wvpl/wvpl_sdk_environment.h index 943345f..4af2a9c 100644 --- a/sdk/external/common/wvpl/wvpl_sdk_environment.h +++ b/sdk/external/common/wvpl/wvpl_sdk_environment.h @@ -13,7 +13,6 @@ #include #include "sdk/external/common/wvpl/wvpl_types.h" -#include "protos/public/drm_certificate.pb.h" namespace widevine { class DeviceCertificateStatusList; @@ -111,8 +110,7 @@ class WvPLSDKEnvironment { private: // Get the expected service type for drm service certificate. - virtual widevine::DrmCertificate::ServiceType - GetExpectedServiceCertificateType(); + virtual int GetExpectedServiceCertificateType(); // Check the type of |service_certificate|. Returns "OK" if the cert can be // used for the current SDK, else an error status.