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

Commit df2592be authored by Chong Zhang's avatar Chong Zhang
Browse files

do not hold mNotifyLock when calling MediaPlayer::notify

Bug:18120688
Change-Id: Ia66dcfc3fd2d67d1ceba9808d21e0120cc8691d6
parent 31551f8d
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -208,8 +208,15 @@ public:

    void        sendEvent(int msg, int ext1=0, int ext2=0,
                          const Parcel *obj=NULL) {
        notify_callback_f notifyCB;
        void* cookie;
        {
            Mutex::Autolock autoLock(mNotifyLock);
        if (mNotify) mNotify(mCookie, msg, ext1, ext2, obj);
            notifyCB = mNotify;
            cookie = mCookie;
        }

        if (notifyCB) notifyCB(cookie, msg, ext1, ext2, obj);
    }

    virtual status_t dump(int fd, const Vector<String16> &args) const {
+3 −1
Original line number Diff line number Diff line
@@ -2159,7 +2159,6 @@ void MediaPlayerService::AudioCache::notify(
    {
    case MEDIA_ERROR:
        ALOGE("Error %d, %d occurred", ext1, ext2);
        p->mError = ext1;
        break;
    case MEDIA_PREPARED:
        ALOGV("prepared");
@@ -2174,6 +2173,9 @@ void MediaPlayerService::AudioCache::notify(

    // wake up thread
    Mutex::Autolock lock(p->mLock);
    if (msg == MEDIA_ERROR) {
        p->mError = ext1;
    }
    p->mCommandComplete = true;
    p->mSignal.signal();
}