summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/omx/OMXNodeInstance.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2015-06-04 10:30:02 -0700
committerLajos Molnar <lajos@google.com>2015-06-05 17:57:19 -0700
commit26a48f304a8754d655e554178ffb6d7ba4c5aac3 (patch)
tree29d2f266cec93fa3aa146d9de238132be0658297 /media/libstagefright/omx/OMXNodeInstance.cpp
parentbf913163c69abf9e67bb393f032d0c3e1a642957 (diff)
downloadframeworks_av-26a48f304a8754d655e554178ffb6d7ba4c5aac3.zip
frameworks_av-26a48f304a8754d655e554178ffb6d7ba4c5aac3.tar.gz
frameworks_av-26a48f304a8754d655e554178ffb6d7ba4c5aac3.tar.bz2
stagefright: add support for batching OMX events
Bug: 20503131 Change-Id: I762c419ed1245f8b83fb1f6bf61e5557213ca07b
Diffstat (limited to 'media/libstagefright/omx/OMXNodeInstance.cpp')
-rw-r--r--media/libstagefright/omx/OMXNodeInstance.cpp23
1 files changed, 16 insertions, 7 deletions
diff --git a/media/libstagefright/omx/OMXNodeInstance.cpp b/media/libstagefright/omx/OMXNodeInstance.cpp
index 9e399f9..7e92da8 100644
--- a/media/libstagefright/omx/OMXNodeInstance.cpp
+++ b/media/libstagefright/omx/OMXNodeInstance.cpp
@@ -1357,7 +1357,7 @@ status_t OMXNodeInstance::setInternalOption(
}
}
-void OMXNodeInstance::onMessage(const omx_message &msg) {
+bool OMXNodeInstance::handleMessage(omx_message &msg) {
const sp<GraphicBufferSource>& bufferSource(getGraphicBufferSource());
if (msg.type == omx_message::FILL_BUFFER_DONE) {
@@ -1384,10 +1384,7 @@ void OMXNodeInstance::onMessage(const omx_message &msg) {
// fix up the buffer info (especially timestamp) if needed
bufferSource->codecBufferFilled(buffer);
- omx_message newMsg = msg;
- newMsg.u.extended_buffer_data.timestamp = buffer->nTimeStamp;
- mObserver->onMessage(newMsg);
- return;
+ msg.u.extended_buffer_data.timestamp = buffer->nTimeStamp;
}
} else if (msg.type == omx_message::EMPTY_BUFFER_DONE) {
OMX_BUFFERHEADERTYPE *buffer =
@@ -1408,11 +1405,23 @@ void OMXNodeInstance::onMessage(const omx_message &msg) {
// know that anyone asked to have the buffer emptied and will
// be very confused.
bufferSource->codecBufferEmptied(buffer, msg.fenceFd);
- return;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void OMXNodeInstance::onMessages(std::list<omx_message> &messages) {
+ for (std::list<omx_message>::iterator it = messages.begin(); it != messages.end(); ) {
+ if (handleMessage(*it)) {
+ messages.erase(it++);
+ } else {
+ ++it;
}
}
- mObserver->onMessage(msg);
+ mObserver->onMessages(messages);
}
void OMXNodeInstance::onObserverDied(OMXMaster *master) {