diff options
author | Lajos Molnar <lajos@google.com> | 2014-12-15 22:41:38 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-15 22:41:38 +0000 |
commit | d7aa535fc6ed1f4f0ee68bd3c7c483717d30205e (patch) | |
tree | 67ff24ec2416909682edb9b160da2ae2ec1752ad | |
parent | dc039672b8fad7746200ecc36304d0e85db4f367 (diff) | |
parent | 06f9952190357426445344090b4e20b8758a118a (diff) | |
download | frameworks_av-d7aa535fc6ed1f4f0ee68bd3c7c483717d30205e.zip frameworks_av-d7aa535fc6ed1f4f0ee68bd3c7c483717d30205e.tar.gz frameworks_av-d7aa535fc6ed1f4f0ee68bd3c7c483717d30205e.tar.bz2 |
am 06f99521: am 2aa82e78: Merge "MediaCodecList: handle binder death" into lmp-mr1-dev
* commit '06f9952190357426445344090b4e20b8758a118a':
MediaCodecList: handle binder death
-rw-r--r-- | include/media/stagefright/MediaCodecList.h | 6 | ||||
-rw-r--r-- | media/libstagefright/MediaCodecList.cpp | 13 |
2 files changed, 18 insertions, 1 deletions
diff --git a/include/media/stagefright/MediaCodecList.h b/include/media/stagefright/MediaCodecList.h index 8605d99..c2bbe4d 100644 --- a/include/media/stagefright/MediaCodecList.h +++ b/include/media/stagefright/MediaCodecList.h @@ -52,6 +52,12 @@ struct MediaCodecList : public BnMediaCodecList { static sp<IMediaCodecList> getLocalInstance(); private: + class BinderDeathObserver : public IBinder::DeathRecipient { + void binderDied(const wp<IBinder> &the_late_who __unused); + }; + + static sp<BinderDeathObserver> sBinderDeathObserver; + enum Section { SECTION_TOPLEVEL, SECTION_DECODERS, diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp index 5b8be46..cf6e937 100644 --- a/media/libstagefright/MediaCodecList.cpp +++ b/media/libstagefright/MediaCodecList.cpp @@ -62,6 +62,14 @@ static Mutex sRemoteInitMutex; sp<IMediaCodecList> MediaCodecList::sRemoteList; +sp<MediaCodecList::BinderDeathObserver> MediaCodecList::sBinderDeathObserver; + +void MediaCodecList::BinderDeathObserver::binderDied(const wp<IBinder> &who __unused) { + Mutex::Autolock _l(sRemoteInitMutex); + sRemoteList.clear(); + sBinderDeathObserver.clear(); +} + // static sp<IMediaCodecList> MediaCodecList::getInstance() { Mutex::Autolock _l(sRemoteInitMutex); @@ -72,8 +80,11 @@ sp<IMediaCodecList> MediaCodecList::getInstance() { interface_cast<IMediaPlayerService>(binder); if (service.get() != NULL) { sRemoteList = service->getCodecList(); + if (sRemoteList != NULL) { + sBinderDeathObserver = new BinderDeathObserver(); + binder->linkToDeath(sBinderDeathObserver.get()); + } } - if (sRemoteList == NULL) { // if failed to get remote list, create local list sRemoteList = getLocalInstance(); |