Fix for bug 3477330

This patch fixs a crash bug caused by using a NULL DecryptHandle pointer in the DRM Framework.
Fix by using sp<DecryptHandle> instead.

Change-Id: I1355d4719857ab64ad6cd12803fcf19e45bb50a0
This commit is contained in:
Gloria Wang
2011-02-25 09:47:52 -08:00
parent cf1d556195
commit 14761c80a9
3 changed files with 16 additions and 3 deletions

View File

@@ -32,7 +32,7 @@
using namespace android;
static DecryptHandle *sDecryptHandle;
static sp<DecryptHandle> sDecryptHandle;
static DrmManagerClient *sDrmManagerClient;
@@ -86,7 +86,7 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
mSession(NULL),
mSetupStatus(OK)
{
dataSource->getDrmInfo(&sDecryptHandle, &sDrmManagerClient);
dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient);
// Set up callouts
AndroidSetLogCallout(android_printbuf);
@@ -134,6 +134,14 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
WVMExtractorImpl::~WVMExtractorImpl() {
}
// Release decrypt handle when media sources are destroyed
void WVMExtractorImpl::cleanup()
{
if (sDecryptHandle.get()) {
sDecryptHandle.clear();
}
}
//
// Configure metadata for video and audio sources
//

View File

@@ -19,6 +19,7 @@
#include "WVMMediaSource.h"
#include "WVMFileSource.h"
#include "WVMExtractorImpl.h"
#include "media/stagefright/MediaErrors.h"
#include "media/stagefright/MediaDefs.h"
#include "media/stagefright/MediaDebug.h"
@@ -274,8 +275,10 @@ WVMMediaSource::~WVMMediaSource()
}
if (mESSelector == WV_EsSelector_Video) {
if (mSession != NULL)
if (mSession != NULL) {
WV_Teardown(mSession);
}
WVMExtractorImpl::cleanup();
}
}

View File

@@ -45,6 +45,8 @@ public:
virtual sp<MetaData> getMetaData();
static void cleanup();
protected:
virtual ~WVMExtractorImpl();