Fixes for b/4149416:expired license refresh, b/4126624:heartbeats, b/4171055: inconsistent license modes

Also includes b/3500025: A/V resync issues

Change-Id: Ib885d7219d211b188f38e9427bdaecd10fbd7329
This commit is contained in:
Jeffrey Tinker
2011-03-23 23:19:04 -07:00
parent 7458d581cd
commit ba5fa0ef57
13 changed files with 332 additions and 83 deletions

View File

@@ -47,16 +47,18 @@ class WVDRMPluginAPI {
std::string &dsPath, const std::string &assetIdStr,
const std::string &systemIdStr,
const std::string &keyIdStr,
uint32_t *assetId, uint32_t *systemId,
uint32_t *assetId, uint32_t *systemId,
uint32_t *keyId) = 0;
virtual bool ProcessDrmInfo(std::string &assetPath, int playbackMode) = 0;
virtual int CheckRightsStatus(std::string &path) = 0;
virtual bool GetConstraints(std::string &path, uint32_t *timeSincePlayback,
uint32_t *timeRemaining,
uint32_t *licenseDuration, std::string &lastError,
bool &allowOffline, bool &allowStreaming,
bool &denyHD) = 0;
virtual bool SetPlaybackStatus(int playbackStatus, off64_t position) = 0;
virtual bool RemoveRights(std::string &path) = 0;
virtual bool RemoveAllRights() = 0;
@@ -67,10 +69,20 @@ class WVDRMPluginAPI {
EventType_AcquireDrmInfoFailed,
EventType_ProcessDrmInfoFailed,
EventType_RightsInstalled,
EventType_RightsRemoved
EventType_RightsRemoved,
EventType_HeartbeatServer,
EventType_HeartbeatPeriod
};
typedef void (*EventHandler)(EventType type, const std::string &path);
enum EventDestination {
EventDestination_JavaAPI,
EventDestination_MediaPlayer
};
// Returns true if event sent, false if no handler
typedef bool (*EventHandler)(EventType type, EventDestination destination,
const std::string &path);
virtual void SetEventHandler(EventHandler handler) = 0;
protected:

View File

@@ -100,10 +100,32 @@ protected:
ssize_t onPread(int uniqueId, DecryptHandle* decryptHandle,
void* buffer, ssize_t numBytes, off64_t offset);
class Listener {
public:
Listener() : mListener(NULL), mUniqueId(-1) {}
Listener(IDrmEngine::OnInfoListener *listener, int uniqueId)
: mListener(listener), mUniqueId(uniqueId) {};
IDrmEngine::OnInfoListener *GetListener() const {return mListener;}
int GetUniqueId() const {return mUniqueId;}
private:
IDrmEngine::OnInfoListener *mListener;
int mUniqueId;
};
enum MessageType {
MessageType_HeartbeatServer = 4000,
MessageType_HeartbeatPeriod = 4001
};
private:
static void SendEvent(WVDRMPluginAPI::EventType code, const std::string &path);
static IDrmEngine::OnInfoListener *sOnInfoListener;
static int sUniqueId;
static bool SendEvent(WVDRMPluginAPI::EventType code, WVDRMPluginAPI::EventDestination dest,
const std::string &path);
static Vector<Listener> *sNativeListeners;
static Vector<Listener> *sJavaAPIListeners;
WVDRMPluginAPI *mDrmPluginImpl;
};