Merge "Snap for 5927222 from e7f94032f622f5c964ccc3832d4087d0fd15f0da to android10-tests-release" into android10-tests-release
diff --git a/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp b/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
index 5e28750..0e20b47 100644
--- a/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
+++ b/media/codec2/hidl/1.0/vts/functional/video/VtsHalMediaC2V1_0TargetVideoDecTest.cpp
@@ -124,13 +124,6 @@
mTimestampUs = 0u;
mTimestampDevTest = false;
if (mCompName == unknown_comp) mDisableTest = true;
-
- C2SecureModeTuning secureModeTuning{};
- mComponent->query({ &secureModeTuning }, {}, C2_MAY_BLOCK, nullptr);
- if (secureModeTuning.value == C2Config::SM_READ_PROTECTED) {
- mDisableTest = true;
- }
-
if (mDisableTest) std::cout << "[ WARN ] Test Disabled \n";
}
diff --git a/media/codec2/hidl/client/client.cpp b/media/codec2/hidl/client/client.cpp
index 5ed54f1..2b417a6 100644
--- a/media/codec2/hidl/client/client.cpp
+++ b/media/codec2/hidl/client/client.cpp
@@ -959,9 +959,9 @@
std::shared_ptr<Codec2Client::InputSurface> Codec2Client::CreateInputSurface(
char const* serviceName) {
- int32_t inputSurfaceSetting = ::android::base::GetIntProperty(
- "debug.stagefright.c2inputsurface", int32_t(0));
- if (inputSurfaceSetting <= 0) {
+ uint32_t inputSurfaceSetting = ::android::base::GetUintProperty(
+ "debug.stagefright.c2inputsurface", uint32_t(0));
+ if (inputSurfaceSetting == 0) {
return nullptr;
}
size_t index = GetServiceNames().size();
diff --git a/media/codec2/sfplugin/Android.bp b/media/codec2/sfplugin/Android.bp
index 9c84c71..8ae80ee 100644
--- a/media/codec2/sfplugin/Android.bp
+++ b/media/codec2/sfplugin/Android.bp
@@ -9,7 +9,6 @@
"CCodecConfig.cpp",
"Codec2Buffer.cpp",
"Codec2InfoBuilder.cpp",
- "Omx2IGraphicBufferSource.cpp",
"PipelineWatcher.cpp",
"ReflectedParamUpdater.cpp",
"SkipCutBuffer.cpp",
@@ -42,10 +41,8 @@
"libmedia",
"libmedia_omx",
"libsfplugin_ccodec_utils",
- "libstagefright_bufferqueue_helper",
"libstagefright_codecbase",
"libstagefright_foundation",
- "libstagefright_omx",
"libstagefright_omx_utils",
"libstagefright_xmlparser",
"libui",
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 9d1cc60..aa7189c 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -45,7 +45,6 @@
#include "CCodec.h"
#include "CCodecBufferChannel.h"
#include "InputSurfaceWrapper.h"
-#include "Omx2IGraphicBufferSource.h"
extern "C" android::PersistentSurface *CreateInputSurface();
@@ -1068,7 +1067,6 @@
OmxStatus s;
android::sp<HGraphicBufferProducer> gbp;
android::sp<HGraphicBufferSource> gbs;
-
using ::android::hardware::Return;
Return<void> transStatus = omx->createInputSurface(
[&s, &gbp, &gbs](
@@ -1854,30 +1852,15 @@
// Create Codec 2.0 input surface
extern "C" android::PersistentSurface *CreateInputSurface() {
- using namespace android;
// Attempt to create a Codec2's input surface.
- std::shared_ptr<Codec2Client::InputSurface> inputSurface =
- Codec2Client::CreateInputSurface();
+ std::shared_ptr<android::Codec2Client::InputSurface> inputSurface =
+ android::Codec2Client::CreateInputSurface();
if (!inputSurface) {
- if (property_get_int32("debug.stagefright.c2inputsurface", 0) == -1) {
- sp<IGraphicBufferProducer> gbp;
- sp<OmxGraphicBufferSource> gbs = new OmxGraphicBufferSource();
- status_t err = gbs->initCheck();
- if (err != OK) {
- ALOGE("Failed to create persistent input surface: error %d", err);
- return nullptr;
- }
- return new PersistentSurface(
- gbs->getIGraphicBufferProducer(),
- sp<IGraphicBufferSource>(
- new Omx2IGraphicBufferSource(gbs)));
- } else {
- return nullptr;
- }
+ return nullptr;
}
- return new PersistentSurface(
+ return new android::PersistentSurface(
inputSurface->getGraphicBufferProducer(),
- static_cast<sp<android::hidl::base::V1_0::IBase>>(
+ static_cast<android::sp<android::hidl::base::V1_0::IBase>>(
inputSurface->getHalInterface()));
}
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 8308292..09049b9 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -896,9 +896,6 @@
input->buffers.reset(new DummyInputBuffers(mName));
} else if (mMetaMode == MODE_ANW) {
input->buffers.reset(new GraphicMetadataInputBuffers(mName));
- // This is to ensure buffers do not get released prematurely.
- // TODO: handle this without going into array mode
- forceArrayMode = true;
} else {
input->buffers.reset(new GraphicInputBuffers(numInputSlots, mName));
}
diff --git a/media/codec2/sfplugin/Codec2InfoBuilder.cpp b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
index 6b75eba..c54c601 100644
--- a/media/codec2/sfplugin/Codec2InfoBuilder.cpp
+++ b/media/codec2/sfplugin/Codec2InfoBuilder.cpp
@@ -194,8 +194,7 @@
// TODO: get this from intf() as well, but how do we map them to
// MediaCodec color formats?
bool encoder = trait.kind == C2Component::KIND_ENCODER;
- if (mediaType.find("video") != std::string::npos
- || mediaType.find("image") != std::string::npos) {
+ if (mediaType.find("video") != std::string::npos) {
// vendor video codecs prefer opaque format
if (trait.name.find("android") == std::string::npos) {
caps->addColorFormat(COLOR_FormatSurface);
diff --git a/media/codec2/sfplugin/Omx2IGraphicBufferSource.cpp b/media/codec2/sfplugin/Omx2IGraphicBufferSource.cpp
deleted file mode 100644
index 764fa00..0000000
--- a/media/codec2/sfplugin/Omx2IGraphicBufferSource.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifdef __LP64__
-#define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS
-#endif
-
-//#define LOG_NDEBUG 0
-#define LOG_TAG "Omx2IGraphicBufferSource"
-#include <android-base/logging.h>
-
-#include "Omx2IGraphicBufferSource.h"
-
-#include <android/BnOMXBufferSource.h>
-#include <media/OMXBuffer.h>
-#include <media/stagefright/omx/OMXUtils.h>
-
-#include <OMX_Component.h>
-#include <OMX_Index.h>
-#include <OMX_IndexExt.h>
-
-namespace android {
-
-namespace /* unnamed */ {
-
-// OmxGraphicBufferSource -> IOMXBufferSource
-
-struct OmxGbs2IOmxBs : public BnOMXBufferSource {
- sp<OmxGraphicBufferSource> mBase;
- OmxGbs2IOmxBs(sp<OmxGraphicBufferSource> const& base) : mBase{base} {}
- BnStatus onOmxExecuting() override {
- return mBase->onOmxExecuting();
- }
- BnStatus onOmxIdle() override {
- return mBase->onOmxIdle();
- }
- BnStatus onOmxLoaded() override {
- return mBase->onOmxLoaded();
- }
- BnStatus onInputBufferAdded(int32_t bufferId) override {
- return mBase->onInputBufferAdded(bufferId);
- }
- BnStatus onInputBufferEmptied(
- int32_t bufferId,
- OMXFenceParcelable const& fenceParcel) override {
- return mBase->onInputBufferEmptied(bufferId, fenceParcel.get());
- }
-};
-
-struct OmxNodeWrapper : public IOmxNodeWrapper {
- sp<IOMXNode> mBase;
- OmxNodeWrapper(sp<IOMXNode> const& base) : mBase{base} {}
- status_t emptyBuffer(
- int32_t bufferId, uint32_t flags,
- const sp<GraphicBuffer> &buffer,
- int64_t timestamp, int fenceFd) override {
- return mBase->emptyBuffer(bufferId, buffer, flags, timestamp, fenceFd);
- }
- void dispatchDataSpaceChanged(
- int32_t dataSpace, int32_t aspects, int32_t pixelFormat) override {
- omx_message msg{};
- msg.type = omx_message::EVENT;
- msg.fenceFd = -1;
- msg.u.event_data.event = OMX_EventDataSpaceChanged;
- msg.u.event_data.data1 = dataSpace;
- msg.u.event_data.data2 = aspects;
- msg.u.event_data.data3 = pixelFormat;
- mBase->dispatchMessage(msg);
- }
-};
-
-} // unnamed namespace
-
-// Omx2IGraphicBufferSource
-Omx2IGraphicBufferSource::Omx2IGraphicBufferSource(
- sp<OmxGraphicBufferSource> const& base)
- : mBase{base},
- mOMXBufferSource{new OmxGbs2IOmxBs(base)} {
-}
-
-BnStatus Omx2IGraphicBufferSource::setSuspend(
- bool suspend, int64_t timeUs) {
- return BnStatus::fromStatusT(mBase->setSuspend(suspend, timeUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::setRepeatPreviousFrameDelayUs(
- int64_t repeatAfterUs) {
- return BnStatus::fromStatusT(mBase->setRepeatPreviousFrameDelayUs(repeatAfterUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::setMaxFps(float maxFps) {
- return BnStatus::fromStatusT(mBase->setMaxFps(maxFps));
-}
-
-BnStatus Omx2IGraphicBufferSource::setTimeLapseConfig(
- double fps, double captureFps) {
- return BnStatus::fromStatusT(mBase->setTimeLapseConfig(fps, captureFps));
-}
-
-BnStatus Omx2IGraphicBufferSource::setStartTimeUs(
- int64_t startTimeUs) {
- return BnStatus::fromStatusT(mBase->setStartTimeUs(startTimeUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::setStopTimeUs(
- int64_t stopTimeUs) {
- return BnStatus::fromStatusT(mBase->setStopTimeUs(stopTimeUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::getStopTimeOffsetUs(
- int64_t *stopTimeOffsetUs) {
- return BnStatus::fromStatusT(mBase->getStopTimeOffsetUs(stopTimeOffsetUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::setColorAspects(
- int32_t aspects) {
- return BnStatus::fromStatusT(mBase->setColorAspects(aspects));
-}
-
-BnStatus Omx2IGraphicBufferSource::setTimeOffsetUs(
- int64_t timeOffsetsUs) {
- return BnStatus::fromStatusT(mBase->setTimeOffsetUs(timeOffsetsUs));
-}
-
-BnStatus Omx2IGraphicBufferSource::signalEndOfInputStream() {
- return BnStatus::fromStatusT(mBase->signalEndOfInputStream());
-}
-
-BnStatus Omx2IGraphicBufferSource::configure(
- const sp<IOMXNode>& omxNode, int32_t dataSpace) {
- if (omxNode == NULL) {
- return BnStatus::fromServiceSpecificError(BAD_VALUE);
- }
-
- // Do setInputSurface() first, the node will try to enable metadata
- // mode on input, and does necessary error checking. If this fails,
- // we can't use this input surface on the node.
- status_t err = omxNode->setInputSurface(mOMXBufferSource);
- if (err != NO_ERROR) {
- ALOGE("Unable to set input surface: %d", err);
- return BnStatus::fromServiceSpecificError(err);
- }
-
- uint32_t consumerUsage;
- if (omxNode->getParameter(
- (OMX_INDEXTYPE)OMX_IndexParamConsumerUsageBits,
- &consumerUsage, sizeof(consumerUsage)) != OK) {
- consumerUsage = 0;
- }
-
- OMX_PARAM_PORTDEFINITIONTYPE def;
- InitOMXParams(&def);
- def.nPortIndex = 0; // kPortIndexInput
-
- err = omxNode->getParameter(
- OMX_IndexParamPortDefinition, &def, sizeof(def));
- if (err != NO_ERROR) {
- ALOGE("Failed to get port definition: %d", err);
- return BnStatus::fromServiceSpecificError(UNKNOWN_ERROR);
- }
-
- return BnStatus::fromStatusT(mBase->configure(
- new OmxNodeWrapper(omxNode),
- dataSpace,
- def.nBufferCountActual,
- def.format.video.nFrameWidth,
- def.format.video.nFrameHeight,
- consumerUsage));
-}
-
-} // namespace android
-
diff --git a/media/codec2/sfplugin/Omx2IGraphicBufferSource.h b/media/codec2/sfplugin/Omx2IGraphicBufferSource.h
deleted file mode 100644
index 20fd1ec..0000000
--- a/media/codec2/sfplugin/Omx2IGraphicBufferSource.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef OMX_2_IGRAPHICBUFFERSOURCE_H_
-#define OMX_2_IGRAPHICBUFFERSOURCE_H_
-
-#include <android/BnGraphicBufferSource.h>
-#include <media/stagefright/omx/OmxGraphicBufferSource.h>
-
-namespace android {
-
-using BnStatus = ::android::binder::Status;
-
-struct Omx2IGraphicBufferSource : public BnGraphicBufferSource {
- sp<OmxGraphicBufferSource> mBase;
- sp<IOMXBufferSource> mOMXBufferSource;
- Omx2IGraphicBufferSource(sp<OmxGraphicBufferSource> const& base);
- BnStatus configure(const sp<IOMXNode>& omxNode, int32_t dataSpace) override;
- BnStatus setSuspend(bool suspend, int64_t timeUs) override;
- BnStatus setRepeatPreviousFrameDelayUs(int64_t repeatAfterUs) override;
- BnStatus setMaxFps(float maxFps) override;
- BnStatus setTimeLapseConfig(double fps, double captureFps) override;
- BnStatus setStartTimeUs(int64_t startTimeUs) override;
- BnStatus setStopTimeUs(int64_t stopTimeUs) override;
- BnStatus getStopTimeOffsetUs(int64_t *stopTimeOffsetUs) override;
- BnStatus setColorAspects(int32_t aspects) override;
- BnStatus setTimeOffsetUs(int64_t timeOffsetsUs) override;
- BnStatus signalEndOfInputStream() override;
-};
-
-} // namespace android
-
-#endif // OMX_2_IGRAPHICBUFFERSOURCE_H_
-
diff --git a/media/extractors/flac/Android.bp b/media/extractors/flac/Android.bp
index 3a3d051..ef8e410 100644
--- a/media/extractors/flac/Android.bp
+++ b/media/extractors/flac/Android.bp
@@ -8,6 +8,7 @@
],
shared_libs: [
+ "libbase",
"libbinder_ndk",
"liblog",
"libmediandk",
diff --git a/media/extractors/flac/FLACExtractor.cpp b/media/extractors/flac/FLACExtractor.cpp
index 5329bd1..0617e88 100644
--- a/media/extractors/flac/FLACExtractor.cpp
+++ b/media/extractors/flac/FLACExtractor.cpp
@@ -24,6 +24,7 @@
// libFLAC parser
#include "FLAC/stream_decoder.h"
+#include <android-base/properties.h>
#include <android/binder_ibinder.h> // for AIBinder_getCallingUid
#include <audio_utils/primitives.h>
#include <media/MediaExtractorPluginApi.h>
@@ -47,7 +48,8 @@
// (Note: duplicated with WAVExtractor.cpp)
static inline bool shouldExtractorOutputFloat(int bitsPerSample)
{
- return bitsPerSample > 16 && AIBinder_getCallingUid() == AID_MEDIA;
+ return bitsPerSample > 16 && AIBinder_getCallingUid() == AID_MEDIA
+ && android::base::GetBoolProperty("media.extractor.float", true);
}
class FLACParser;
diff --git a/media/extractors/wav/Android.bp b/media/extractors/wav/Android.bp
index 7e89271..5988964 100644
--- a/media/extractors/wav/Android.bp
+++ b/media/extractors/wav/Android.bp
@@ -7,6 +7,7 @@
],
shared_libs: [
+ "libbase",
"libbinder_ndk",
"liblog",
"libmediandk",
diff --git a/media/extractors/wav/WAVExtractor.cpp b/media/extractors/wav/WAVExtractor.cpp
index 4fa7f27..d19447a 100644
--- a/media/extractors/wav/WAVExtractor.cpp
+++ b/media/extractors/wav/WAVExtractor.cpp
@@ -20,6 +20,7 @@
#include "WAVExtractor.h"
+#include <android-base/properties.h>
#include <android/binder_ibinder.h> // for AIBinder_getCallingUid
#include <audio_utils/primitives.h>
#include <media/stagefright/foundation/ADebug.h>
@@ -43,7 +44,8 @@
// (Note: duplicated with FLACExtractor.cpp)
static inline bool shouldExtractorOutputFloat(int bitsPerSample)
{
- return bitsPerSample > 16 && AIBinder_getCallingUid() == AID_MEDIA;
+ return bitsPerSample > 16 && AIBinder_getCallingUid() == AID_MEDIA
+ && android::base::GetBoolProperty("media.extractor.float", true);
}
enum {
diff --git a/media/libstagefright/omx/Android.bp b/media/libstagefright/omx/Android.bp
index 7d03d98..e260cae 100644
--- a/media/libstagefright/omx/Android.bp
+++ b/media/libstagefright/omx/Android.bp
@@ -72,6 +72,7 @@
cfi: true,
},
+ compile_multilib: "32",
}
cc_library_shared {
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 1d4dacd..a6730fc 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -2396,8 +2396,7 @@
for (size_t i = 0; i < mInputs.size(); i++) {
const sp<AudioInputDescriptor> input = mInputs.valueAt(i);
if (input->clientsList().size() == 0
- || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())
- || (input->getAudioPort()->getFlags() & AUDIO_INPUT_FLAG_MMAP_NOIRQ) != 0) {
+ || !mAvailableInputDevices.containsAtLeastOne(input->supportedDevices())) {
inputsToClose.push_back(mInputs.keyAt(i));
} else {
bool close = false;