Merge "audio: if device is change from none to new device, need get index from new device." into main
diff --git a/include/media/OWNERS b/include/media/OWNERS
new file mode 100644
index 0000000..b1cfd52
--- /dev/null
+++ b/include/media/OWNERS
@@ -0,0 +1,2 @@
+per-file DataSource.h,ExtractorUtils.h,MediaExtractorPluginApi.h,MediaExtractorPluginHelper.h,MediaPlayerInterface.h,MediaTrack.h=set noparent
+per-file DataSource.h,ExtractorUtils.h,MediaExtractorPluginApi.h,MediaExtractorPluginHelper.h,MediaPlayerInterface.h,MediaTrack.h=file:platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/media/janitors/media_solutions_OWNERS b/media/janitors/media_solutions_OWNERS
index e0c87f7..17bc7dd 100644
--- a/media/janitors/media_solutions_OWNERS
+++ b/media/janitors/media_solutions_OWNERS
@@ -15,6 +15,7 @@
bachinger@google.com
christosts@google.com
ibaker@google.com
+jbibik@google.com
michaelkatz@google.com
rohks@google.com
tianyifeng@google.com
diff --git a/media/libaudiofoundation/DeviceDescriptorBase.cpp b/media/libaudiofoundation/DeviceDescriptorBase.cpp
index 9ffc75b..824bfce 100644
--- a/media/libaudiofoundation/DeviceDescriptorBase.cpp
+++ b/media/libaudiofoundation/DeviceDescriptorBase.cpp
@@ -125,6 +125,15 @@
dst->append(base::StringPrintf(
"%*sEncapsulation modes: %u, metadata types: %u\n", spaces, "",
mEncapsulationModes, mEncapsulationMetadataTypes));
+ if (!mEncodedFormats.empty()) {
+ std::string s;
+ for (const auto& format : mEncodedFormats) {
+ if (!s.empty()) s.append(", ");
+ s.append(audio_format_to_string(format));
+ }
+ dst->append(base::StringPrintf(
+ "%*sEncoded formats: %s\n", spaces, "", s.c_str()));
+ }
AudioPort::dump(dst, spaces, nullptr, verbose);
}
diff --git a/media/libaudiohal/impl/DeviceHalAidl.cpp b/media/libaudiohal/impl/DeviceHalAidl.cpp
index e55ad14..e22acc4 100644
--- a/media/libaudiohal/impl/DeviceHalAidl.cpp
+++ b/media/libaudiohal/impl/DeviceHalAidl.cpp
@@ -293,6 +293,9 @@
if (status_t status = filterAndUpdateScreenParameters(parameters); status != OK) {
ALOGW("%s: filtering or updating screen parameters failed: %d", __func__, status);
}
+ if (status_t status = filterAndUpdateTelephonyParameters(parameters); status != OK) {
+ ALOGW("%s: filtering or updating telephony parameters failed: %d", __func__, status);
+ }
return parseAndSetVendorParameters(mVendorExt, mModule, parameters);
}
@@ -1351,6 +1354,52 @@
return OK;
}
+status_t DeviceHalAidl::filterAndUpdateTelephonyParameters(AudioParameter ¶meters) {
+ TIME_CHECK();
+ using TtyMode = ITelephony::TelecomConfig::TtyMode;
+ ITelephony::TelecomConfig telConfig;
+ (void)VALUE_OR_RETURN_STATUS(filterOutAndProcessParameter<String8>(
+ parameters, String8(AudioParameter::keyTtyMode),
+ [&telConfig](const String8& mode) {
+ if (mode == AudioParameter::valueTtyModeOff) {
+ telConfig.ttyMode = TtyMode::OFF;
+ return OK;
+ } else if (mode == AudioParameter::valueTtyModeFull) {
+ telConfig.ttyMode = TtyMode::FULL;
+ return OK;
+ } else if (mode == AudioParameter::valueTtyModeHco) {
+ telConfig.ttyMode = TtyMode::HCO;
+ return OK;
+ } else if (mode == AudioParameter::valueTtyModeVco) {
+ telConfig.ttyMode = TtyMode::VCO;
+ return OK;
+ }
+ ALOGE("setParameters: parameter key \"%s\" has invalid value \"%s\"",
+ AudioParameter::keyTtyMode, mode.c_str());
+ return BAD_VALUE;
+ }));
+ (void)VALUE_OR_RETURN_STATUS(filterOutAndProcessParameter<String8>(
+ parameters, String8(AudioParameter::keyHacSetting),
+ [&telConfig](const String8& onOrOff) {
+ if (onOrOff == AudioParameter::valueHacOn) {
+ telConfig.isHacEnabled = Boolean{ .value = true };
+ return OK;
+ } else if (onOrOff == AudioParameter::valueHacOff) {
+ telConfig.isHacEnabled = Boolean{ .value = false };
+ return OK;
+ }
+ ALOGE("setParameters: parameter key \"%s\" has invalid value \"%s\"",
+ AudioParameter::keyHacSetting, onOrOff.c_str());
+ return BAD_VALUE;
+ }));
+ if (mTelephony != nullptr && telConfig != ITelephony::TelecomConfig{}) {
+ ITelephony::TelecomConfig newTelConfig;
+ return statusTFromBinderStatus(
+ mTelephony->setTelecomConfig(telConfig, &newTelConfig));
+ }
+ return OK;
+}
+
status_t DeviceHalAidl::findOrCreatePatch(
const AudioPatch& requestedPatch, AudioPatch* patch, bool* created) {
std::set<int32_t> sourcePortConfigIds(requestedPatch.sourcePortConfigIds.begin(),
diff --git a/media/libaudiohal/impl/DeviceHalAidl.h b/media/libaudiohal/impl/DeviceHalAidl.h
index e0b0981..2e393c7 100644
--- a/media/libaudiohal/impl/DeviceHalAidl.h
+++ b/media/libaudiohal/impl/DeviceHalAidl.h
@@ -220,6 +220,7 @@
status_t filterAndUpdateBtLeParameters(AudioParameter ¶meters);
status_t filterAndUpdateBtScoParameters(AudioParameter ¶meters);
status_t filterAndUpdateScreenParameters(AudioParameter ¶meters);
+ status_t filterAndUpdateTelephonyParameters(AudioParameter ¶meters);
status_t findOrCreatePatch(
const std::set<int32_t>& sourcePortConfigIds,
const std::set<int32_t>& sinkPortConfigIds,
diff --git a/media/libaudiohal/impl/EffectProxy.cpp b/media/libaudiohal/impl/EffectProxy.cpp
index fac03b7..a131879 100644
--- a/media/libaudiohal/impl/EffectProxy.cpp
+++ b/media/libaudiohal/impl/EffectProxy.cpp
@@ -134,8 +134,8 @@
}
ndk::ScopedAStatus EffectProxy::getDescriptor(Descriptor* desc) {
- desc->common = mDescriptorCommon;
- desc->capability = mSubEffects[mActiveSubIdx].descriptor.capability;
+ *desc = mSubEffects[mActiveSubIdx].descriptor;
+ desc->common.id.uuid = desc->common.id.proxy.value();
return ndk::ScopedAStatus::ok();
}
@@ -166,6 +166,12 @@
common.flags.hwAcceleratorMode = Flags::HardwareAccelerator::TUNNEL;
}
+ // initial flag values before we know which sub-effect to active (with setOffloadParam)
+ // same as HIDL EffectProxy flags
+ common.flags.type = Flags::Type::INSERT;
+ common.flags.insert = Flags::Insert::LAST;
+ common.flags.volume = Flags::Volume::NONE;
+
// set indication if any sub-effect indication was set
common.flags.offloadIndication |= desc.common.flags.offloadIndication;
common.flags.deviceIndication |= desc.common.flags.deviceIndication;
diff --git a/media/libdatasource/OWNERS b/media/libdatasource/OWNERS
new file mode 100644
index 0000000..0e49ed8
--- /dev/null
+++ b/media/libdatasource/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 610698
+
+# Exclude /media/OWNERS but include top-level OWNERS
+set noparent
+include platform/frameworks/av:/OWNERS
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
\ No newline at end of file
diff --git a/media/libmedia/OWNERS b/media/libmedia/OWNERS
new file mode 100644
index 0000000..e932382
--- /dev/null
+++ b/media/libmedia/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 610698
+
+# Exclude /media/OWNERS but include top-level OWNERS
+set noparent
+include platform/frameworks/av:/OWNERS
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/media/libmediahelper/AudioParameter.cpp b/media/libmediahelper/AudioParameter.cpp
index 3832e90..c081629 100644
--- a/media/libmediahelper/AudioParameter.cpp
+++ b/media/libmediahelper/AudioParameter.cpp
@@ -43,6 +43,14 @@
const char * const AudioParameter::keyBtHfpEnable = AUDIO_PARAMETER_KEY_HFP_ENABLE;
const char * const AudioParameter::keyBtHfpSamplingRate = AUDIO_PARAMETER_KEY_HFP_SET_SAMPLING_RATE;
const char * const AudioParameter::keyBtHfpVolume = AUDIO_PARAMETER_KEY_HFP_VOLUME;
+const char * const AudioParameter::keyTtyMode = AUDIO_PARAMETER_KEY_TTY_MODE;
+const char * const AudioParameter::valueTtyModeOff = AUDIO_PARAMETER_VALUE_TTY_OFF;
+const char * const AudioParameter::valueTtyModeFull = AUDIO_PARAMETER_VALUE_TTY_FULL;
+const char * const AudioParameter::valueTtyModeHco = AUDIO_PARAMETER_VALUE_TTY_HCO;
+const char * const AudioParameter::valueTtyModeVco = AUDIO_PARAMETER_VALUE_TTY_VCO;
+const char * const AudioParameter::keyHacSetting = AUDIO_PARAMETER_KEY_HAC;
+const char * const AudioParameter::valueHacOff = AUDIO_PARAMETER_VALUE_HAC_OFF;
+const char * const AudioParameter::valueHacOn = AUDIO_PARAMETER_VALUE_HAC_ON;
const char * const AudioParameter::keyHwAvSync = AUDIO_PARAMETER_HW_AV_SYNC;
const char * const AudioParameter::keyPresentationId = AUDIO_PARAMETER_STREAM_PRESENTATION_ID;
const char * const AudioParameter::keyProgramId = AUDIO_PARAMETER_STREAM_PROGRAM_ID;
diff --git a/media/libmediahelper/include/media/AudioParameter.h b/media/libmediahelper/include/media/AudioParameter.h
index 3eee854..21d5117 100644
--- a/media/libmediahelper/include/media/AudioParameter.h
+++ b/media/libmediahelper/include/media/AudioParameter.h
@@ -69,6 +69,16 @@
static const char * const keyBtHfpSamplingRate;
static const char * const keyBtHfpVolume;
+ static const char * const keyTtyMode;
+ static const char * const valueTtyModeOff;
+ static const char * const valueTtyModeFull;
+ static const char * const valueTtyModeHco;
+ static const char * const valueTtyModeVco;
+
+ static const char * const keyHacSetting;
+ static const char * const valueHacOff;
+ static const char * const valueHacOn;
+
// keyHwAvSync: get HW synchronization source identifier from a device
// keyMonoOutput: Enable mono audio playback
// keyStreamHwAvSync: set HW synchronization source identifier on a stream
diff --git a/media/libmediaplayerservice/OWNERS b/media/libmediaplayerservice/OWNERS
new file mode 100644
index 0000000..e932382
--- /dev/null
+++ b/media/libmediaplayerservice/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 610698
+
+# Exclude /media/OWNERS but include top-level OWNERS
+set noparent
+include platform/frameworks/av:/OWNERS
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/media/module/extractors/OWNERS b/media/module/extractors/OWNERS
new file mode 100644
index 0000000..8d39dcb
--- /dev/null
+++ b/media/module/extractors/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 817235
+
+# Exclude /media/OWNERS but include top-level OWNERS
+set noparent
+include platform/frameworks/av:/OWNERS
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 8c09477..ef5e727 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -10311,14 +10311,24 @@
AudioHwDevice *hwDev, AudioStreamOut *output, bool systemReady)
: MmapThread(audioFlinger, id, hwDev, output->stream, systemReady, true /* isOut */),
mStreamType(AUDIO_STREAM_MUSIC),
- mStreamVolume(1.0),
- mStreamMute(false),
mOutput(output)
{
snprintf(mThreadName, kThreadNameLength, "AudioMmapOut_%X", id);
mChannelCount = audio_channel_count_from_out_mask(mChannelMask);
mMasterVolume = audioFlinger->masterVolume_l();
mMasterMute = audioFlinger->masterMute_l();
+
+ for (int i = AUDIO_STREAM_MIN; i < AUDIO_STREAM_FOR_POLICY_CNT; ++i) {
+ const audio_stream_type_t stream{static_cast<audio_stream_type_t>(i)};
+ mStreamTypes[stream].volume = 0.0f;
+ mStreamTypes[stream].mute = mAudioFlinger->streamMute_l(stream);
+ }
+ // Audio patch and call assistant volume are always max
+ mStreamTypes[AUDIO_STREAM_PATCH].volume = 1.0f;
+ mStreamTypes[AUDIO_STREAM_PATCH].mute = false;
+ mStreamTypes[AUDIO_STREAM_CALL_ASSISTANT].volume = 1.0f;
+ mStreamTypes[AUDIO_STREAM_CALL_ASSISTANT].mute = false;
+
if (mAudioHwDev) {
if (mAudioHwDev->canSetMasterVolume()) {
mMasterVolume = 1.0;
@@ -10375,8 +10385,8 @@
void AudioFlinger::MmapPlaybackThread::setStreamVolume(audio_stream_type_t stream, float value)
{
Mutex::Autolock _l(mLock);
+ mStreamTypes[stream].volume = value;
if (stream == mStreamType) {
- mStreamVolume = value;
broadcast_l();
}
}
@@ -10384,17 +10394,14 @@
float AudioFlinger::MmapPlaybackThread::streamVolume(audio_stream_type_t stream) const
{
Mutex::Autolock _l(mLock);
- if (stream == mStreamType) {
- return mStreamVolume;
- }
- return 0.0f;
+ return mStreamTypes[stream].volume;
}
void AudioFlinger::MmapPlaybackThread::setStreamMute(audio_stream_type_t stream, bool muted)
{
Mutex::Autolock _l(mLock);
+ mStreamTypes[stream].mute = muted;
if (stream == mStreamType) {
- mStreamMute= muted;
broadcast_l();
}
}
@@ -10415,14 +10422,13 @@
{
float volume;
- if (mMasterMute || mStreamMute) {
+ if (mMasterMute || streamMuted_l()) {
volume = 0;
} else {
- volume = mMasterVolume * mStreamVolume;
+ volume = mMasterVolume * streamVolume_l();
}
if (volume != mHalVolFloat) {
-
// Convert volumes from float to 8.24
uint32_t vol = (uint32_t)(volume * (1 << 24));
@@ -10534,7 +10540,7 @@
MmapThread::dumpInternals_l(fd, args);
dprintf(fd, " Stream type: %d Stream volume: %f HAL volume: %f Stream mute %d\n",
- mStreamType, mStreamVolume, mHalVolFloat, mStreamMute);
+ mStreamType, streamVolume_l(), mHalVolFloat, streamMuted_l());
dprintf(fd, " Master volume: %f Master mute %d\n", mMasterVolume, mMasterMute);
}
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index 45a4a95..b867774 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -2233,12 +2233,17 @@
protected:
void dumpInternals_l(int fd, const Vector<String16>& args) override;
+ float streamVolume_l() const {
+ return mStreamTypes[mStreamType].volume;
+ }
+ bool streamMuted_l() const {
+ return mStreamTypes[mStreamType].mute;
+ }
+ stream_type_t mStreamTypes[AUDIO_STREAM_CNT];
audio_stream_type_t mStreamType;
float mMasterVolume;
- float mStreamVolume;
bool mMasterMute;
- bool mStreamMute;
AudioStreamOut* mOutput;
};
diff --git a/services/audioflinger/timing/Android.bp b/services/audioflinger/timing/Android.bp
index ec6b85c..30ebca0 100644
--- a/services/audioflinger/timing/Android.bp
+++ b/services/audioflinger/timing/Android.bp
@@ -55,10 +55,4 @@
"-Wall",
"-Werror",
],
-
- // LTO causes unaligned __cfi_check in the library "libaudioflinger_timing.so"
- // http://b/289475610
- lto: {
- never: true,
- },
}
diff --git a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
index 5f14ee4..95f8d14 100644
--- a/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
+++ b/services/audiopolicy/common/managerdefinitions/src/HwModule.cpp
@@ -383,8 +383,8 @@
}
}
if (!allowToCreate) {
- ALOGV("%s: could not find HW module for device %s %04x address %s", __FUNCTION__,
- name, deviceType, address);
+ ALOGW("%s: could not find HW module for device %s (%s, %08x) address %s", __FUNCTION__,
+ name, audio_device_to_string(deviceType), deviceType, address);
return nullptr;
}
return createDevice(deviceType, address, name, encodedFormat);
@@ -398,8 +398,14 @@
std::string tagName = {};
sp<HwModule> hwModule = getModuleForDeviceType(type, encodedFormat, &tagName);
if (hwModule == 0) {
- ALOGE("%s: could not find HW module for device %04x address %s", __FUNCTION__, type,
- address);
+ if (encodedFormat == AUDIO_FORMAT_DEFAULT) {
+ ALOGE("%s: could not find HW module for device type '%s' (%08x)",
+ __FUNCTION__, audio_device_to_string(type), type);
+ } else {
+ ALOGE("%s: could not find HW module for device type '%s' (%08x), "
+ "encoded format '%s'", __FUNCTION__, audio_device_to_string(type), type,
+ audio_format_to_string(encodedFormat));
+ }
return nullptr;
}