Merge "VP9: Synthesize CSD from frame header" into main
diff --git a/media/libaudioclient/AudioSystem.cpp b/media/libaudioclient/AudioSystem.cpp
index b7a30dc..a25d7ff 100644
--- a/media/libaudioclient/AudioSystem.cpp
+++ b/media/libaudioclient/AudioSystem.cpp
@@ -83,7 +83,7 @@
typename ServiceTraits>
class ServiceHandler {
public:
- sp<ServiceInterface> getService(bool canStartThreadPool = true)
+ sp<ServiceInterface> getService()
EXCLUDES(mMutex) NO_THREAD_SAFETY_ANALYSIS { // std::unique_ptr
sp<ServiceInterface> service;
sp<Client> client;
@@ -140,7 +140,7 @@
client = mClient;
service = mService;
// Make sure callbacks can be received by the client
- if (canStartThreadPool) {
+ if (mCanStartThreadPool) {
ProcessState::self()->startThreadPool();
}
ul.unlock();
@@ -183,6 +183,10 @@
if (mClient) ServiceTraits::onClearService(mClient);
}
+ void disableThreadPool() {
+ mCanStartThreadPool = false;
+ }
+
private:
std::mutex mSingleGetter;
std::mutex mMutex;
@@ -191,6 +195,7 @@
sp<ServiceInterface> mLocalService GUARDED_BY(mMutex);
sp<ServiceInterface> mService GUARDED_BY(mMutex);
sp<Client> mClient GUARDED_BY(mMutex);
+ std::atomic<bool> mCanStartThreadPool = true;
};
struct AudioFlingerTraits {
@@ -221,10 +226,6 @@
return gAudioFlingerServiceHandler.getService();
}
-sp<IAudioFlinger> AudioSystem::get_audio_flinger_for_fuzzer() {
- return gAudioFlingerServiceHandler.getService(false /* canStartThreadPool */);
-}
-
sp<AudioSystem::AudioFlingerClient> AudioSystem::getAudioFlingerClient() {
return gAudioFlingerServiceHandler.getClient();
}
@@ -954,6 +955,11 @@
gAudioPolicyServiceHandler.clearService();
}
+void AudioSystem::disableThreadPool() {
+ gAudioFlingerServiceHandler.disableThreadPool();
+ gAudioPolicyServiceHandler.disableThreadPool();
+}
+
// ---------------------------------------------------------------------------
void AudioSystem::onNewAudioModulesAvailable() {
diff --git a/media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp b/media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp
index 5e4f9a1..1d2da6a 100644
--- a/media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp
+++ b/media/libaudioclient/aidl/fuzzer/audioflinger_aidl_fuzzer.cpp
@@ -77,6 +77,9 @@
CHECK_EQ(NO_ERROR, AServiceManager_addService(moduleService.get()->asBinder().get(),
"android.hardware.audio.core.IModule/default"));
+ // Disable creating thread pool for fuzzer instance of audio flinger and audio policy services
+ AudioSystem::disableThreadPool();
+
const auto audioFlinger = sp<AudioFlinger>::make();
const auto afAdapter = sp<AudioFlingerServerAdapter>::make(audioFlinger);
@@ -85,7 +88,6 @@
String16(IAudioFlinger::DEFAULT_SERVICE_NAME), IInterface::asBinder(afAdapter),
false /* allowIsolated */, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT));
- AudioSystem::get_audio_flinger_for_fuzzer();
const auto audioPolicyService = sp<AudioPolicyService>::make();
CHECK_EQ(NO_ERROR,
diff --git a/media/libaudioclient/include/media/AudioSystem.h b/media/libaudioclient/include/media/AudioSystem.h
index 77d686a..c238158 100644
--- a/media/libaudioclient/include/media/AudioSystem.h
+++ b/media/libaudioclient/include/media/AudioSystem.h
@@ -187,7 +187,10 @@
// helper function to obtain AudioFlinger service handle
static sp<IAudioFlinger> get_audio_flinger();
- static sp<IAudioFlinger> get_audio_flinger_for_fuzzer();
+
+ // function to disable creation of thread pool (Used for testing).
+ // This should be called before get_audio_flinger() or get_audio_policy_service().
+ static void disableThreadPool();
static float linearToLog(int volume);
static int logToLinear(float volume);
diff --git a/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp b/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
index 90406e9..fff2feb 100644
--- a/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
+++ b/media/libeffects/lvm/wrapper/Aidl/BundleContext.cpp
@@ -564,10 +564,40 @@
RetCode BundleContext::setForcedDevice(
const ::aidl::android::media::audio::common::AudioDeviceDescription& device) {
- RETURN_VALUE_IF(true != isDeviceSupportedVirtualizer({device}), RetCode::ERROR_EFFECT_LIB_ERROR,
- " deviceNotSupportVirtualizer");
- mForceDevice = device;
- return RetCode::SUCCESS;
+ RetCode ret = RetCode::SUCCESS;
+ bool enableVirtualizer = mType == lvm::BundleEffectType::VIRTUALIZER && mEnabled;
+
+ if (isDeviceSupportedVirtualizer({device})) {
+ mVirtualizerForcedDevice = device;
+ } else {
+ // disabling forced virtualization mode
+ AudioDeviceDescription noneDevice;
+ if (device != noneDevice) {
+ // device is not supported, make it behave as a reset of forced mode but return an error
+ ret = RetCode::ERROR_ILLEGAL_PARAMETER;
+ }
+ // verify whether the virtualization should be enabled or disabled
+ if (!isDeviceSupportedVirtualizer(mOutputDevice)) {
+ enableVirtualizer = false;
+ }
+ mVirtualizerForcedDevice = noneDevice;
+ }
+
+ if (enableVirtualizer) {
+ if (mVirtualizerTempDisabled) {
+ LOG(VERBOSE) << __func__ << " re-enable virtualizer";
+ enableOperatingMode();
+ mVirtualizerTempDisabled = false;
+ }
+ } else {
+ if (!mVirtualizerTempDisabled) {
+ LOG(VERBOSE) << __func__ << " disable virtualizer";
+ disableOperatingMode();
+ mVirtualizerTempDisabled = true;
+ }
+ }
+
+ return ret;
}
RetCode BundleContext::initControlParameter(LVM_ControlParams_t& params) const {
diff --git a/media/libeffects/lvm/wrapper/Aidl/BundleContext.h b/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
index ba3997a..044c8dd 100644
--- a/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
+++ b/media/libeffects/lvm/wrapper/Aidl/BundleContext.h
@@ -76,7 +76,7 @@
RetCode setForcedDevice(
const ::aidl::android::media::audio::common::AudioDeviceDescription& device);
aidl::android::media::audio::common::AudioDeviceDescription getForcedDevice() const {
- return mForceDevice;
+ return mVirtualizerForcedDevice;
}
std::vector<Virtualizer::ChannelAngle> getSpeakerAngles(
const Virtualizer::SpeakerAnglesPayload payload);
@@ -93,8 +93,6 @@
bool mEnabled = false;
LVM_Handle_t mInstance;
- aidl::android::media::audio::common::AudioDeviceDescription mVirtualizerForcedDevice;
-
int mSamplesPerSecond = 0;
int mSamplesToExitCountEq = 0;
int mSamplesToExitCountBb = 0;
@@ -120,7 +118,7 @@
// Virtualizer
int mVirtStrengthSaved = 0; /* Conversion between Get/Set */
bool mVirtualizerTempDisabled = false;
- ::aidl::android::media::audio::common::AudioDeviceDescription mForceDevice;
+ ::aidl::android::media::audio::common::AudioDeviceDescription mVirtualizerForcedDevice;
// Volume
float mLevelSaveddB = 0; /* for when mute is set, level must be saved */
float mVolumedB = 0;
diff --git a/media/module/codecs/amrwb/enc/Android.bp b/media/module/codecs/amrwb/enc/Android.bp
index 8780136..04f36b5 100644
--- a/media/module/codecs/amrwb/enc/Android.bp
+++ b/media/module/codecs/amrwb/enc/Android.bp
@@ -79,67 +79,31 @@
arch: {
arm: {
srcs: [
- "src/asm/ARMV5E/convolve_opt.s",
- "src/asm/ARMV5E/cor_h_vec_opt.s",
- "src/asm/ARMV5E/Deemph_32_opt.s",
- "src/asm/ARMV5E/Dot_p_opt.s",
- "src/asm/ARMV5E/Filt_6k_7k_opt.s",
- "src/asm/ARMV5E/Norm_Corr_opt.s",
- "src/asm/ARMV5E/pred_lt4_1_opt.s",
- "src/asm/ARMV5E/residu_asm_opt.s",
- "src/asm/ARMV5E/scale_sig_opt.s",
- "src/asm/ARMV5E/Syn_filt_32_opt.s",
- "src/asm/ARMV5E/syn_filt_opt.s",
+ "src/asm/ARMV7/convolve_neon.s",
+ "src/asm/ARMV7/cor_h_vec_neon.s",
+ "src/asm/ARMV7/Deemph_32_neon.s",
+ "src/asm/ARMV7/Dot_p_neon.s",
+ "src/asm/ARMV7/Filt_6k_7k_neon.s",
+ "src/asm/ARMV7/Norm_Corr_neon.s",
+ "src/asm/ARMV7/pred_lt4_1_neon.s",
+ "src/asm/ARMV7/residu_asm_neon.s",
+ "src/asm/ARMV7/scale_sig_neon.s",
+ "src/asm/ARMV7/Syn_filt_32_neon.s",
+ "src/asm/ARMV7/syn_filt_neon.s",
],
cflags: [
"-DARM",
+ "-DARMV7",
"-DASM_OPT",
+ // don't actually generate neon instructions, see bug 26932980
+ "-mfpu=vfpv3",
],
- local_include_dirs: ["src/asm/ARMV5E"],
+ local_include_dirs: [
+ "src/asm/ARMV7",
+ ],
instruction_set: "arm",
-
- neon: {
- exclude_srcs: [
- "src/asm/ARMV5E/convolve_opt.s",
- "src/asm/ARMV5E/cor_h_vec_opt.s",
- "src/asm/ARMV5E/Deemph_32_opt.s",
- "src/asm/ARMV5E/Dot_p_opt.s",
- "src/asm/ARMV5E/Filt_6k_7k_opt.s",
- "src/asm/ARMV5E/Norm_Corr_opt.s",
- "src/asm/ARMV5E/pred_lt4_1_opt.s",
- "src/asm/ARMV5E/residu_asm_opt.s",
- "src/asm/ARMV5E/scale_sig_opt.s",
- "src/asm/ARMV5E/Syn_filt_32_opt.s",
- "src/asm/ARMV5E/syn_filt_opt.s",
- ],
-
- srcs: [
- "src/asm/ARMV7/convolve_neon.s",
- "src/asm/ARMV7/cor_h_vec_neon.s",
- "src/asm/ARMV7/Deemph_32_neon.s",
- "src/asm/ARMV7/Dot_p_neon.s",
- "src/asm/ARMV7/Filt_6k_7k_neon.s",
- "src/asm/ARMV7/Norm_Corr_neon.s",
- "src/asm/ARMV7/pred_lt4_1_neon.s",
- "src/asm/ARMV7/residu_asm_neon.s",
- "src/asm/ARMV7/scale_sig_neon.s",
- "src/asm/ARMV7/Syn_filt_32_neon.s",
- "src/asm/ARMV7/syn_filt_neon.s",
- ],
-
- // don't actually generate neon instructions, see bug 26932980
- cflags: [
- "-DARMV7",
- "-mfpu=vfpv3",
- ],
- local_include_dirs: [
- "src/asm/ARMV5E",
- "src/asm/ARMV7",
- ],
- },
-
},
},
diff --git a/services/audiopolicy/fuzzer/aidl/audiopolicy_aidl_fuzzer.cpp b/services/audiopolicy/fuzzer/aidl/audiopolicy_aidl_fuzzer.cpp
index 3d972dc..d582062 100644
--- a/services/audiopolicy/fuzzer/aidl/audiopolicy_aidl_fuzzer.cpp
+++ b/services/audiopolicy/fuzzer/aidl/audiopolicy_aidl_fuzzer.cpp
@@ -79,6 +79,9 @@
CHECK_EQ(NO_ERROR, AServiceManager_addService(moduleService.get()->asBinder().get(),
"android.hardware.audio.core.IModule/default"));
+ // Disable creating thread pool for fuzzer instance of audio flinger and audio policy services
+ AudioSystem::disableThreadPool();
+
const auto audioFlinger = sp<AudioFlinger>::make();
const auto afAdapter = sp<AudioFlingerServerAdapter>::make(audioFlinger);
@@ -87,7 +90,6 @@
String16(IAudioFlinger::DEFAULT_SERVICE_NAME), IInterface::asBinder(afAdapter),
false /* allowIsolated */, IServiceManager::DUMP_FLAG_PRIORITY_DEFAULT));
- AudioSystem::get_audio_flinger_for_fuzzer();
const auto audioPolicyService = sp<AudioPolicyService>::make();
CHECK_EQ(NO_ERROR,