Skip to content

Commit

Permalink
ACodec: Handle HDR10+ metadata at OutputPortSettingsChangedState
Browse files Browse the repository at this point in the history
[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
Bug: 157435393
Change-Id: I27e4614487414063831fa760b9e9ca96b1c3712c
(cherry picked from commit c111aa4)
  • Loading branch information
Houxiang Dai authored and NurKeinNeid committed Apr 17, 2021
1 parent 1bf4bf8 commit af38ac9
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions media/libstagefright/ACodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8269,13 +8269,34 @@ bool ACodec::OutputPortSettingsChangedState::onMessageReceived(
FALLTHROUGH_INTENDED;
}
case kWhatResume:
{
ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());

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

case kWhatSetParameters:
{
if (msg->what() == kWhatResume) {
ALOGV("[%s] Deferring resume", mCodec->mComponentName.c_str());
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"));
}
}

mCodec->deferMessage(msg);
if (msg->countEntries() > 0) {
mCodec->deferMessage(msg);
}
handled = true;
break;
}
Expand Down Expand Up @@ -8390,6 +8411,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);
}
Expand Down

0 comments on commit af38ac9

Please sign in to comment.