- 'example' deps.
- exposing 'internal' include files in external headers.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=232572457
This commit is contained in:
Ramji Chandramouli
2019-02-05 15:38:34 -08:00
parent 356eec9f32
commit 8397ada455
3 changed files with 20 additions and 9 deletions

View File

@@ -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",
],
)

View File

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

View File

@@ -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 <memory>
#include <string>
#include <vector>
#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<WvPLCasKey> cas_keys_ GUARDED_BY(cas_keys_mutex_);
std::vector<WvPLCasKey> 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<absl::Mutex> cas_keys_mutex_;
};
} // namespace wv_pl_sdk