Audio V4: Forward tracks attributes to the hal
Forward to the HAL the audio usage, audio content types and volume
of playback tracks to the stream out they are playing to.
Forward to the HAL the audio source and volume of record tracks
to the stream in they are playing to.
This will allow the HAL to better tune its effects and remove the need
to inject a fake effect (volume listener) to get the tracks volume.
Bug: 38184704
Test: none
Change-Id: Iede0f7aa518608c3b3ce1497f059f672aac109b2
Signed-off-by: Kevin Rocard <krocard@google.com>
diff --git a/audio/4.0/IDevice.hal b/audio/4.0/IDevice.hal
index 4bc2d4d..591e565 100644
--- a/audio/4.0/IDevice.hal
+++ b/audio/4.0/IDevice.hal
@@ -109,6 +109,8 @@
* @param device device type and (if needed) address.
* @param config stream configuration.
* @param flags additional flags.
+ * @param sourceMetadata Description of the audio that will be played.
+ May be used by implementations to configure hardware effects.
* @return retval operation completion status.
* @return outStream created output stream.
* @return suggestedConfig in case of invalid parameters, suggested config.
@@ -117,7 +119,8 @@
AudioIoHandle ioHandle,
DeviceAddress device,
AudioConfig config,
- bitfield<AudioOutputFlag> flags) generates (
+ bitfield<AudioOutputFlag> flags,
+ SourceMetadata sourceMetadata) generates (
Result retval,
IStreamOut outStream,
AudioConfig suggestedConfig);
@@ -132,6 +135,8 @@
* @param config stream configuration.
* @param flags additional flags.
* @param source source specification.
+ * @param sinkMetadata Description of the audio that is suggested by the client.
+ * May be used by implementations to configure hardware effects.
* @return retval operation completion status.
* @return inStream in case of success, created input stream.
* @return suggestedConfig in case of invalid parameters, suggested config.
@@ -141,7 +146,7 @@
DeviceAddress device,
AudioConfig config,
bitfield<AudioInputFlag> flags,
- AudioSource source) generates (
+ SinkMetadata sinkMetadata) generates (
Result retval,
IStreamIn inStream,
AudioConfig suggestedConfig);
diff --git a/audio/4.0/IStreamIn.hal b/audio/4.0/IStreamIn.hal
index ea2826e..3b1fd40 100644
--- a/audio/4.0/IStreamIn.hal
+++ b/audio/4.0/IStreamIn.hal
@@ -84,6 +84,12 @@
};
/**
+ * Called when the metadata of the stream's sink has been changed.
+ * @param sinkMetadata Description of the audio that is suggested by the clients.
+ */
+ updateSinkMetadata(SinkMetadata sinkMetadata);
+
+ /**
* Set up required transports for receiving audio buffers from the driver.
*
* The transport consists of three message queues:
diff --git a/audio/4.0/IStreamOut.hal b/audio/4.0/IStreamOut.hal
index 02f1697..585bffe 100644
--- a/audio/4.0/IStreamOut.hal
+++ b/audio/4.0/IStreamOut.hal
@@ -78,6 +78,12 @@
};
/**
+ * Called when the metadata of the stream's source has been changed.
+ * @param sourceMetadata Description of the audio that is played by the clients.
+ */
+ updateSourceMetadata(SourceMetadata sourceMetadata);
+
+ /**
* Set up required transports for passing audio buffers to the driver.
*
* The transport consists of three message queues:
diff --git a/audio/4.0/types.hal b/audio/4.0/types.hal
index 5c95e4b..1563b36 100644
--- a/audio/4.0/types.hal
+++ b/audio/4.0/types.hal
@@ -117,3 +117,36 @@
NOT_EMPTY = 1 << 0,
NOT_FULL = 1 << 1
};
+
+/** Metadata of a playback track for a StreamOut. */
+struct PlaybackTrackMetadata {
+ AudioUsage usage;
+ AudioContentType contentType;
+ /**
+ * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation,
+ * 2 means double amplification...
+ * Must not be negative.
+ */
+ float gain;
+};
+
+/** Metadatas of the source of a StreamOut. */
+struct SourceMetadata {
+ vec<PlaybackTrackMetadata> tracks;
+};
+
+/** Metadata of a record track for a StreamIn. */
+struct RecordTrackMetadata {
+ AudioSource source;
+ /**
+ * Positive linear gain applied to the track samples. 0 being muted and 1 is no attenuation,
+ * 2 means double amplification...
+ * Must not be negative.
+ */
+ float gain;
+};
+
+/** Metadatas of the source of a StreamIn. */
+struct SinkMetadata {
+ vec<RecordTrackMetadata> tracks;
+};