diff options
author | Gloria Wang <gwang@google.com> | 2011-02-07 11:41:11 -0800 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2011-02-07 15:10:33 -0800 |
commit | c2dc4729e3c88d733c0aa6d9a9af6101b2f09e35 (patch) | |
tree | b4f2f134b82cd91f1875af223f6218f94a5425f5 /media/libstagefright/FileSource.cpp | |
parent | 1ee31175eca2fb5d6a95cb1aa4a9dbf66a5212cb (diff) | |
download | frameworks_base-c2dc4729e3c88d733c0aa6d9a9af6101b2f09e35.zip frameworks_base-c2dc4729e3c88d733c0aa6d9a9af6101b2f09e35.tar.gz frameworks_base-c2dc4729e3c88d733c0aa6d9a9af6101b2f09e35.tar.bz2 |
- Do not use global DrmManagerClient
- Release the DrmManagerClient and DecryptHandle in DataSource
Fix for bug 3429811
Change-Id: I549f72b75225751877eb0e630ce8098f8ec6316f
Diffstat (limited to 'media/libstagefright/FileSource.cpp')
-rw-r--r-- | media/libstagefright/FileSource.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/media/libstagefright/FileSource.cpp b/media/libstagefright/FileSource.cpp index 98d5b50..b8e75fd 100644 --- a/media/libstagefright/FileSource.cpp +++ b/media/libstagefright/FileSource.cpp @@ -60,6 +60,17 @@ FileSource::~FileSource() { delete[] mDrmBuf; mDrmBuf = NULL; } + + if (mDecryptHandle != NULL) { + // To release mDecryptHandle + mDrmManagerClient->closeDecryptSession(mDecryptHandle); + mDecryptHandle = NULL; + } + + if (mDrmManagerClient != NULL) { + delete mDrmManagerClient; + mDrmManagerClient = NULL; + } } status_t FileSource::initCheck() const { @@ -113,11 +124,14 @@ status_t FileSource::getSize(off64_t *size) { return OK; } -DecryptHandle* FileSource::DrmInitialization(DrmManagerClient* client) { - if (client == NULL) { +DecryptHandle* FileSource::DrmInitialization() { + if (mDrmManagerClient == NULL) { + mDrmManagerClient = new DrmManagerClient(); + } + + if (mDrmManagerClient == NULL) { return NULL; } - mDrmManagerClient = client; if (mDecryptHandle == NULL) { mDecryptHandle = mDrmManagerClient->openDecryptSession( @@ -125,6 +139,7 @@ DecryptHandle* FileSource::DrmInitialization(DrmManagerClient* client) { } if (mDecryptHandle == NULL) { + delete mDrmManagerClient; mDrmManagerClient = NULL; } |