Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b7b3edb authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 13605992 from c41ea604 to 25Q3-release

Change-Id: I1784c0a5fcf8392ece284e9b8394b1bf674f58a5
parents 2d16af11 c41ea604
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -46,7 +46,6 @@ cc_binary {
        "libutils",
        "libbinder",
        "libstagefright_foundation",
        "libstagefright_persistentsurface",
        "libjpeg",
        "libui",
        "libgui",
+0 −1
Original line number Diff line number Diff line
@@ -84,7 +84,6 @@ cc_library_shared {
        "libstagefright_codecbase",
        "libstagefright_graphicbuffersource_aidl",
        "libstagefright_foundation",
        "libstagefright_persistentsurface",
        "libstagefright_surface_utils",
        "libstagefright_xmlparser",
        "libui",
+11 −65
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@
#include <aidl/android/media/IAidlGraphicBufferSource.h>
#include <aidl/android/media/IAidlBufferSource.h>
#include <android/IOMXBufferSource.h>
#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>
@@ -74,6 +75,7 @@ namespace android {
using namespace std::chrono_literals;
using ::android::hardware::graphics::bufferqueue::V1_0::utils::H2BGraphicBufferProducer;
using android::base::StringPrintf;
using ::android::hardware::media::c2::V1_0::IInputSurface;
using ::aidl::android::media::IAidlBufferSource;
using ::aidl::android::media::IAidlNode;
using ::android::media::AidlGraphicBufferSource;
@@ -2148,8 +2150,7 @@ void CCodec::createInputSurface() {
    }

    sp<PersistentSurface> persistentSurface = CreateCompatibleInputSurface();
    PersistentSurface::SurfaceType surfaceType = persistentSurface->getType();
    if (surfaceType == PersistentSurface::TYPE_AIDLSOURCE) {
    if (persistentSurface->isTargetAidl()) {
        ::ndk::SpAIBinder aidlTarget = persistentSurface->getAidlTarget();
        std::shared_ptr<AGraphicBufferSource> gbs = AGraphicBufferSource::fromBinder(aidlTarget);
        if (gbs) {
@@ -2165,8 +2166,9 @@ void CCodec::createInputSurface() {
            mCallback->onInputSurfaceCreationFailed(UNKNOWN_ERROR);
            return;
        }
    } else if (surfaceType == PersistentSurface::TYPE_HIDLSOURCE) {
    } else {
        sp<hidl::base::V1_0::IBase> hidlTarget = persistentSurface->getHidlTarget();
        sp<IInputSurface> hidlInputSurface = IInputSurface::castFrom(hidlTarget);
        sp<HGraphicBufferSource> gbs = HGraphicBufferSource::castFrom(hidlTarget);

        if (gbs) {
@@ -2178,34 +2180,10 @@ void CCodec::createInputSurface() {
                    gbs, width, height, usage));
            bufferProducer = persistentSurface->getBufferProducer();
        } else {
            ALOGE("Corrupted input surface(hidl)");
            ALOGE("Corrupted input surface");
            mCallback->onInputSurfaceCreationFailed(UNKNOWN_ERROR);
            return;
        }
    } else if (surfaceType == PersistentSurface::TYPE_INPUTSURFACE) {
        ::ndk::SpAIBinder interface = persistentSurface->getHalInputSurface();
        if (interface.get()) {
            int32_t width = 0;
            (void)outputFormat->findInt32("width", &width);
            int32_t height = 0;
            (void)outputFormat->findInt32("height", &height);
            std::shared_ptr<Codec2Client::InputSurface> surface =
                    Codec2Client::CreateInputSurfaceFromInterface(interface);
            err = setupInputSurface(std::make_shared<C2InputSurfaceWrapper>(
                    surface, width, height, usage));
            if (err == OK) {
                ANativeWindow *window = surface->getNativeWindow();
                bufferProducer = Surface::getIGraphicBufferProducer(window);
            }
        } else {
            ALOGE("Corrupted input surface(inputsurface)");
            mCallback->onInputSurfaceCreationFailed(UNKNOWN_ERROR);
            return;
        }
    } else {
        ALOGE("Corrupted input surface(invalid %d)", (int)surfaceType);
        mCallback->onInputSurfaceCreationFailed(UNKNOWN_ERROR);
        return;
    }

    if (err != OK) {
@@ -2300,9 +2278,7 @@ void CCodec::setInputSurface(const sp<PersistentSurface> &surface) {
        outputFormat = config->mOutputFormat;
        usage = config->mISConfig ? config->mISConfig->mUsage : 0;
    }

    PersistentSurface::SurfaceType surfaceType = surface->getType();
    if (surfaceType == PersistentSurface::TYPE_AIDLSOURCE) {
    if (surface->isTargetAidl()) {
        ::ndk::SpAIBinder aidlTarget = surface->getAidlTarget();
        std::shared_ptr<AGraphicBufferSource> gbs = AGraphicBufferSource::fromBinder(aidlTarget);
        if (gbs) {
@@ -2323,8 +2299,9 @@ void CCodec::setInputSurface(const sp<PersistentSurface> &surface) {
            mCallback->onInputSurfaceDeclined(UNKNOWN_ERROR);
            return;
        }
    } else if (surfaceType == PersistentSurface::TYPE_HIDLSOURCE) {
    } else {
        sp<hidl::base::V1_0::IBase> hidlTarget = surface->getHidlTarget();
        sp<IInputSurface> inputSurface = IInputSurface::castFrom(hidlTarget);
        sp<HGraphicBufferSource> gbs = HGraphicBufferSource::castFrom(hidlTarget);
        if (gbs) {
            int32_t width = 0;
@@ -2334,40 +2311,15 @@ void CCodec::setInputSurface(const sp<PersistentSurface> &surface) {
            status_t err = setupInputSurface(std::make_shared<HGraphicBufferSourceWrapper>(
                    gbs, width, height, usage));
            if (err != OK) {
                ALOGE("Failed to set up input surface(hidl): %d", err);
                mCallback->onInputSurfaceDeclined(err);
                return;
            }
        } else {
            ALOGE("Failed to set input surface(hidl): Corrupted surface.");
            mCallback->onInputSurfaceDeclined(UNKNOWN_ERROR);
            return;
        }
    } else if (surfaceType == PersistentSurface::TYPE_INPUTSURFACE) {
        ::ndk::SpAIBinder interface = surface->getHalInputSurface();
        if (interface.get()) {
            int32_t width = 0;
            (void)outputFormat->findInt32("width", &width);
            int32_t height = 0;
            (void)outputFormat->findInt32("height", &height);
            std::shared_ptr<Codec2Client::InputSurface> inputSurface =
                    Codec2Client::CreateInputSurfaceFromInterface(interface);
            status_t err = setupInputSurface(std::make_shared<C2InputSurfaceWrapper>(
                    inputSurface, width, height, usage));
            if (err != OK) {
                ALOGE("Failed to set up input surface(inputsurface): %d", err);
                ALOGE("Failed to set up input surface: %d", err);
                mCallback->onInputSurfaceDeclined(err);
                return;
            }
        } else {
            ALOGE("Failed to set input surface(inputsurface): Corrupted surface.");
            ALOGE("Failed to set input surface: Corrupted surface.");
            mCallback->onInputSurfaceDeclined(UNKNOWN_ERROR);
            return;
        }
    } else {
        ALOGE("Failed to set input surface(invalid %d): Corrupted surface.", (int)surfaceType);
        mCallback->onInputSurfaceDeclined(UNKNOWN_ERROR);
        return;
    }
    // Formats can change after setupInputSurface
    sp<AMessage> inputFormat;
@@ -3364,12 +3316,6 @@ void CCodec::initiateReleaseIfStuck() {
// static
PersistentSurface *CCodec::CreateInputSurface() {
    using namespace android;
    std::shared_ptr<Codec2Client::InputSurface> inputSurface =
            Codec2Client::CreateInputSurface();
    if (inputSurface) {
        ::ndk::SpAIBinder interface = inputSurface->getHalInterface();
        return new PersistentSurface(interface);
    }
    if (property_get_int32("debug.stagefright.c2inputsurface", 0) == -1) {
        sp<IGraphicBufferProducer> gbp;
        sp<AidlGraphicBufferSource> gbs = new AidlGraphicBufferSource();
+0 −1
Original line number Diff line number Diff line
@@ -421,7 +421,6 @@ cc_library {
        "libmedia_codeclist",
        "libmedia_omx",
        "libstagefright_foundation",
        "libstagefright_persistentsurface",
        "libutils",
    ],

+0 −39
Original line number Diff line number Diff line
@@ -79,44 +79,6 @@ cc_library_shared {
    },
}

cc_library_shared {
    name: "libstagefright_persistentsurface",

    export_include_dirs: ["include"],

    srcs: [
        "PersistentSurface.cpp",
    ],

    cflags: [
        "-Wall",
        "-Werror",
    ],

    header_libs: [
        "libstagefright_foundation_headers",
    ],

    shared_libs: [
        "android.hardware.media.c2-V1-ndk",
        "android.hidl.token@1.0-utils",
        "libbinder",
        "libbinder_ndk",
        "libgui",
        "liblog",
        "libnativewindow",
        "libutils",
    ],

    sanitize: {
        cfi: true,
        misc_undefined: [
            "signed-integer-overflow",
            "unsigned-integer-overflow",
        ],
    },
}

cc_library_static {
    name: "libstagefright_mpeg2extractor",
    apex_available: [
@@ -354,7 +316,6 @@ cc_library {
        "libstagefright_foundation",
        "libstagefright_framecapture_utils",
        "libstagefright_omx_utils",
        "libstagefright_persistentsurface",
        "libui",
        "libutils",
        "packagemanager_aidl-cpp",
Loading