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

Commit b5a30632 authored by Chong Zhang's avatar Chong Zhang Committed by Android (Google) Code Review
Browse files

Merge "Remove libbinder from media.swcodec"

parents 972199ea d1bbbe3d
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -160,12 +160,12 @@ struct InputSurfaceConnection::Impl : public ComponentWrapper {
            return false;
        }
        for (int32_t i = 0; i < kBufferCount; ++i) {
            if (!mSource->onInputBufferAdded(i).isOk()) {
            if (mSource->onInputBufferAdded(i) != OK) {
                LOG(WARNING) << "Impl::init: failed to populate GBS slots.";
                return false;
            }
        }
        if (!mSource->start().isOk()) {
        if (mSource->start() != OK) {
            LOG(WARNING) << "Impl::init -- GBS failed to start.";
            return false;
        }
+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ cc_library_shared {
        "libmedia_codeclist",
        "libmedia_omx",
        "libsfplugin_ccodec_utils",
        "libstagefright_bufferqueue_helper",
        "libstagefright_bufferqueue_helper_client",
        "libstagefright_codecbase",
        "libstagefright_foundation",
        "libstagefright_omx",
+38 −19
Original line number Diff line number Diff line
cc_library_shared {
    name: "libstagefright_bufferqueue_helper",
    vendor_available: true,
    vndk: {
        enabled: true,
    },
cc_defaults {
    name: "libstagefright_bufferqueue-defaults",
    double_loadable: true,
    srcs: [
        "FrameDropper.cpp",
@@ -23,7 +19,7 @@ cc_library_shared {
    ],

    shared_libs: [
        "libbinder",
        "libbase",
        "libcutils",
        "libhidlbase",
        "libhidlmemory",
@@ -33,24 +29,12 @@ cc_library_shared {
        "libutils",

        "android.hardware.graphics.bufferqueue@1.0",
        // Following libs are from libgui_bufferqueue_static
        "android.hardware.graphics.bufferqueue@2.0",
        "android.hidl.token@1.0-utils",
        "libbase",
        "libEGL",
        "libnativewindow",
        "libvndksupport",
    ],
    
    static_libs: [
        "libgui_bufferqueue_static"
    ],

    export_shared_lib_headers: [
        "libhidlmemory",
        "libstagefright_foundation",
        "android.hardware.graphics.bufferqueue@1.0",
        "android.hardware.graphics.bufferqueue@2.0",
    ],

    cflags: [
@@ -68,3 +52,38 @@ cc_library_shared {
        cfi: true,
    },
}

cc_library_shared {
    name: "libstagefright_bufferqueue_helper",
    defaults: ["libstagefright_bufferqueue-defaults"],
    vendor_available: true,
    vndk: {
        enabled: true,
    },
    static_libs: [
        "libgui_bufferqueue_static"
    ],
    shared_libs: [
        "android.hardware.graphics.bufferqueue@2.0",
        "android.hidl.token@1.0-utils",
        "libEGL",
        "libnativewindow",
        "libvndksupport",
    ],
    export_shared_lib_headers: [
        "android.hardware.graphics.bufferqueue@2.0",
    ],
    cflags: [
        "-DNO_BINDER",
    ],
}

cc_library_shared {
    name: "libstagefright_bufferqueue_helper_client",
    defaults: ["libstagefright_bufferqueue-defaults"],
    vendor_available: false,
    shared_libs: [
        "libgui"
    ],
}
+14 −14
Original line number Diff line number Diff line
@@ -412,7 +412,7 @@ GraphicBufferSource::getHGraphicBufferProducer() const {
                    B2HGraphicBufferProducer(getIGraphicBufferProducer());
}

Status GraphicBufferSource::start() {
status_t GraphicBufferSource::start() {
    Mutex::Autolock autoLock(mMutex);
    ALOGV("--> start; available=%zu, submittable=%zd",
            mAvailableBuffers.size(), mFreeCodecBuffers.size());
@@ -459,10 +459,10 @@ Status GraphicBufferSource::start() {
        }
    }

    return Status::ok();
    return OK;
}

Status GraphicBufferSource::stop() {
status_t GraphicBufferSource::stop() {
    ALOGV("stop");

    Mutex::Autolock autoLock(mMutex);
@@ -472,10 +472,10 @@ Status GraphicBufferSource::stop() {
        // not loaded->idle.
        mExecuting = false;
    }
    return Status::ok();
    return OK;
}

Status GraphicBufferSource::release(){
status_t GraphicBufferSource::release(){
    sp<ALooper> looper;
    {
        Mutex::Autolock autoLock(mMutex);
@@ -501,26 +501,26 @@ Status GraphicBufferSource::release(){
    if (looper != NULL) {
        looper->stop();
    }
    return Status::ok();
    return OK;
}

Status GraphicBufferSource::onInputBufferAdded(codec_buffer_id bufferId) {
status_t GraphicBufferSource::onInputBufferAdded(codec_buffer_id bufferId) {
    Mutex::Autolock autoLock(mMutex);

    if (mExecuting) {
        // This should never happen -- buffers can only be allocated when
        // transitioning from "loaded" to "idle".
        ALOGE("addCodecBuffer: buffer added while executing");
        return Status::fromServiceSpecificError(INVALID_OPERATION);
        return INVALID_OPERATION;
    }

    ALOGV("addCodecBuffer: bufferId=%u", bufferId);

    mFreeCodecBuffers.push_back(bufferId);
    return Status::ok();
    return OK;
}

Status GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int fenceFd) {
status_t GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int fenceFd) {
    Mutex::Autolock autoLock(mMutex);
    FileDescriptor::Autoclose fence(fenceFd);

@@ -528,7 +528,7 @@ Status GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int f
    if (cbi < 0) {
        // This should never happen.
        ALOGE("onInputBufferEmptied: buffer not recognized (bufferId=%u)", bufferId);
        return Status::fromServiceSpecificError(BAD_VALUE);
        return BAD_VALUE;
    }

    std::shared_ptr<AcquiredBuffer> buffer = mSubmittedCodecBuffers.valueAt(cbi);
@@ -548,13 +548,13 @@ Status GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int f
            ALOGV("onInputBufferEmptied: EOS null buffer (bufferId=%u@%zd)", bufferId, cbi);
        }
        // No GraphicBuffer to deal with, no additional input or output is expected, so just return.
        return Status::fromServiceSpecificError(BAD_VALUE);
        return BAD_VALUE;
    }

    if (!mExecuting) {
        // this is fine since this could happen when going from Idle to Loaded
        ALOGV("onInputBufferEmptied: no longer executing (bufferId=%u@%zd)", bufferId, cbi);
        return Status::fromServiceSpecificError(OK);
        return OK;
    }

    ALOGV("onInputBufferEmptied: bufferId=%d@%zd [slot=%d, useCount=%ld, handle=%p] acquired=%d",
@@ -584,7 +584,7 @@ Status GraphicBufferSource::onInputBufferEmptied(codec_buffer_id bufferId, int f
    }

    // releaseReleasableBuffers_l();
    return Status::ok();
    return OK;
}

void GraphicBufferSource::onDataspaceChanged_l(
+5 −7
Original line number Diff line number Diff line
@@ -31,8 +31,6 @@

namespace android {

using ::android::binder::Status;

struct FrameDropper;
class BufferItem;
class IGraphicBufferProducer;
@@ -99,26 +97,26 @@ public:
    // This is called when component transitions to running state, which means
    // we can start handing it buffers.  If we already have buffers of data
    // sitting in the BufferQueue, this will send them to the codec.
    Status start();
    status_t start();

    // This is called when component transitions to stopped, indicating that
    // the codec is meant to return all buffers back to the client for them
    // to be freed. Do NOT submit any more buffers to the component.
    Status stop();
    status_t stop();

    // This is called when component transitions to released, indicating that
    // we are shutting down.
    Status release();
    status_t release();

    // A "codec buffer", i.e. a buffer that can be used to pass data into
    // the encoder, has been allocated.  (This call does not call back into
    // component.)
    Status onInputBufferAdded(int32_t bufferId);
    status_t onInputBufferAdded(int32_t bufferId);

    // Called when encoder is no longer using the buffer.  If we have a BQ
    // buffer available, fill it with a new frame of data; otherwise, just mark
    // it as available.
    Status onInputBufferEmptied(int32_t bufferId, int fenceFd);
    status_t onInputBufferEmptied(int32_t bufferId, int fenceFd);

    // IGraphicBufferSource interface
    // ------------------------------
Loading