summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2011-08-25 16:09:06 -0700
committerAndreas Huber <andih@google.com>2011-08-25 16:28:18 -0700
commit5df775d2f509c76e76a46615fca83dba95299f6e (patch)
tree1062b747ad85433dec6dca2093fafb8d2a6d89a7 /include
parent24245683b9285b0b53c8900f088cf146000501c4 (diff)
downloadframeworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.zip
frameworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.tar.gz
frameworks_av-5df775d2f509c76e76a46615fca83dba95299f6e.tar.bz2
Support for posting messages and synchronously waiting for a response.
Change-Id: Id6c7a08c34fd5cb6c4632f78ece9e7898b29e52c
Diffstat (limited to 'include')
-rw-r--r--include/media/stagefright/foundation/ALooperRoster.h13
-rw-r--r--include/media/stagefright/foundation/AMessage.h11
2 files changed, 23 insertions, 1 deletions
diff --git a/include/media/stagefright/foundation/ALooperRoster.h b/include/media/stagefright/foundation/ALooperRoster.h
index c1bd4ed..2e5fd73 100644
--- a/include/media/stagefright/foundation/ALooperRoster.h
+++ b/include/media/stagefright/foundation/ALooperRoster.h
@@ -31,9 +31,14 @@ struct ALooperRoster {
void unregisterHandler(ALooper::handler_id handlerID);
- void postMessage(const sp<AMessage> &msg, int64_t delayUs = 0);
+ status_t postMessage(const sp<AMessage> &msg, int64_t delayUs = 0);
void deliverMessage(const sp<AMessage> &msg);
+ status_t postAndAwaitResponse(
+ const sp<AMessage> &msg, sp<AMessage> *response);
+
+ void postReply(uint32_t replyID, const sp<AMessage> &reply);
+
sp<ALooper> findLooper(ALooper::handler_id handlerID);
private:
@@ -45,6 +50,12 @@ private:
Mutex mLock;
KeyedVector<ALooper::handler_id, HandlerInfo> mHandlers;
ALooper::handler_id mNextHandlerID;
+ uint32_t mNextReplyID;
+ Condition mRepliesCondition;
+
+ KeyedVector<uint32_t, sp<AMessage> > mReplies;
+
+ status_t postMessage_l(const sp<AMessage> &msg, int64_t delayUs);
DISALLOW_EVIL_CONSTRUCTORS(ALooperRoster);
};
diff --git a/include/media/stagefright/foundation/AMessage.h b/include/media/stagefright/foundation/AMessage.h
index 72dc730..7ec54aa 100644
--- a/include/media/stagefright/foundation/AMessage.h
+++ b/include/media/stagefright/foundation/AMessage.h
@@ -72,6 +72,17 @@ struct AMessage : public RefBase {
void post(int64_t delayUs = 0);
+ // Posts the message to its target and waits for a response (or error)
+ // before returning.
+ status_t postAndAwaitResponse(sp<AMessage> *response);
+
+ // If this returns true, the sender of this message is synchronously
+ // awaiting a response, the "replyID" can be used to send the response
+ // via "postReply" below.
+ bool senderAwaitsResponse(uint32_t *replyID) const;
+
+ void postReply(uint32_t replyID);
+
// Performs a deep-copy of "this", contained messages are in turn "dup'ed".
// Warning: RefBase items, i.e. "objects" are _not_ copied but only have
// their refcount incremented.