Merge "Add observer to bufferpool clients"
diff --git a/media/bufferpool/2.0/Android.bp b/media/bufferpool/2.0/Android.bp
index 405990e..1f8bbdb 100644
--- a/media/bufferpool/2.0/Android.bp
+++ b/media/bufferpool/2.0/Android.bp
@@ -11,12 +11,14 @@
"IAccessor.hal",
"IClientManager.hal",
"IConnection.hal",
+ "IObserver.hal",
],
interfaces: [
"android.hidl.base@1.0",
],
types: [
"Buffer",
+ "BufferInvalidationMessage",
"BufferStatus",
"BufferStatusMessage",
"ResultStatus",
diff --git a/media/bufferpool/2.0/IAccessor.hal b/media/bufferpool/2.0/IAccessor.hal
index ab7c02d..66707fe 100644
--- a/media/bufferpool/2.0/IAccessor.hal
+++ b/media/bufferpool/2.0/IAccessor.hal
@@ -17,6 +17,7 @@
package android.hardware.media.bufferpool@2.0;
import IConnection;
+import IObserver;
/**
* IAccessor creates IConnection which is used from IClientManager in order to
* use functionality of the specified buffer pool.
@@ -49,6 +50,13 @@
* made and kept private. Also part of transaction ID is a sender ID in
* order to prevent fake transactions from other clients. This must be
* verified with an FMQ message from a buffer pool.
+
+ * @param observer The buffer pool event observer from the client.
+ * Observer is provided to ensure FMQ messages are processed even when
+ * client processes are idle. Buffer invalidation caused by
+ * reconfiguration does not call observer. Buffer invalidation caused
+ * by termination of pipeline call observer in order to ensure
+ * invalidation is done after pipeline completion.
*
* @return status The status of the call.
* OK - A connection is made successfully.
@@ -64,7 +72,7 @@
* @return fromFmqDesc FMQ descriptor. The descriptor is used to
* receive buffer invalidation messages from the buffer pool.
*/
- connect()
+ connect(IObserver observer)
generates (ResultStatus status, IConnection connection,
int64_t connectionId,
fmq_sync<BufferStatusMessage> toFmqDesc,
diff --git a/media/bufferpool/2.0/IObserver.hal b/media/bufferpool/2.0/IObserver.hal
new file mode 100644
index 0000000..a998836
--- /dev/null
+++ b/media/bufferpool/2.0/IObserver.hal
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.media.bufferpool@2.0;
+
+/**
+ * IObserver listens on notifications from the buffer pool. On receiving
+ * notifications, FMQ messages from the specific buffer pool which are already
+ * in the FMQ are processed.
+ */
+interface IObserver {
+
+ /**
+ * The specific buffer pool sent a message to the client. Calling this
+ * method from the buffer pool enforces a buffer pool client process the
+ * message.
+ *
+ * @param connectionId the connection Id of the specific buffer pool client
+ */
+ oneway onMessage(int64_t connectionId);
+};
diff --git a/media/bufferpool/2.0/types.hal b/media/bufferpool/2.0/types.hal
index 456e4aa..597e7b3 100644
--- a/media/bufferpool/2.0/types.hal
+++ b/media/bufferpool/2.0/types.hal
@@ -65,6 +65,8 @@
TRANSFER_OK = 7,
/** Buffer transaction failure. */
TRANSFER_ERROR = 8,
+ /** Buffer invalidation ack. */
+ INVALIDATION_ACK = 9,
};
/**
@@ -98,6 +100,7 @@
* buffers as soon as possible upon receiving the message.
*/
struct BufferInvalidationMessage {
+ uint32_t messageId;
/**
* Buffers from fromBufferId to toBufferId must be invalidated.
* fromBufferId is inclusive, but toBufferId is not inclusive.