Revert the following patches because they may lead to power regression because SHA/MD5 module is stuck

1. Revert "Fix drm flag setting missed in false drm recognition fix."
   This reverts commit 9f704f6c46.

2. Revert "Fixed the false drm recognition."
   This reverts commit aadbd80b30.

3. Revert "Fix drm enumeration order, resolves failure to play forward lock ringtones"
   This reverts commit a5cbf023e3.

4. Revert "Fix ANRs due to Widevine DRM plugin sniff taking too long."
   This reverts commit d0d19db1ca.

As a result of the reverting, many ANRs from WV sniffing are back.

related-to-bug: 5739618
This commit is contained in:
James Dong
2011-12-14 10:57:05 -08:00
parent 2e335cb028
commit d70c64db9f
7 changed files with 27 additions and 84 deletions

View File

@ -99,12 +99,11 @@ void DrmManager::removeUniqueId(int uniqueId) {
status_t DrmManager::loadPlugIns() { status_t DrmManager::loadPlugIns() {
String8 pluginDirPath("/system/lib/drm");
loadPlugIns(pluginDirPath);
String8 vendorPluginDirPath("/vendor/lib/drm"); String8 vendorPluginDirPath("/vendor/lib/drm");
loadPlugIns(vendorPluginDirPath); loadPlugIns(vendorPluginDirPath);
String8 pluginDirPath("/system/lib/drm");
loadPlugIns(pluginDirPath);
return DRM_NO_ERROR; return DRM_NO_ERROR;
} }

View File

@ -335,13 +335,11 @@ status_t AwesomePlayer::setDataSource_l(
return UNKNOWN_ERROR; return UNKNOWN_ERROR;
} }
if (extractor->getDrmFlag()) { dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient); if (mDecryptHandle != NULL) {
if (mDecryptHandle != NULL) { CHECK(mDrmManagerClient);
CHECK(mDrmManagerClient); if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) { notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
}
} }
} }
@ -2093,7 +2091,7 @@ status_t AwesomePlayer::finishSetDataSource_l() {
String8 mimeType; String8 mimeType;
float confidence; float confidence;
sp<AMessage> dummy; sp<AMessage> dummy;
bool success = SniffWVM(dataSource, &mimeType, &confidence, &dummy); bool success = SniffDRM(dataSource, &mimeType, &confidence, &dummy);
if (!success if (!success
|| strcasecmp( || strcasecmp(
@ -2101,11 +2099,8 @@ status_t AwesomePlayer::finishSetDataSource_l() {
return ERROR_UNSUPPORTED; return ERROR_UNSUPPORTED;
} }
dataSource->DrmInitialization();
mWVMExtractor = new WVMExtractor(dataSource); mWVMExtractor = new WVMExtractor(dataSource);
mWVMExtractor->setAdaptiveStreamingMode(true); mWVMExtractor->setAdaptiveStreamingMode(true);
mWVMExtractor->setDrmFlag(true);
extractor = mWVMExtractor; extractor = mWVMExtractor;
} else { } else {
extractor = MediaExtractor::Create( extractor = MediaExtractor::Create(
@ -2116,14 +2111,12 @@ status_t AwesomePlayer::finishSetDataSource_l() {
} }
} }
if (extractor->getDrmFlag()) { dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
if (mDecryptHandle != NULL) { if (mDecryptHandle != NULL) {
CHECK(mDrmManagerClient); CHECK(mDrmManagerClient);
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) { if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE); notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
}
} }
} }

View File

@ -282,13 +282,13 @@ bool SniffDRM(
if (decryptHandle != NULL) { if (decryptHandle != NULL) {
if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) { if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) {
*mimeType = String8("drm+container_based+") + decryptHandle->mimeType; *mimeType = String8("drm+container_based+") + decryptHandle->mimeType;
*confidence = 10.0f;
} else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) { } else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) {
*mimeType = String8("drm+es_based+") + decryptHandle->mimeType; *mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
*confidence = 10.0f; } else if (decryptHandle->decryptApiType == DecryptApiType::WV_BASED) {
} else { *mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
return false; LOGW("SniffWVM: found match\n");
} }
*confidence = 10.0f;
return true; return true;
} }

View File

