Merge "skip omx codecs check when no needed" into tm-dev
diff --git a/media/codec2/components/base/SimpleC2Interface.cpp b/media/codec2/components/base/SimpleC2Interface.cpp
index 29740d1..993e602 100644
--- a/media/codec2/components/base/SimpleC2Interface.cpp
+++ b/media/codec2/components/base/SimpleC2Interface.cpp
@@ -28,6 +28,14 @@
/* SimpleInterface */
+static C2R SubscribedParamIndicesSetter(
+ bool mayBlock, C2InterfaceHelper::C2P<C2SubscribedParamIndicesTuning> &me) {
+ (void)mayBlock;
+ (void)me;
+
+ return C2R::Ok();
+}
+
SimpleInterface<void>::BaseParams::BaseParams(
const std::shared_ptr<C2ReflectorHelper> &reflector,
C2String name,
@@ -186,7 +194,7 @@
.withDefault(C2SubscribedParamIndicesTuning::AllocShared(0u))
.withFields({ C2F(mSubscribedParamIndices, m.values[0]).any(),
C2F(mSubscribedParamIndices, m.values).any() })
- .withSetter(Setter<C2SubscribedParamIndicesTuning>::NonStrictValuesWithNoDeps)
+ .withSetter(SubscribedParamIndicesSetter)
.build());
/* TODO
diff --git a/media/codec2/components/base/include/SimpleC2Interface.h b/media/codec2/components/base/include/SimpleC2Interface.h
index 2051d3d..916f392 100644
--- a/media/codec2/components/base/include/SimpleC2Interface.h
+++ b/media/codec2/components/base/include/SimpleC2Interface.h
@@ -209,6 +209,7 @@
return me.F(me.v.value).validatePossible(me.v.value);
}
+ // TODO(b/230146771): fix crash
static C2R NonStrictValuesWithNoDeps(
bool mayBlock, C2InterfaceHelper::C2P<type> &me) {
(void)mayBlock;
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 88fe1f3..fffd60a 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -30,6 +30,7 @@
#include <android/hardware/media/c2/1.0/IInputSurface.h>
#include <android/hardware/media/omx/1.0/IGraphicBufferSource.h>
#include <android/hardware/media/omx/1.0/IOmx.h>
+#include <android-base/properties.h>
#include <android-base/stringprintf.h>
#include <cutils/properties.h>
#include <gui/IGraphicBufferProducer.h>
@@ -1011,7 +1012,9 @@
// Query vendor format for Flexible YUV
std::vector<std::unique_ptr<C2Param>> heapParams;
C2StoreFlexiblePixelFormatDescriptorsInfo *pixelFormatInfo = nullptr;
- if (mClient->query(
+ int vendorSdkVersion = base::GetIntProperty(
+ "ro.vendor.build.version.sdk", android_get_device_api_level());
+ if (vendorSdkVersion >= __ANDROID_API_S__ && mClient->query(
{},
{C2StoreFlexiblePixelFormatDescriptorsInfo::PARAM_TYPE},
C2_MAY_BLOCK,
diff --git a/media/codec2/sfplugin/CCodecConfig.cpp b/media/codec2/sfplugin/CCodecConfig.cpp
index 132902b..836d2a7 100644
--- a/media/codec2/sfplugin/CCodecConfig.cpp
+++ b/media/codec2/sfplugin/CCodecConfig.cpp
@@ -20,6 +20,8 @@
#include <log/log.h>
#include <utils/NativeHandle.h>
+#include <android-base/properties.h>
+
#include <C2Component.h>
#include <C2Param.h>
#include <util/C2InterfaceHelper.h>
@@ -1111,15 +1113,21 @@
const std::shared_ptr<Codec2Client::Configurable> &configurable,
const std::vector<C2Param::Index> &indices,
c2_blocking_t blocking) {
+ static const int32_t kProductFirstApiLevel =
+ base::GetIntProperty<int32_t>("ro.product.first_api_level", 0);
+ static const int32_t kBoardApiLevel =
+ base::GetIntProperty<int32_t>("ro.board.first_api_level", 0);
+ static const int32_t kFirstApiLevel =
+ (kBoardApiLevel != 0) ? kBoardApiLevel : kProductFirstApiLevel;
mSubscribedIndices.insert(indices.begin(), indices.end());
- // TODO: enable this when components no longer crash on this config
- if (mSubscribedIndices.size() != mSubscribedIndicesSize && false) {
- std::vector<uint32_t> indices;
+ if (mSubscribedIndices.size() != mSubscribedIndicesSize
+ && kFirstApiLevel >= __ANDROID_API_T__) {
+ std::vector<uint32_t> indicesVector;
for (C2Param::Index ix : mSubscribedIndices) {
- indices.push_back(ix);
+ indicesVector.push_back(ix);
}
std::unique_ptr<C2SubscribedParamIndicesTuning> subscribeTuning =
- C2SubscribedParamIndicesTuning::AllocUnique(indices);
+ C2SubscribedParamIndicesTuning::AllocUnique(indicesVector);
std::vector<std::unique_ptr<C2SettingResult>> results;
c2_status_t c2Err = configurable->config({ subscribeTuning.get() }, blocking, &results);
if (c2Err != C2_OK && c2Err != C2_BAD_INDEX) {
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 9344e20..49f6bfc 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -978,7 +978,8 @@
|| mType == MIXER
|| mType == DUPLICATING
|| mType == DIRECT
- || mType == OFFLOAD) {
+ || mType == OFFLOAD
+ || mType == SPATIALIZER) {
dprintf(fd, " Timestamp stats: %s\n", mTimestampVerifier.toString().c_str());
dprintf(fd, " Timestamp corrected: %s\n", isTimestampCorrectionEnabled() ? "yes" : "no");
}
@@ -3007,6 +3008,7 @@
// Calculate size of normal sink buffer relative to the HAL output buffer size
double multiplier = 1.0;
+ // Note: mType == SPATIALIZER does not support FastMixer.
if (mType == MIXER && (kUseFastMixer == FastMixer_Static ||
kUseFastMixer == FastMixer_Dynamic)) {
size_t minNormalFrameCount = (kMinNormalSinkBufferSizeMs * mSampleRate) / 1000;
@@ -3468,7 +3470,7 @@
sp<EffectBufferHalInterface> halInBuffer, halOutBuffer;
effect_buffer_t *buffer = nullptr; // only used for non global sessions
- if (mType == SPATIALIZER ) {
+ if (mType == SPATIALIZER) {
if (!audio_is_global_session(session)) {
// player sessions on a spatializer output will use a dedicated input buffer and
// will either output multi channel to mEffectBuffer if the track is spatilaized
@@ -3694,7 +3696,7 @@
cacheParameters_l();
mSleepTimeUs = mIdleSleepTimeUs;
- if (mType == MIXER) {
+ if (mType == MIXER || mType == SPATIALIZER) {
sleepTimeShift = 0;
}
@@ -3872,7 +3874,7 @@
mStandbyTimeNs = systemTime() + mStandbyDelayNs;
mSleepTimeUs = mIdleSleepTimeUs;
- if (mType == MIXER) {
+ if (mType == MIXER || mType == SPATIALIZER) {
sleepTimeShift = 0;
}
@@ -4149,7 +4151,8 @@
// write blocked detection
const int64_t deltaWriteNs = lastIoEndNs - lastIoBeginNs;
- if (mType == MIXER && deltaWriteNs > maxPeriod) {
+ if ((mType == MIXER || mType == SPATIALIZER)
+ && deltaWriteNs > maxPeriod) {
mNumDelayedWrites++;
if ((lastIoEndNs - lastWarning) > kWarningThrottleNs) {
ATRACE_NAME("underrun");
@@ -4170,7 +4173,7 @@
(mMixerStatus == MIXER_DRAIN_ALL)) {
threadLoop_drain();
}
- if (mType == MIXER && !mStandby) {
+ if ((mType == MIXER || mType == SPATIALIZER) && !mStandby) {
if (mThreadThrottle
&& mMixerStatus == MIXER_TRACKS_READY // we are mixing (active tracks)
@@ -4295,13 +4298,6 @@
void AudioFlinger::PlaybackThread::collectTimestamps_l()
{
- // Collect timestamp statistics for the Playback Thread types that support it.
- if (mType != MIXER
- && mType != DUPLICATING
- && mType != DIRECT
- && mType != OFFLOAD) {
- return;
- }
if (mStandby) {
mTimestampVerifier.discontinuity(discontinuityForStandbyOrFlush());
return;