Merge "bug fix: handle multiple port settings change events signalled at once" into oc-dev am: f8677dcfdb
am: 37b490df35
Change-Id: I028c248ebef366eb439b369adad87047086aa07b
This commit is contained in:
commit
a24f85f9b9
1 changed files with 25 additions and 0 deletions
|
@ -498,6 +498,21 @@ void portReconfiguration(sp<IOmxNode> omxNode, sp<CodecObserver> 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<Message> 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<IOmxNode> omxNode, sp<CodecObserver> 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<Message>::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);
|
||||
|
|
Loading…
Reference in a new issue