@ -26,7 +26,6 @@
#include "include/DRMExtractor.h" #include "include/DRMExtractor.h"
#include "include/FLACExtractor.h" #include "include/FLACExtractor.h"
#include "include/AACExtractor.h" #include "include/AACExtractor.h"
#include "include/WVMExtractor.h"
#include "matroska/MatroskaExtractor.h" #include "matroska/MatroskaExtractor.h"
@ -114,7 +113,6 @@ void DataSource::RegisterDefaultSniffers() {
RegisterSniffer(SniffMP3); RegisterSniffer(SniffMP3);
RegisterSniffer(SniffAAC); RegisterSniffer(SniffAAC);
RegisterSniffer(SniffMPEG2PS); RegisterSniffer(SniffMPEG2PS);
RegisterSniffer(SniffWVM);
char value[PROPERTY_VALUE_MAX]; char value[PROPERTY_VALUE_MAX];
if (property_get("drm.service.enabled", value, NULL) if (property_get("drm.service.enabled", value, NULL)

View File

@ -111,9 +111,6 @@ sp<MediaExtractor> MediaExtractor::Create(
ret = new MPEG2TSExtractor(source); ret = new MPEG2TSExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) { } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) {
ret = new WVMExtractor(source); ret = new WVMExtractor(source);
if (ret != NULL) {
isDrm = true;
}
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) { } else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) {
ret = new AACExtractor(source); ret = new AACExtractor(source);
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) { } else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) {

View File

@ -45,12 +45,17 @@ namespace android {
static Mutex gWVMutex; static Mutex gWVMutex;
WVMExtractor::WVMExtractor(const sp<DataSource> &source) WVMExtractor::WVMExtractor(const sp<DataSource> &source)
: mDataSource(source) : mDataSource(source) {
{ {
Mutex::Autolock autoLock(gWVMutex); Mutex::Autolock autoLock(gWVMutex);
if (gVendorLibHandle == NULL) {
gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
}
if (!getVendorLibHandle()) { if (gVendorLibHandle == NULL) {
return; LOGE("Failed to open libwvm.so");
return;
}
} }
typedef WVMLoadableExtractor *(*GetInstanceFunc)(sp<DataSource>); typedef WVMLoadableExtractor *(*GetInstanceFunc)(sp<DataSource>);
@ -66,19 +71,6 @@ WVMExtractor::WVMExtractor(const sp<DataSource> &source)
} }
} }
bool WVMExtractor::getVendorLibHandle()
{
if (gVendorLibHandle == NULL) {
gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
}
if (gVendorLibHandle == NULL) {
LOGE("Failed to open libwvm.so");
}
return gVendorLibHandle != NULL;
}
WVMExtractor::~WVMExtractor() { WVMExtractor::~WVMExtractor() {
} }
@ -121,33 +113,5 @@ void WVMExtractor::setAdaptiveStreamingMode(bool adaptive) {
} }
} }
bool SniffWVM(
const sp<DataSource> &source, String8 *mimeType, float *confidence,
sp<AMessage> *) {
Mutex::Autolock autoLock(gWVMutex);
if (!WVMExtractor::getVendorLibHandle()) {
return false;
}
typedef WVMLoadableExtractor *(*SnifferFunc)(sp<DataSource>);
SnifferFunc snifferFunc =
(SnifferFunc) dlsym(gVendorLibHandle,
"_ZN7android15IsWidevineMediaENS_2spINS_10DataSourceEEE");
if (snifferFunc) {
if ((*snifferFunc)(source)) {
*mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
*confidence = 10.0f;
return true;
}
} else {
LOGE("IsWidevineMedia not found in libwvm.so");
}
return false;
}
} //namespace android } //namespace android

View File

@ -23,8 +23,6 @@
namespace android { namespace android {
struct AMessage;
class String8;
class DataSource; class DataSource;
class WVMLoadableExtractor : public MediaExtractor { class WVMLoadableExtractor : public MediaExtractor {
@ -60,8 +58,6 @@ public:
// is used. // is used.
void setAdaptiveStreamingMode(bool adaptive); void setAdaptiveStreamingMode(bool adaptive);
static bool getVendorLibHandle();
protected: protected:
virtual ~WVMExtractor(); virtual ~WVMExtractor();
@ -73,10 +69,6 @@ private:
WVMExtractor &operator=(const WVMExtractor &); WVMExtractor &operator=(const WVMExtractor &);
}; };
bool SniffWVM(
const sp<DataSource> &source, String8 *mimeType, float *confidence,
sp<AMessage> *);
} // namespace android } // namespace android
#endif // DRM_EXTRACTOR_H_ #endif // DRM_EXTRACTOR_H_