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

Commit 77da9683 authored by Robert Shih's avatar Robert Shih Committed by android-build-merger
Browse files

MediaPlayerService: avoid invalid static cast am: ee0a0e39 am: 7b6a8554...

MediaPlayerService: avoid invalid static cast am: ee0a0e39 am: 7b6a8554 am: b07255f6 am: d5608308 am: 51efd244 am: 8d32201d am: 2b5ee9c8
am: 17744ab9

Change-Id: I7c9bff5b79002b4c1e83437b69c8cfd5a09854a3
parents 167bfc2b 17744ab9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -558,6 +558,12 @@ void MediaPlayerService::removeClient(wp<Client> client)
    mClients.remove(client);
}

bool MediaPlayerService::hasClient(wp<Client> client)
{
    Mutex::Autolock lock(mLock);
    return mClients.indexOf(client) != NAME_NOT_FOUND;
}

MediaPlayerService::Client::Client(
        const sp<MediaPlayerService>& service, pid_t pid,
        int32_t connId, const sp<IMediaPlayerClient>& client,
@@ -1086,6 +1092,10 @@ status_t MediaPlayerService::Client::setNextPlayer(const sp<IMediaPlayer>& playe
    ALOGV("setNextPlayer");
    Mutex::Autolock l(mLock);
    sp<Client> c = static_cast<Client*>(player.get());
    if (!mService->hasClient(c)) {
      return BAD_VALUE;
    }

    mNextClient = c;

    if (c != NULL) {
+1 −0
Original line number Diff line number Diff line
@@ -226,6 +226,7 @@ public:
    virtual status_t            dump(int fd, const Vector<String16>& args);

            void                removeClient(wp<Client> client);
            bool                hasClient(wp<Client> client);

    enum {
        MEDIASERVER_PROCESS_DEATH = 0,