Protect Session ID List With a Lock

(This is a merge of
https://widevine-internal-review.googlesource.com/#/c/11405
from the Widevine CDM Repo.)

AUPT is revealing a crash when destructing WVDrmPlugin due to
multi-threaded contention over the session map. As a fix, we are now
protecting access to the map via a mutex.

Bug: 17761616
Change-Id: Iddeca657effd3c7f3ff35ce334d7979291667cef
This commit is contained in:
John "Juce" Bruce
2014-10-13 13:40:44 -07:00
parent 95658e73b2
commit 3da4f9d7d5
2 changed files with 29 additions and 5 deletions

View File

@@ -16,6 +16,7 @@
#include "utils/Errors.h"
#include "utils/KeyedVector.h"
#include "utils/List.h"
#include "utils/Mutex.h"
#include "utils/String8.h"
#include "utils/Vector.h"
#include "wv_cdm_event_listener.h"
@@ -26,6 +27,7 @@ namespace wvdrm {
using android::KeyedVector;
using android::List;
using android::Mutex;
using android::status_t;
using android::String8;
using android::Vector;
@@ -229,6 +231,7 @@ class WVDrmPlugin : public android::DrmPlugin,
WvContentDecryptionModule* mCDM;
WVGenericCryptoInterface* mCrypto;
Mutex mCryptoSessionsMutex;
map<CdmSessionId, CryptoSession> mCryptoSessions;
status_t mapAndNotifyOfCdmResponseType(const Vector<uint8_t>& sessionId,