AudioFlinger: Control volume using Port ID
This CL migrates the volume management within AudioFlinger
from stream type to port ID.
It gives full power to AudioPolicy to compute the list of port
(so MmapThreads/Tracks) on which volume control is required.
It prevents from overwritting MUSIC stream type which is
the default for volume groups without associated stream type.
Bug: 317212590
Test: build & play audio
Test: atest audiopolicy_tests
Flag: com.android.media.audioserver.portid_volume_management
Change-Id: I4c9e8bb45660c9ceffcc0f4029b0617f9795ab3c
diff --git a/services/audiopolicy/AudioPolicyInterface.h b/services/audiopolicy/AudioPolicyInterface.h
index deb7345..573db84 100644
--- a/services/audiopolicy/AudioPolicyInterface.h
+++ b/services/audiopolicy/AudioPolicyInterface.h
@@ -147,7 +147,8 @@
std::vector<audio_io_handle_t> *secondaryOutputs,
output_type_t *outputType,
bool *isSpatialized,
- bool *isBitPerfect) = 0;
+ bool *isBitPerfect,
+ float *volume) = 0;
// indicates to the audio policy manager that the output starts being used by corresponding
// stream.
virtual status_t startOutput(audio_port_handle_t portId) = 0;
@@ -514,6 +515,18 @@
// for each output (destination device) it is attached to.
virtual status_t setStreamVolume(audio_stream_type_t stream, float volume,
audio_io_handle_t output, int delayMs = 0) = 0;
+ /**
+ * Set volume for given AudioTrack port ids for a particular output.
+ * For the same user setting, a given volume group and associated output port id
+ * can have different volumes for each output (destination device) it is attached to.
+ * @param ports to consider
+ * @param volume to apply
+ * @param output to consider
+ * @param delayMs to use
+ * @return NO_ERROR if successful
+ */
+ virtual status_t setPortsVolume(const std::vector<audio_port_handle_t> &ports, float volume,
+ audio_io_handle_t output, int delayMs = 0) = 0;
// function enabling to send proprietary informations directly from audio policy manager to
// audio hardware interface.