Propagate AudioFlinger open output flags to audio policy
Returning the output stream flags from audio flinger to audio policy
software output descriptor allows for improved decision making in audio
policy.
Test: lunch aosp_cf_x86_phone-next-eng # Enable HIDL audio HAL
atest CtsMediaAudioTestCases:android.media.audio.cts.LoopbackPassthroughTest
=> verify through logging that SwAudioOutputDescriptor open flags
returned as 0x401 (including AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO)
which is modified from the supplied 0x1 (AUDIO_OUTPUT_FLAG_DIRECT only)
atest audiopolicy_tests
Bug: 311830316
Change-Id: I212e80779f6fee956d1c55e6c769d89260615e8c
diff --git a/services/audioflinger/datapath/SpdifStreamOut.cpp b/services/audioflinger/datapath/SpdifStreamOut.cpp
index d3983b0..52d66a1 100644
--- a/services/audioflinger/datapath/SpdifStreamOut.cpp
+++ b/services/audioflinger/datapath/SpdifStreamOut.cpp
@@ -33,10 +33,8 @@
* PCM then we need to wrap the data in an SPDIF wrapper.
*/
SpdifStreamOut::SpdifStreamOut(AudioHwDevice *dev,
- audio_output_flags_t flags,
audio_format_t format)
- // Tell the HAL that the data will be compressed audio wrapped in a data burst.
- : AudioStreamOut(dev, (audio_output_flags_t) (flags | AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO))
+ : AudioStreamOut(dev)
, mSpdifEncoder(this, format)
{
}
@@ -45,6 +43,7 @@
audio_io_handle_t handle,
audio_devices_t devices,
struct audio_config *config,
+ audio_output_flags_t *flags,
const char *address,
const std::vector<playback_track_metadata_v7_t>& sourceMetadata)
{
@@ -63,6 +62,8 @@
customConfig.format = AUDIO_FORMAT_PCM_16_BIT;
customConfig.channel_mask = AUDIO_CHANNEL_OUT_STEREO;
+ // Tell the HAL that the data will be compressed audio wrapped in a data burst.
+ *flags = (audio_output_flags_t)(*flags | AUDIO_OUTPUT_FLAG_IEC958_NONAUDIO);
// Always print this because otherwise it could be very confusing if the
// HAL and AudioFlinger are using different formats.
@@ -76,6 +77,7 @@
handle,
devices,
&customConfig,
+ flags,
address,
sourceMetadata);