Leave AudioProfileVector only in libaudiofoundation.
Make AudioProfileVector only in libaudiofoundation. In policy part,
instead of having policy specific AudioProfileVector deriving from
AudioProfileVector in libaudiofoundation, make all the functions as
global functions. In that case, AudioPortBase does not need to be a
template class. That helps make the structure clearer.
Test: audio smoke test
Test: CTS for AudioTrack, AudioRecord, AudioManager
Test: audiopolicy_tests, AudioHostTest
Bug: 135621476
Change-Id: I36b12123cf52c3f82cef09a965403791dff74093
Merged-In: I36b12123cf52c3f82cef09a965403791dff74093
diff --git a/media/libaudiofoundation/AudioPortBase.cpp b/media/libaudiofoundation/AudioPortBase.cpp
index 922a82c..8b41be7 100644
--- a/media/libaudiofoundation/AudioPortBase.cpp
+++ b/media/libaudiofoundation/AudioPortBase.cpp
@@ -22,13 +22,13 @@
namespace android {
-void AudioPortFoundation::toAudioPort(struct audio_port *port) const {
+void AudioPortBase::toAudioPort(struct audio_port *port) const {
// TODO: update this function once audio_port structure reflects the new profile definition.
// For compatibility reason: flatening the AudioProfile into audio_port structure.
FormatSet flatenedFormats;
SampleRateSet flatenedRates;
ChannelMaskSet flatenedChannels;
- for (const auto& profile : *getAudioProfileVectorBase()) {
+ for (const auto& profile : mProfiles) {
if (profile->isValid()) {
audio_format_t formatToExport = profile->getFormat();
const SampleRateSet &ratesToExport = profile->getSampleRates();
@@ -64,13 +64,13 @@
}
}
-void AudioPortFoundation::dump(std::string *dst, int spaces, bool verbose) const {
+void AudioPortBase::dump(std::string *dst, int spaces, bool verbose) const {
if (!mName.empty()) {
dst->append(base::StringPrintf("%*s- name: %s\n", spaces, "", mName.c_str()));
}
if (verbose) {
std::string profilesStr;
- getAudioProfileVectorBase()->dump(&profilesStr, spaces);
+ mProfiles.dump(&profilesStr, spaces);
dst->append(profilesStr);
if (mGains.size() != 0) {