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
This commit is contained in:
Ramji Chandramouli
2019-05-21 14:51:33 -07:00
parent be0bb27305
commit 6d34128391
4 changed files with 12 additions and 13 deletions

View File

@@ -7,7 +7,9 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h" #include "media_cas_proxy_sdk/external/common/wvpl/wvpl_cas_proxy_session.h"
#include <string> #include <string>
#include "google/protobuf/util/json_util.h" #include "google/protobuf/util/json_util.h"
#include "absl/strings/escaping.h" #include "absl/strings/escaping.h"
#include "absl/synchronization/mutex.h" #include "absl/synchronization/mutex.h"
@@ -30,6 +32,10 @@ using widevine::SignedCasDrmRequest;
namespace error = widevine::error; namespace error = widevine::error;
namespace {
absl::Mutex cas_keys_mutex;
} // namespace
namespace widevine_server { namespace widevine_server {
namespace wv_pl_sdk { 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_payload(license_request_from_cdm_);
cas_drm_license_request->set_provider_id(provider_); cas_drm_license_request->set_provider_id(provider_);
cas_drm_license_request->set_content_id(pssh_data_.content_id()); 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_) { for (const auto& it : cas_keys_) {
if (it.even_key_bytes().empty()) { if (it.even_key_bytes().empty()) {
return WvPLStatus(error_space, widevine::MISSING_EVEN_KEY, return WvPLStatus(error_space, widevine::MISSING_EVEN_KEY,
@@ -147,7 +153,7 @@ WvPLStatus WvPLCASProxySession::BuildCasDrmLicenseRequest(
} }
WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) { WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) {
absl::WriterMutexLock lock(cas_keys_mutex_.get()); absl::WriterMutexLock lock(&cas_keys_mutex);
cas_keys_.push_back(key); cas_keys_.push_back(key);
return OkStatus(); return OkStatus();
} }
@@ -155,7 +161,7 @@ WvPLStatus WvPLCASProxySession::AddCasKey(const WvPLCasKey& key) {
WvPLCASProxySession::WvPLCASProxySession( WvPLCASProxySession::WvPLCASProxySession(
const widevine::DrmRootCertificate* drm_root_certificate, const widevine::DrmRootCertificate* drm_root_certificate,
const std::string& cas_license_request_from_cdm) 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; license_request_from_cdm_ = cas_license_request_from_cdm;
} }

View File

@@ -13,7 +13,6 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "absl/synchronization/mutex.h"
#include "sdk/external/common/wvpl/wvpl_sdk_session.h" #include "sdk/external/common/wvpl/wvpl_sdk_session.h"
namespace widevine { namespace widevine {
@@ -107,9 +106,6 @@ class WvPLCASProxySession : public WvPLSDKSession {
// holds all the WvPLCasKey objects. Used when generating a CAS License. // holds all the WvPLCasKey objects. Used when generating a CAS License.
std::vector<WvPLCasKey> cas_keys_; std::vector<WvPLCasKey> cas_keys_;
// Mutex to protect the keys, |cas_keys_|, owned by this session.
mutable std::unique_ptr<absl::Mutex> cas_keys_mutex_;
}; };
} // namespace wv_pl_sdk } // namespace wv_pl_sdk

View File

@@ -214,9 +214,8 @@ WvPLStatus WvPLSDKEnvironment::CheckServiceCertificateType(
"Service Certificate is wrong type")); "Service Certificate is wrong type"));
} }
widevine::DrmCertificate::ServiceType int WvPLSDKEnvironment::GetExpectedServiceCertificateType() {
WvPLSDKEnvironment::GetExpectedServiceCertificateType() { return static_cast<int>(DrmCertificate::UNKNOWN_SERVICE_TYPE);
return DrmCertificate::UNKNOWN_SERVICE_TYPE;
} }
} // namespace wv_pl_sdk } // namespace wv_pl_sdk

View File

@@ -13,7 +13,6 @@
#include <string> #include <string>
#include "sdk/external/common/wvpl/wvpl_types.h" #include "sdk/external/common/wvpl/wvpl_types.h"
#include "protos/public/drm_certificate.pb.h"
namespace widevine { namespace widevine {
class DeviceCertificateStatusList; class DeviceCertificateStatusList;
@@ -111,8 +110,7 @@ class WvPLSDKEnvironment {
private: private:
// Get the expected service type for drm service certificate. // Get the expected service type for drm service certificate.
virtual widevine::DrmCertificate::ServiceType virtual int GetExpectedServiceCertificateType();
GetExpectedServiceCertificateType();
// Check the type of |service_certificate|. Returns "OK" if the cert can be // Check the type of |service_certificate|. Returns "OK" if the cert can be
// used for the current SDK, else an error status. // used for the current SDK, else an error status.