diff options
author | Lajos Molnar <lajos@google.com> | 2015-06-10 14:18:12 -0700 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-06-10 14:42:02 -0700 |
commit | 984a54322f7c70bc75e862d91bdd975814872aff (patch) | |
tree | edcbac98c9b3f0197b588f109fd7b331567afd77 /media/libstagefright | |
parent | 4599da7f4ca67a323aa64d84c1b79e3ce6ab9f41 (diff) | |
download | frameworks_av-984a54322f7c70bc75e862d91bdd975814872aff.zip frameworks_av-984a54322f7c70bc75e862d91bdd975814872aff.tar.gz frameworks_av-984a54322f7c70bc75e862d91bdd975814872aff.tar.bz2 |
stagefright: fix issues with OMX message passing
- added destructor for MessageList so messages are freed
- check if notify has been initialized
- do not call onMessages if there are no messages
Bug: 21659665
Change-Id: Idb4eaa63dc2f8be8b282be79e6234f83a7669481
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 10 | ||||
-rw-r--r-- | media/libstagefright/omx/OMXNodeInstance.cpp | 4 |
2 files changed, 11 insertions, 3 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index a57d4cf..cf37eba 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -110,6 +110,8 @@ static void InitOMXParams(T *params) { struct MessageList : public RefBase { MessageList() { } + virtual ~MessageList() { + } std::list<sp<AMessage> > &getList() { return mList; } private: std::list<sp<AMessage> > mList; @@ -126,15 +128,19 @@ struct CodecObserver : public BnOMXObserver { // from IOMXObserver virtual void onMessages(const std::list<omx_message> &messages) { - sp<AMessage> notify; + if (messages.empty()) { + return; + } + + sp<AMessage> notify = mNotify->dup(); bool first = true; sp<MessageList> msgList = new MessageList(); for (std::list<omx_message>::const_iterator it = messages.cbegin(); it != messages.cend(); ++it) { const omx_message &omx_msg = *it; if (first) { - notify = mNotify->dup(); notify->setInt32("node", omx_msg.node); + first = false; } sp<AMessage> msg = new AMessage; diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp index 692667f..6ee1a77 100644 --- a/media/libstagefright/omx/OMXNodeInstance.cpp +++ b/media/libstagefright/omx/OMXNodeInstance.cpp @@ -1423,7 +1423,9 @@ void OMXNodeInstance::onMessages(std::list<omx_message> &messages) { } } - mObserver->onMessages(messages); + if (!messages.empty()) { + mObserver->onMessages(messages); + } } void OMXNodeInstance::onObserverDied(OMXMaster *master) { |