summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-08-27 10:18:50 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-08-27 10:18:50 -0700
commitfa5f8f5a98d389c7581ac7236a9b5aa60a4f9694 (patch)
treeaf0bd42d291b48a64ba5f2603fa20e2e53440fd4
parentc604a9297ae6bb68950f21583053211287a4df10 (diff)
parent6d000617230e82b9497a88ca0f485e0c16ba4543 (diff)
downloadframeworks_av-fa5f8f5a98d389c7581ac7236a9b5aa60a4f9694.zip
frameworks_av-fa5f8f5a98d389c7581ac7236a9b5aa60a4f9694.tar.gz
frameworks_av-fa5f8f5a98d389c7581ac7236a9b5aa60a4f9694.tar.bz2
am 6d000617: am db7e3856: Merge "Fixed a potential/rare race condtion in MediaPlayerService::Client::notify() method" into jb-mr1-dev
* commit '6d000617230e82b9497a88ca0f485e0c16ba4543': Fixed a potential/rare race condtion in MediaPlayerService::Client::notify() method
-rw-r--r--media/libmediaplayerservice/MediaPlayerService.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/media/libmediaplayerservice/MediaPlayerService.cpp b/media/libmediaplayerservice/MediaPlayerService.cpp
index 58e4723..6346363 100644
--- a/media/libmediaplayerservice/MediaPlayerService.cpp
+++ b/media/libmediaplayerservice/MediaPlayerService.cpp
@@ -1042,9 +1042,14 @@ void MediaPlayerService::Client::notify(
void* cookie, int msg, int ext1, int ext2, const Parcel *obj)
{
Client* client = static_cast<Client*>(cookie);
+ if (client == NULL) {
+ return;
+ }
+ sp<IMediaPlayerClient> c;
{
Mutex::Autolock l(client->mLock);
+ c = client->mClient;
if (msg == MEDIA_PLAYBACK_COMPLETE && client->mNextClient != NULL) {
if (client->mAudioOutput != NULL)
client->mAudioOutput->switchToNextOutput();
@@ -1065,8 +1070,11 @@ void MediaPlayerService::Client::notify(
// also access mMetadataUpdated and clears it.
client->addNewMetadataUpdate(metadata_type);
}
- ALOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
- client->mClient->notify(msg, ext1, ext2, obj);
+
+ if (c != NULL) {
+ ALOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
+ c->notify(msg, ext1, ext2, obj);
+ }
}