Merge "MediaCodec constants For Multiple access-units" into main
diff --git a/media/audio/aconfig/audiopolicy_framework.aconfig b/media/audio/aconfig/audiopolicy_framework.aconfig
index e38737b..b41c1c3 100644
--- a/media/audio/aconfig/audiopolicy_framework.aconfig
+++ b/media/audio/aconfig/audiopolicy_framework.aconfig
@@ -18,3 +18,10 @@
description: "Enable Fade Manager Configuration support to determine fade properties"
bug: "307354764"
}
+
+flag {
+ name: "multi_zone_audio"
+ namespace: "media_audio"
+ description: "Enable multi-zone audio support in audio product strategies."
+ bug: "316643994"
+}
diff --git a/media/codec2/hal/aidl/Android.bp b/media/codec2/hal/aidl/Android.bp
index 7a9af18..48b6e21 100644
--- a/media/codec2/hal/aidl/Android.bp
+++ b/media/codec2/hal/aidl/Android.bp
@@ -24,7 +24,7 @@
shared_libs: [
"android.hardware.common-V2-ndk",
"android.hardware.media.bufferpool@2.0",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
"android.hardware.media.c2-V1-ndk",
"libbinder_ndk",
"libbase",
@@ -84,7 +84,7 @@
shared_libs: [
"android.hardware.common-V2-ndk",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
"android.hardware.media.c2-V1-ndk",
"libbase",
"libbinder_ndk",
diff --git a/media/codec2/hal/client/Android.bp b/media/codec2/hal/client/Android.bp
index 0b5b940..af6f4ae 100644
--- a/media/codec2/hal/client/Android.bp
+++ b/media/codec2/hal/client/Android.bp
@@ -43,7 +43,7 @@
"android.hardware.media.c2@1.0",
"android.hardware.media.c2@1.1",
"android.hardware.media.c2@1.2",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
"android.hardware.media.c2-V1-ndk",
"libbase",
"libbinder",
diff --git a/media/codec2/vndk/Android.bp b/media/codec2/vndk/Android.bp
index af2683b..9f57bfd 100644
--- a/media/codec2/vndk/Android.bp
+++ b/media/codec2/vndk/Android.bp
@@ -84,7 +84,7 @@
"libbase",
"libdmabufheap",
"android.hardware.media.bufferpool@2.0",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
],
local_include_dirs: [
@@ -102,7 +102,7 @@
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
"android.hardware.media.bufferpool@2.0",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
"android.hardware.media.c2-V1-ndk",
"libbase",
"libbinder_ndk",
@@ -162,11 +162,12 @@
"android.hardware.graphics.bufferqueue@2.0",
"android.hardware.common-V2-ndk",
"android.hardware.common.fmq-V1-ndk",
- "android.hardware.media.bufferpool2-V1-ndk",
+ "android.hardware.media.bufferpool2-V2-ndk",
"android.hardware.media.c2-V1-ndk",
],
shared_libs: [
+ "libbinder",
"libbinder_ndk",
"libui",
"libdl",
diff --git a/media/libstagefright/SurfaceUtils.cpp b/media/libstagefright/SurfaceUtils.cpp
index f16e635..604dcb0 100644
--- a/media/libstagefright/SurfaceUtils.cpp
+++ b/media/libstagefright/SurfaceUtils.cpp
@@ -298,6 +298,11 @@
ALOGE("error pushing blank frames: lock failed: %s (%d)", strerror(-err), -err);
break;
}
+ if (img == nullptr) {
+ (void)buf->unlock(); // Since lock() was successful.
+ ALOGE("error pushing blank frames: lock succeeded: buf mapping is nullptr");
+ break;
+ }
*img = 0;
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index 3147433..4cfbdba 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -2574,8 +2574,13 @@
return false;
}
-// setVolume_l() must be called with IAfThreadBase::mutex() or EffectChain::mutex() held
-bool EffectChain::setVolume_l(uint32_t *left, uint32_t *right, bool force)
+bool EffectChain::setVolume_l(uint32_t* left, uint32_t* right, bool force) {
+ audio_utils::lock_guard _l(mutex());
+ return setVolume_ll(left, right, force);
+}
+
+// setVolume_l() must be called with IAfThreadBase::mutex() and EffectChain::mutex() held
+bool EffectChain::setVolume_ll(uint32_t *left, uint32_t *right, bool force)
{
uint32_t newLeft = *left;
uint32_t newRight = *right;
diff --git a/services/audioflinger/Effects.h b/services/audioflinger/Effects.h
index 8583d47..1097b56 100644
--- a/services/audioflinger/Effects.h
+++ b/services/audioflinger/Effects.h
@@ -401,7 +401,7 @@
public:
EffectChain(const sp<IAfThreadBase>& thread, audio_session_t sessionId);
- void process_l() final;
+ void process_l() final REQUIRES(audio_utils::ThreadBase_Mutex);
audio_utils::mutex& mutex() const final { return mMutex; }
@@ -423,8 +423,11 @@
std::vector<int> getEffectIds() const final;
// FIXME use float to improve the dynamic range
- bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) final;
- void resetVolume_l() final;
+ bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false) final
+ REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex;
+ bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false) final
+ REQUIRES(audio_utils::ThreadBase_Mutex, mutex());
+ void resetVolume_l() final REQUIRES(audio_utils::ThreadBase_Mutex);
void setDevices_l(const AudioDeviceTypeAddrVector &devices) final;
void setInputDevice_l(const AudioDeviceTypeAddr &device) final;
void setMode_l(audio_mode_t mode) final;
@@ -570,7 +573,7 @@
// check if effects should be suspended/restored when a given effect is enable/disabled
void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect,
bool enabled, bool threadLocked) override;
- void resetVolume() override;
+ void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex);
product_strategy_t strategy() const override;
int32_t activeTrackCnt() const override;
void onEffectEnable(const sp<IAfEffectBase>& effect) override;
@@ -745,7 +748,7 @@
void checkSuspendOnEffectEnabled(const sp<IAfEffectBase>& effect __unused,
bool enabled __unused, bool threadLocked __unused) override {}
- void resetVolume() override {}
+ void resetVolume() override REQUIRES(audio_utils::ThreadBase_Mutex) {}
product_strategy_t strategy() const override { return static_cast<product_strategy_t>(0); }
int32_t activeTrackCnt() const override { return 0; }
void onEffectEnable(const sp<IAfEffectBase>& effect __unused) override;
diff --git a/services/audioflinger/IAfEffect.h b/services/audioflinger/IAfEffect.h
index 56076a3..bc01a75 100644
--- a/services/audioflinger/IAfEffect.h
+++ b/services/audioflinger/IAfEffect.h
@@ -241,7 +241,10 @@
virtual sp<IAfEffectModule> getEffectFromId_l(int id) const = 0;
virtual sp<IAfEffectModule> getEffectFromType_l(const effect_uuid_t *type) const = 0;
virtual std::vector<int> getEffectIds() const = 0;
- virtual bool setVolume_l(uint32_t *left, uint32_t *right, bool force = false) = 0;
+ virtual bool setVolume_l(uint32_t* left, uint32_t* right, bool force = false)
+ REQUIRES(audio_utils::ThreadBase_Mutex) EXCLUDES_EffectChain_Mutex = 0;
+ virtual bool setVolume_ll(uint32_t* left, uint32_t* right, bool force = false)
+ REQUIRES(audio_utils::ThreadBase_Mutex, audio_utils::EffectChain_Mutex) = 0;
virtual void resetVolume_l() = 0;
virtual void setDevices_l(const AudioDeviceTypeAddrVector &devices) = 0;
virtual void setInputDevice_l(const AudioDeviceTypeAddr &device) = 0;
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 244a262..67a0bd1 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -5497,6 +5497,7 @@
if (masterMute) {
masterVolume = 0;
}
+
// Delegate master volume control to effect in output mix effect chain if needed
sp<IAfEffectChain> chain = getEffectChain_l(AUDIO_SESSION_OUTPUT_MIX);
if (chain != 0) {
@@ -5836,7 +5837,7 @@
mixedTracks++;
- // track->mainBuffer() != mSinkBuffer or mMixerBuffer means
+ // track->mainBuffer() != mSinkBuffer and mMixerBuffer means
// there is an effect chain connected to the track
chain.clear();
if (track->mainBuffer() != mSinkBuffer &&