summaryrefslogtreecommitdiffstats
path: root/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp')
-rw-r--r--services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
index 376dd22..7b6d51d 100644
--- a/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/IOProfile.cpp
@@ -23,9 +23,8 @@
namespace android {
-IOProfile::IOProfile(const String8& name, audio_port_role_t role,
- const sp<HwModule>& module)
- : AudioPort(name, AUDIO_PORT_TYPE_MIX, role, module)
+IOProfile::IOProfile(const String8& name, audio_port_role_t role)
+ : AudioPort(name, AUDIO_PORT_TYPE_MIX, role)
{
}
@@ -41,7 +40,9 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
uint32_t samplingRate,
uint32_t *updatedSamplingRate,
audio_format_t format,
+ audio_format_t *updatedFormat,
audio_channel_mask_t channelMask,
+ audio_channel_mask_t *updatedChannelMask,
uint32_t flags) const
{
const bool isPlaybackThread = mType == AUDIO_PORT_TYPE_MIX && mRole == AUDIO_PORT_ROLE_SOURCE;
@@ -72,7 +73,14 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
return false;
}
- if (!audio_is_valid_format(format) || checkFormat(format) != NO_ERROR) {
+ if (!audio_is_valid_format(format)) {
+ return false;
+ }
+ if (isPlaybackThread && checkExactFormat(format) != NO_ERROR) {
+ return false;
+ }
+ audio_format_t myUpdatedFormat = format;
+ if (isRecordThread && checkCompatibleFormat(format, &myUpdatedFormat) != NO_ERROR) {
return false;
}
@@ -80,8 +88,9 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
checkExactChannelMask(channelMask) != NO_ERROR)) {
return false;
}
+ audio_channel_mask_t myUpdatedChannelMask = channelMask;
if (isRecordThread && (!audio_is_input_channel(channelMask) ||
- checkCompatibleChannelMask(channelMask) != NO_ERROR)) {
+ checkCompatibleChannelMask(channelMask, &myUpdatedChannelMask) != NO_ERROR)) {
return false;
}
@@ -100,6 +109,12 @@ bool IOProfile::isCompatibleProfile(audio_devices_t device,
if (updatedSamplingRate != NULL) {
*updatedSamplingRate = myUpdatedSamplingRate;
}
+ if (updatedFormat != NULL) {
+ *updatedFormat = myUpdatedFormat;
+ }
+ if (updatedChannelMask != NULL) {
+ *updatedChannelMask = myUpdatedChannelMask;
+ }
return true;
}