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 <string>
#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;
}

View File

@@ -13,7 +13,6 @@
#include <string>
#include <vector>
#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<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

View File

@@ -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<int>(DrmCertificate::UNKNOWN_SERVICE_TYPE);
}
} // namespace wv_pl_sdk

View File

@@ -13,7 +13,6 @@
#include <string>
#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.