audio flinger: fix sink metadata for telephony software patches
Make sure the proper sink metadata are sent to audio HAL on the capture
stream when a software audio patch is used for telephony between two
audio HAL modules.
Also fix a bug in audio policy manager where the HW audio source client
used for the telephnoy TX patch was specifying a capture source
instead of playback usage in its audio attributes.
Bug: 249808607
Test: disable LE Audio offload and place a call.
Change-Id: Ic9f7dc75a732e4e404fa0b200b6ee2b34f0690df
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index bce7e25..9beaec6 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -8752,21 +8752,9 @@
return; // nothing to do
}
StreamInHalInterface::SinkMetadata metadata;
+ auto backInserter = std::back_inserter(metadata.tracks);
for (const sp<RecordTrack> &track : mActiveTracks) {
- // Do not forward PatchRecord metadata to audio HAL
- if (track->isPatchTrack()) {
- continue;
- }
- // No track is invalid as this is called after prepareTrack_l in the same critical section
- record_track_metadata_v7_t trackMetadata;
- trackMetadata.base = {
- .source = track->attributes().source,
- .gain = 1, // capture tracks do not have volumes
- };
- trackMetadata.channel_mask = track->channelMask(),
- strncpy(trackMetadata.tags, track->attributes().tags, AUDIO_ATTRIBUTES_TAGS_MAX_SIZE);
-
- metadata.tracks.push_back(trackMetadata);
+ track->copyMetadataTo(backInserter);
}
mInput->stream->updateSinkMetadata(metadata);
}