From d1b6aed4c33c063f01ea2fa35f54cb88bf311341 Mon Sep 17 00:00:00 2001 From: Ram Mohan M Date: Tue, 29 Aug 2017 14:08:47 +0530 Subject: [PATCH] bug fix: handle multiple port settings change events signalled at once Components can send various kinds of port settings changed events all at once. During a full port reconfiguration this is causing problems due to limited flexibility in the message handling design. For now, before committing to a full port reconfiguration defer any events waiting in the queue to be addressed to a later point. Test: make vts -j99 BUILD_GOOGLE_VTS=true TARGET_PRODUCT=aosp_arm64 \ && vts-tradefed run commandAndExit vts \ --skip-all-system-status-check --primary-abi-only \ --skip-preconditions --module VtsHalMediaOmxV1_0Test -l INFO Bug: 64468705 Change-Id: I537cdd3e7d92cdc6d54168f091d7897afe541599 --- .../VtsHalMediaOmxV1_0TargetVideoDecTest.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp index 1663ae7e29..1d4fd67e56 100644 --- a/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp +++ b/media/omx/1.0/vts/functional/video/VtsHalMediaOmxV1_0TargetVideoDecTest.cpp @@ -498,6 +498,21 @@ void portReconfiguration(sp omxNode, sp observer, ASSERT_EQ(msg.data.eventData.data1, kPortIndexOutput); if (msg.data.eventData.data2 == OMX_IndexParamPortDefinition || msg.data.eventData.data2 == 0) { + // Components can send various kinds of port settings changed events + // all at once. Before committing to a full port reconfiguration, + // defer any events waiting in the queue to be addressed to a later + // point. + android::List msgQueueDefer; + while (1) { + status = observer->dequeueMessage(&msg, DEFAULT_TIMEOUT, + iBuffer, oBuffer); + if (status != + android::hardware::media::omx::V1_0::Status::TIMED_OUT) { + msgQueueDefer.push_back(msg); + continue; + } else + break; + } status = omxNode->sendCommand( toRawCommandType(OMX_CommandPortDisable), kPortIndexOutput); ASSERT_EQ(status, android::hardware::media::omx::V1_0::Status::OK); @@ -577,6 +592,16 @@ void portReconfiguration(sp omxNode, sp observer, ASSERT_EQ(msg.data.eventData.data1, OMX_CommandPortEnable); ASSERT_EQ(msg.data.eventData.data2, kPortIndexOutput); + // Push back deferred messages to the list + android::List::iterator it = msgQueueDefer.begin(); + while (it != msgQueueDefer.end()) { + status = omxNode->dispatchMessage(*it); + ASSERT_EQ( + status, + ::android::hardware::media::omx::V1_0::Status::OK); + it++; + } + // dispatch output buffers for (size_t i = 0; i < oBuffer->size(); i++) { dispatchOutputBuffer(omxNode, oBuffer, i, oPortMode);