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

Commit b6388026 authored by Sungtak Lee's avatar Sungtak Lee
Browse files

Codec2Client: Do not crash on configuring null output surface

Fix crash when configuring null output surface
Test: atest VtsHalMediaC2V1_0TargetVideoDecTest
Bug: 183660107

Change-Id: I22bbad6366884c3c8cbe184da8e4ba510bcb0c62
parent 9cef9404
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -181,7 +181,7 @@ bool OutputBufferQueue::configure(const sp<IGraphicBufferProducer>& igbp,
                                  int maxDequeueBufferCount,
                                  int maxDequeueBufferCount,
                                  std::shared_ptr<V1_2::SurfaceSyncObj> *syncObj) {
                                  std::shared_ptr<V1_2::SurfaceSyncObj> *syncObj) {
    uint64_t consumerUsage = 0;
    uint64_t consumerUsage = 0;
    if (igbp->getConsumerUsage(&consumerUsage) != OK) {
    if (igbp && igbp->getConsumerUsage(&consumerUsage) != OK) {
        ALOGW("failed to get consumer usage");
        ALOGW("failed to get consumer usage");
    }
    }


@@ -254,6 +254,9 @@ bool OutputBufferQueue::configure(const sp<IGraphicBufferProducer>& igbp,
        mBqId = bqId;
        mBqId = bqId;
        mOwner = std::make_shared<int>(0);
        mOwner = std::make_shared<int>(0);
        mMaxDequeueBufferCount = maxDequeueBufferCount;
        mMaxDequeueBufferCount = maxDequeueBufferCount;
        if (igbp == nullptr) {
            return false;
        }
        for (int i = 0; i < BufferQueueDefs::NUM_BUFFER_SLOTS; ++i) {
        for (int i = 0; i < BufferQueueDefs::NUM_BUFFER_SLOTS; ++i) {
            if (mBqId == 0 || !mBuffers[i]) {
            if (mBqId == 0 || !mBuffers[i]) {
                continue;
                continue;