Skip to content

Commit 4a30052

Browse files
James DongThe Android Automerger
authored andcommitted
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 9f704f6. 2. Revert "Fixed the false drm recognition." This reverts commit aadbd80. 3. Revert "Fix drm enumeration order, resolves failure to play forward lock ringtones" This reverts commit a5cbf02. 4. Revert "Fix ANRs due to Widevine DRM plugin sniff taking too long." This reverts commit d0d19db. As a result of the reverting, many ANRs from WV sniffing are back. related-to-bug: 5739618
1 parent c58e649 commit 4a30052

File tree

7 files changed

+27
-84
lines changed

7 files changed

+27
-84
lines changed

drm/drmserver/DrmManager.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,11 @@ void DrmManager::removeUniqueId(int uniqueId) {
9999

100100
status_t DrmManager::loadPlugIns() {
101101

102-
String8 pluginDirPath("/system/lib/drm");
103-
loadPlugIns(pluginDirPath);
104-
105102
String8 vendorPluginDirPath("/vendor/lib/drm");
106103
loadPlugIns(vendorPluginDirPath);
107104

105+
String8 pluginDirPath("/system/lib/drm");
106+
loadPlugIns(pluginDirPath);
108107
return DRM_NO_ERROR;
109108

110109
}

media/libstagefright/AwesomePlayer.cpp

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -335,13 +335,11 @@ status_t AwesomePlayer::setDataSource_l(
335335
return UNKNOWN_ERROR;
336336
}
337337

338-
if (extractor->getDrmFlag()) {
339-
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
340-
if (mDecryptHandle != NULL) {
341-
CHECK(mDrmManagerClient);
342-
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
343-
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
344-
}
338+
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
339+
if (mDecryptHandle != NULL) {
340+
CHECK(mDrmManagerClient);
341+
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
342+
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
345343
}
346344
}
347345

@@ -2093,19 +2091,16 @@ status_t AwesomePlayer::finishSetDataSource_l() {
20932091
String8 mimeType;
20942092
float confidence;
20952093
sp<AMessage> dummy;
2096-
bool success = SniffWVM(dataSource, &mimeType, &confidence, &dummy);
2094+
bool success = SniffDRM(dataSource, &mimeType, &confidence, &dummy);
20972095

20982096
if (!success
20992097
|| strcasecmp(
21002098
mimeType.string(), MEDIA_MIMETYPE_CONTAINER_WVM)) {
21012099
return ERROR_UNSUPPORTED;
21022100
}
21032101

2104-
dataSource->DrmInitialization();
2105-
21062102
mWVMExtractor = new WVMExtractor(dataSource);
21072103
mWVMExtractor->setAdaptiveStreamingMode(true);
2108-
mWVMExtractor->setDrmFlag(true);
21092104
extractor = mWVMExtractor;
21102105
} else {
21112106
extractor = MediaExtractor::Create(
@@ -2116,14 +2111,12 @@ status_t AwesomePlayer::finishSetDataSource_l() {
21162111
}
21172112
}
21182113

2119-
if (extractor->getDrmFlag()) {
2120-
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
2114+
dataSource->getDrmInfo(mDecryptHandle, &mDrmManagerClient);
21212115

2122-
if (mDecryptHandle != NULL) {
2123-
CHECK(mDrmManagerClient);
2124-
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
2125-
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
2126-
}
2116+
if (mDecryptHandle != NULL) {
2117+
CHECK(mDrmManagerClient);
2118+
if (RightsStatus::RIGHTS_VALID != mDecryptHandle->status) {
2119+
notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_DRM_NO_LICENSE);
21272120
}
21282121
}
21292122

media/libstagefright/DRMExtractor.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,13 +282,13 @@ bool SniffDRM(
282282
if (decryptHandle != NULL) {
283283
if (decryptHandle->decryptApiType == DecryptApiType::CONTAINER_BASED) {
284284
*mimeType = String8("drm+container_based+") + decryptHandle->mimeType;
285-
*confidence = 10.0f;
286285
} else if (decryptHandle->decryptApiType == DecryptApiType::ELEMENTARY_STREAM_BASED) {
287286
*mimeType = String8("drm+es_based+") + decryptHandle->mimeType;
288-
*confidence = 10.0f;
289-
} else {
290-
return false;
287+
} else if (decryptHandle->decryptApiType == DecryptApiType::WV_BASED) {
288+
*mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
289+
LOGW("SniffWVM: found match\n");
291290
}
291+
*confidence = 10.0f;
292292

293293
return true;
294294
}

media/libstagefright/DataSource.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "include/DRMExtractor.h"
2727
#include "include/FLACExtractor.h"
2828
#include "include/AACExtractor.h"
29-
#include "include/WVMExtractor.h"
3029

3130
#include "matroska/MatroskaExtractor.h"
3231

@@ -114,7 +113,6 @@ void DataSource::RegisterDefaultSniffers() {
114113
RegisterSniffer(SniffMP3);
115114
RegisterSniffer(SniffAAC);
116115
RegisterSniffer(SniffMPEG2PS);
117-
RegisterSniffer(SniffWVM);
118116

119117
char value[PROPERTY_VALUE_MAX];
120118
if (property_get("drm.service.enabled", value, NULL)

media/libstagefright/MediaExtractor.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ sp<MediaExtractor> MediaExtractor::Create(
111111
ret = new MPEG2TSExtractor(source);
112112
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_WVM)) {
113113
ret = new WVMExtractor(source);
114-
if (ret != NULL) {
115-
isDrm = true;
116-
}
117114
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_AAC_ADTS)) {
118115
ret = new AACExtractor(source);
119116
} else if (!strcasecmp(mime, MEDIA_MIMETYPE_CONTAINER_MPEG2PS)) {

media/libstagefright/WVMExtractor.cpp

Lines changed: 10 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,17 @@ namespace android {
4545
static Mutex gWVMutex;
4646

4747
WVMExtractor::WVMExtractor(const sp<DataSource> &source)
48-
: mDataSource(source)
49-
{
50-
Mutex::Autolock autoLock(gWVMutex);
48+
: mDataSource(source) {
49+
{
50+
Mutex::Autolock autoLock(gWVMutex);
51+
if (gVendorLibHandle == NULL) {
52+
gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
53+
}
5154

52-
if (!getVendorLibHandle()) {
53-
return;
55+
if (gVendorLibHandle == NULL) {
56+
LOGE("Failed to open libwvm.so");
57+
return;
58+
}
5459
}
5560

5661
typedef WVMLoadableExtractor *(*GetInstanceFunc)(sp<DataSource>);
@@ -66,19 +71,6 @@ WVMExtractor::WVMExtractor(const sp<DataSource> &source)
6671
}
6772
}
6873

69-
bool WVMExtractor::getVendorLibHandle()
70-
{
71-
if (gVendorLibHandle == NULL) {
72-
gVendorLibHandle = dlopen("libwvm.so", RTLD_NOW);
73-
}
74-
75-
if (gVendorLibHandle == NULL) {
76-
LOGE("Failed to open libwvm.so");
77-
}
78-
79-
return gVendorLibHandle != NULL;
80-
}
81-
8274
WVMExtractor::~WVMExtractor() {
8375
}
8476

@@ -121,33 +113,5 @@ void WVMExtractor::setAdaptiveStreamingMode(bool adaptive) {
121113
}
122114
}
123115

124-
bool SniffWVM(
125-
const sp<DataSource> &source, String8 *mimeType, float *confidence,
126-
sp<AMessage> *) {
127-
128-
Mutex::Autolock autoLock(gWVMutex);
129-
130-
if (!WVMExtractor::getVendorLibHandle()) {
131-
return false;
132-
}
133-
134-
typedef WVMLoadableExtractor *(*SnifferFunc)(sp<DataSource>);
135-
SnifferFunc snifferFunc =
136-
(SnifferFunc) dlsym(gVendorLibHandle,
137-
"_ZN7android15IsWidevineMediaENS_2spINS_10DataSourceEEE");
138-
139-
if (snifferFunc) {
140-
if ((*snifferFunc)(source)) {
141-
*mimeType = MEDIA_MIMETYPE_CONTAINER_WVM;
142-
*confidence = 10.0f;
143-
return true;
144-
}
145-
} else {
146-
LOGE("IsWidevineMedia not found in libwvm.so");
147-
}
148-
149-
return false;
150-
}
151-
152116
} //namespace android
153117

media/libstagefright/include/WVMExtractor.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@
2323

2424
namespace android {
2525

26-
struct AMessage;
27-
class String8;
2826
class DataSource;
2927

3028
class WVMLoadableExtractor : public MediaExtractor {
@@ -60,8 +58,6 @@ class WVMExtractor : public MediaExtractor {
6058
// is used.
6159
void setAdaptiveStreamingMode(bool adaptive);
6260

63-
static bool getVendorLibHandle();
64-
6561
protected:
6662
virtual ~WVMExtractor();
6763

@@ -73,10 +69,6 @@ class WVMExtractor : public MediaExtractor {
7369
WVMExtractor &operator=(const WVMExtractor &);
7470
};
7571

76-
bool SniffWVM(
77-
const sp<DataSource> &source, String8 *mimeType, float *confidence,
78-
sp<AMessage> *);
79-
8072
} // namespace android
8173

8274
#endif // DRM_EXTRACTOR_H_

0 commit comments

Comments
 (0)