Merge "Wire Up Max-Res Plumbing" into lmp-mr1-dev

This commit is contained in:
Jeff Tinker
2014-11-06 02:36:01 +00:00
committed by Android (Google) Code Review
10 changed files with 41 additions and 2 deletions

View File

@@ -123,6 +123,10 @@ class CdmEngine {
virtual bool DetachEventListener(const CdmSessionId& session_id,
WvCdmEventListener* listener);
// Used for notifying the Max-Res Engine of resolution changes
virtual void NotifyResolution(const CdmSessionId& session_id, uint32_t width,
uint32_t height);
// Timer expiration method
virtual void OnTimerEvent();

View File

@@ -80,6 +80,9 @@ class CdmSession {
virtual bool AttachEventListener(WvCdmEventListener* listener);
virtual bool DetachEventListener(WvCdmEventListener* listener);
// Used for notifying the Policy Engine of resolution changes
virtual void NotifyResolution(uint32_t width, uint32_t height);
virtual void OnTimerEvent(bool update_usage);
virtual void OnKeyReleaseEvent(const CdmKeySetId& key_set_id);

View File

@@ -56,6 +56,9 @@ class PolicyEngine {
virtual void UpdateLicense(
const video_widevine_server::sdk::License& license);
// Used for notifying the Policy Engine of resolution changes
virtual void NotifyResolution(uint32_t width, uint32_t height);
virtual CdmResponseType Query(CdmQueryMap* key_info);
virtual const LicenseIdentification& license_id() { return license_id_; }

View File

@@ -847,7 +847,6 @@ bool CdmEngine::FindSessionForKey(
bool CdmEngine::AttachEventListener(
const CdmSessionId& session_id,
WvCdmEventListener* listener) {
CdmSessionMap::iterator iter = sessions_.find(session_id);
if (iter == sessions_.end()) {
return false;
@@ -859,7 +858,6 @@ bool CdmEngine::AttachEventListener(
bool CdmEngine::DetachEventListener(
const CdmSessionId& session_id,
WvCdmEventListener* listener) {
CdmSessionMap::iterator iter = sessions_.find(session_id);
if (iter == sessions_.end()) {
return false;
@@ -868,6 +866,14 @@ bool CdmEngine::DetachEventListener(
return iter->second->DetachEventListener(listener);
}
void CdmEngine::NotifyResolution(const CdmSessionId& session_id, uint32_t width,
uint32_t height) {
CdmSessionMap::iterator iter = sessions_.find(session_id);
if (iter != sessions_.end()) {
iter->second->NotifyResolution(width, height);
}
}
bool CdmEngine::ValidateKeySystem(const CdmKeySystem& key_system) {
return (key_system.find("widevine") != std::string::npos);
}

View File

@@ -554,6 +554,10 @@ bool CdmSession::DetachEventListener(WvCdmEventListener* listener) {
return (listeners_.erase(listener) == 1);
}
void CdmSession::NotifyResolution(uint32_t width, uint32_t height) {
policy_engine_->NotifyResolution(width, height);
}
void CdmSession::OnTimerEvent(bool update_usage) {
bool event_occurred = false;
CdmEventType event;

View File

@@ -208,6 +208,10 @@ void PolicyEngine::DecryptionEvent() {
last_playback_time_ = clock_->GetCurrentTime();
}
void PolicyEngine::NotifyResolution(uint32_t width, uint32_t height) {
max_res_engine_.SetResolution(width, height);
}
CdmResponseType PolicyEngine::Query(CdmQueryMap* key_info) {
std::stringstream ss;
int64_t current_time = clock_->GetCurrentTime();

View File

@@ -109,6 +109,9 @@ class WvContentDecryptionModule : public TimerHandler {
virtual bool DetachEventListener(const CdmSessionId& session_id,
WvCdmEventListener* listener);
virtual void NotifyResolution(const CdmSessionId& session_id, uint32_t width,
uint32_t height);
private:
uint32_t GenerateSessionSharingId();

View File

@@ -207,6 +207,12 @@ bool WvContentDecryptionModule::DetachEventListener(
return cdm_engine_->DetachEventListener(session_id, listener);
}
void WvContentDecryptionModule::NotifyResolution(const CdmSessionId& session_id,
uint32_t width,
uint32_t height) {
cdm_engine_->NotifyResolution(session_id, width, height);
}
void WvContentDecryptionModule::EnablePolicyTimer() {
if (!policy_timer_.IsRunning())
policy_timer_.Start(this, kCdmPolicyTimerDurationSeconds);

View File

@@ -22,6 +22,8 @@ class WVCryptoPlugin : public android::CryptoPlugin {
virtual bool requiresSecureDecoderComponent(const char* mime) const;
virtual void notifyResolution(uint32_t width, uint32_t height);
virtual ssize_t decrypt(bool secure, const uint8_t key[16],
const uint8_t iv[16], Mode mode, const void* srcPtr,
const SubSample* subSamples, size_t numSubSamples,

View File

@@ -64,6 +64,10 @@ bool WVCryptoPlugin::requiresSecureDecoderComponent(const char* mime) const {
}
}
void WVCryptoPlugin::notifyResolution(uint32_t width, uint32_t height) {
mCDM->NotifyResolution(mSessionId, width, height);
}
// Returns negative values for error code and
// positive values for the size of decrypted data. In theory, the output size
// can be larger than the input size, but in practice this should never happen