am ba5fa0ef: Fixes for b/4149416:expired license refresh, b/4126624:heartbeats, b/4171055: inconsistent license modes Also includes b/3500025: A/V resync issues

* commit 'ba5fa0ef570f6ca3524f8158a23371528930f0fc':
  Fixes for b/4149416:expired license refresh, b/4126624:heartbeats, b/4171055: inconsistent license modes Also includes b/3500025: A/V resync issues
This commit is contained in:
Jeffrey Tinker
2011-03-25 10:13:54 -07:00
committed by Android Git Automerger
13 changed files with 332 additions and 83 deletions

View File

@@ -20,11 +20,14 @@
#include "WVMExtractorImpl.h"
#include "WVMMediaSource.h"
#include "WVMFileSource.h"
#include "WVMInfoListener.h"
#include "WVMLogging.h"
#include "WVStreamControlAPI.h"
#include "media/stagefright/MediaErrors.h"
#include "media/stagefright/MediaDefs.h"
#include "drm/DrmManagerClient.h"
#include "drm/DrmConstraints.h"
#include "drm/DrmInfoEvent.h"
#include "AndroidHooks.h"
#define AES_BLOCK_SIZE 16
@@ -86,6 +89,8 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
{
dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient);
//LOGD("WVMExtractorImpl::WVMExtractorImpl: uniqueId = %d", sDrmManagerClient->mUniqueId);
_ah006(android_printbuf);
_ah002(_cb1);
_ah004(_cb2);
@@ -99,6 +104,16 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
WVCredentials credentials;
// Set an info listener to handle messages from the drm plugin
mInfoListener = new WVMInfoListener();
// Change #if 0 to #if 1 to enable heartbeats. Since the heartbeat server
// is not yet returning valid responses, this will cause the player to
// fail with an error, until the heartbeat server is working correctly.
#if 0
sDrmManagerClient->setOnInfoListener(mInfoListener);
#endif
WVStatus result = WV_Initialize(NULL);
if (result != WV_Status_OK) {
LOGE("WV_Initialize returned status %d\n", result);
@@ -107,22 +122,17 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
// Enable for debugging HTTP messages
// WV_SetLogging(WV_Logging_HTTP);
if (dataSource->getUri().size() == 0) {
// No URI supplied, pull data from the data source
mFileSource = new WVMFileSource(dataSource);
result = WV_Setup(mSession, mFileSource.get(),
"RAW/RAW/RAW;destination=getdata", credentials,
WV_OutputFormat_ES, kStreamCacheSize);
} else {
// Use the URI
result = WV_Setup(mSession, dataSource->getUri().string(),
"RAW/RAW/RAW;destination=getdata", credentials,
WV_OutputFormat_ES, kStreamCacheSize);
}
mFileSource = new WVMFileSource(dataSource);
result = WV_Setup(mSession, mFileSource.get(),
"RAW/RAW/RAW;destination=getdata", credentials,
WV_OutputFormat_ES, kStreamCacheSize);
if (result != WV_Status_OK) {
LOGE("WV_Setup returned status %d in WVMMediaSource::start\n", result);
mSetupStatus = ERROR_IO;
}
mInfoListener->setSession(mSession);
}
WV_SetWarningToErrorMS(5000);
@@ -241,6 +251,8 @@ status_t WVMExtractorImpl::readMetaData()
mHaveMetaData = true;
mInfoListener->configureHeartbeat();
return OK;
}
@@ -253,7 +265,7 @@ status_t WVMExtractorImpl::readAVCCMetaData(sp<MetaData> videoMetaData)
int limit = 50;
do {
size_t bytesRead;
bool auStart;
bool auStart, sync;
unsigned long long dts, pts;
unsigned char buf[1];
size_t bufSize = 0;
@@ -263,7 +275,7 @@ status_t WVMExtractorImpl::readAVCCMetaData(sp<MetaData> videoMetaData)
// pull some video data. But we can't use it yet, so just request 0 bytes.
//
(void)WV_GetEsData(mSession, WV_EsSelector_Video, buf, bufSize,
bytesRead, auStart, dts, pts);
bytesRead, auStart, dts, pts, sync);
result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_AVCC, config, size);
if (result != WV_Status_OK)
@@ -286,28 +298,7 @@ status_t WVMExtractorImpl::readAVCCMetaData(sp<MetaData> videoMetaData)
}
#endif
#if 0
unsigned char mp4_force[] =
{ 0x01, 0x42, 0x00, 0x1e, 0xff, 0xe1, 0x00, 0x1b, 0x67, 0x42, 0x80, 0x1e, 0x96, 0x52, 0x01, 0x40,
0x5f, 0xf3, 0x60, 0x2a, 0x10, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0x09, 0xda,
0x14, 0x2a, 0x48, 0x01, 0x00, 0x04, 0x68, 0xcb, 0x8d, 0x48 } ;
unsigned char wvm_force[] =
{ 0x01, 0x42, 0x80, 0x1e, 0xff, 0xe1, 0x00, 0x1c, 0x67, 0x42, 0x80, 0x1e, 0x96, 0x52, 0x01, 0x40,
0x5f, 0xf3, 0x60, 0x2a, 0x10, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0x09, 0xda,
0x14, 0x2a, 0x48, 0x00, 0x01, 0x00, 0x05, 0x68, 0xcb, 0x8d, 0x48, 0x00 } ;
unsigned char wvm_force_no_zero[] =
{ 0x01, 0x42, 0x80, 0x1e, 0xff, 0xe1, 0x00, 0x1b, 0x67, 0x42, 0x80, 0x1e, 0x96, 0x52, 0x01, 0x40,
0x5f, 0xf3, 0x60, 0x2a, 0x10, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0x09, 0xda,
0x14, 0x2a, 0x48, 0x01, 0x00, 0x04, 0x68, 0xcb, 0x8d, 0x48 } ;
unsigned char wvm_force_modprof[] =
{ 0x01, 0x42, 0x00, 0x1e, 0xff, 0xe1, 0x00, 0x1c, 0x67, 0x42, 0x80, 0x1e, 0x96, 0x52, 0x01, 0x40,
0x5f, 0xf3, 0x60, 0x2a, 0x10, 0x00, 0x00, 0x03, 0x00, 0x10, 0x00, 0x00, 0x03, 0x03, 0x09, 0xda,
0x14, 0x2a, 0x48, 0x00, 0x01, 0x00, 0x05, 0x68, 0xcb, 0x8d, 0x48, 0x00 } ;
videoMetaData->setData(kKeyAVCC, kTypeAVCC, wvm_force_no_zero, sizeof(wvm_force_no_zero));
#else
videoMetaData->setData(kKeyAVCC, kTypeAVCC, config, size);
#endif
return OK;
}
@@ -320,7 +311,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
int limit = 50;
do {
size_t bytesRead;
bool auStart;
bool auStart, sync;
unsigned long long dts, pts;
unsigned char buf[1];
size_t bufSize = 0;
@@ -330,7 +321,7 @@ status_t WVMExtractorImpl::readESDSMetaData(sp<MetaData> audioMetaData)
// pull some audio data. But we can't use it yet, so just request 0 bytes.
//
(void)WV_GetEsData(mSession, WV_EsSelector_Audio, buf, bufSize,
bytesRead, auStart, dts, pts);
bytesRead, auStart, dts, pts, sync);
result = WV_Info_GetCodecConfig(mSession, WV_CodecConfigType_ESDS, config, size);
if (result != WV_Status_OK)