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

Commit c111aa4f authored by Houxiang Dai's avatar Houxiang Dai Committed by Hongguang Chen
Browse files

ACodec: Handle HDR10+ metadata at OutputPortSettingsChangedState

[Description]
handle kWhatSetParameters message in OutputPortSettingsChangedState
handle OMX_EventConfigUpdate event in OutputPortSettingsChangedState

In HDR10+ test, we have to associate each HDR10+ metadata to a particular
frame. If receive a kWhatSetParameters message with "hdr10-plus-info"
buffer, it should not be deferred in OutputPortSettingsChangedState and
adopt OMX_SetConfig to associates this config with the next input buffer
sent in OMX_EmptyThisBuffer. The OMX_EventConfigUpdate event report from
component should be handled also in OutputPortSettingsChangedState,
where is to associate updated "hdr10-plus-info" metadata with the next
output buffer sent via FillBufferDone callback.

bug: 157213958
Change-Id: I27e4614487414063831fa760b9e9ca96b1c3712c
parent 16bd3ccd
Loading
Loading
Loading
Loading
+33 −3
Original line number Diff line number Diff line
@@ -8268,13 +8268,34 @@ bool ACodec::OutputPortSettingsChangedState::onMessageReceived(
            FALLTHROUGH_INTENDED;
        }
        case kWhatResume:
        case kWhatSetParameters:
        {
            if (msg->what() == kWhatResume) {
            ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());

            mCodec->deferMessage(msg);
            handled = true;
            break;
        }

        case kWhatSetParameters:
        {
            sp<AMessage> params;
            CHECK(msg->findMessage("params", &params));

            sp<ABuffer> hdr10PlusInfo;
            if (params->findBuffer("hdr10-plus-info", &hdr10PlusInfo)) {
                if (hdr10PlusInfo != nullptr && hdr10PlusInfo->size() > 0) {
                    (void)mCodec->setHdr10PlusInfo(hdr10PlusInfo);
                }
                params->removeEntryAt(params->findEntryByName("hdr10-plus-info"));

                if (params->countEntries() == 0) {
                    msg->removeEntryAt(msg->findEntryByName("params"));
                }
            }

            if (msg->countEntries() > 0) {
                mCodec->deferMessage(msg);
            }
            handled = true;
            break;
        }
@@ -8389,6 +8410,15 @@ bool ACodec::OutputPortSettingsChangedState::onOMXEvent(
            return false;
        }

        case OMX_EventConfigUpdate:
        {
            CHECK_EQ(data1, (OMX_U32)kPortIndexOutput);

            mCodec->onConfigUpdate((OMX_INDEXTYPE)data2);

            return true;
        }

        default:
            return BaseState::onOMXEvent(event, data1, data2);
    }