Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit db7e3856 authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Fixed a potential/rare race condtion in...

Merge "Fixed a potential/rare race condtion in MediaPlayerService::Client::notify() method" into jb-mr1-dev
parents 1c356d38 b8a9825b
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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);
    }

    if (c != NULL) {
        ALOGV("[%d] notify (%p, %d, %d, %d)", client->mConnId, cookie, msg, ext1, ext2);
    client->mClient->notify(msg, ext1, ext2, obj);
        c->notify(msg, ext1, ext2, obj);
    }
}