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

Commit 55c07b0d authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "stagefright: pass HIDL backed persistent surface cross binder" into pi-dev

parents f4aed3b3 79c49ae0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -203,6 +203,7 @@ cc_library {
    ],

    shared_libs: [
        "android.hidl.token@1.0-utils",
        "liblog",
        "libcutils",
        "libutils",
+24 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <android/IGraphicBufferSource.h>
#include <binder/Parcel.h>
#include <hidl/HidlSupport.h>
#include <hidl/HybridInterface.h>
#include <gui/IGraphicBufferProducer.h>
#include <media/stagefright/foundation/ABase.h>

@@ -59,7 +60,19 @@ struct PersistentSurface : public RefBase {

    status_t writeToParcel(Parcel *parcel) const {
        parcel->writeStrongBinder(IInterface::asBinder(mBufferProducer));
        // this can handle null
        parcel->writeStrongBinder(IInterface::asBinder(mBufferSource));
        // write hidl target
        if (mHidlTarget != nullptr) {
            HalToken token;
            bool result = createHalToken(mHidlTarget, &token);
            parcel->writeBool(result);
            if (result) {
                parcel->writeByteArray(token.size(), token.data());
            }
        } else {
            parcel->writeBool(false);
        }
        return NO_ERROR;
    }

@@ -68,6 +81,17 @@ struct PersistentSurface : public RefBase {
                parcel->readStrongBinder());
        mBufferSource = interface_cast<IGraphicBufferSource>(
                parcel->readStrongBinder());
        // read hidl target
        bool haveHidlTarget = parcel->readBool();
        if (haveHidlTarget) {
            std::vector<uint8_t> tokenVector;
            parcel->readByteVector(&tokenVector);
            HalToken token = HalToken(tokenVector);
            mHidlTarget = retrieveHalInterface(token);
            deleteHalToken(token);
        } else {
            mHidlTarget.clear();
        }
        return NO_ERROR;
    }