Merge change 22830 into eclair
* changes: Another quirk, some OMX components fail to properly flush before shutdown and we must do it for them...
This commit is contained in:
@@ -84,6 +84,7 @@ private:
|
|||||||
kRequiresAllocateBufferOnInputPorts = 8,
|
kRequiresAllocateBufferOnInputPorts = 8,
|
||||||
kRequiresFlushCompleteEmulation = 16,
|
kRequiresFlushCompleteEmulation = 16,
|
||||||
kRequiresAllocateBufferOnOutputPorts = 32,
|
kRequiresAllocateBufferOnOutputPorts = 32,
|
||||||
|
kRequiresFlushBeforeShutdown = 64,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct BufferInfo {
|
struct BufferInfo {
|
||||||
|
|||||||
@@ -194,6 +194,11 @@ sp<OMXCodec> OMXCodec::Create(
|
|||||||
if (!strcmp(componentName, "OMX.TI.AAC.decode")) {
|
if (!strcmp(componentName, "OMX.TI.AAC.decode")) {
|
||||||
quirks |= kNeedsFlushBeforeDisable;
|
quirks |= kNeedsFlushBeforeDisable;
|
||||||
quirks |= kRequiresFlushCompleteEmulation;
|
quirks |= kRequiresFlushCompleteEmulation;
|
||||||
|
|
||||||
|
// The following is currently necessary for proper shutdown
|
||||||
|
// behaviour, but NOT enabled by default in order to make the
|
||||||
|
// bug reproducible...
|
||||||
|
// quirks |= kRequiresFlushBeforeShutdown;
|
||||||
}
|
}
|
||||||
if (!strncmp(componentName, "OMX.qcom.video.encoder.", 23)) {
|
if (!strncmp(componentName, "OMX.qcom.video.encoder.", 23)) {
|
||||||
quirks |= kRequiresLoadedToIdleAfterAllocation;
|
quirks |= kRequiresLoadedToIdleAfterAllocation;
|
||||||
@@ -1015,6 +1020,19 @@ void OMXCodec::onCmdComplete(OMX_COMMANDTYPE cmd, OMX_U32 data) {
|
|||||||
CHECK_EQ(portIndex, kPortIndexOutput);
|
CHECK_EQ(portIndex, kPortIndexOutput);
|
||||||
|
|
||||||
disablePortAsync(portIndex);
|
disablePortAsync(portIndex);
|
||||||
|
} else if (mState == EXECUTING_TO_IDLE) {
|
||||||
|
if (mPortStatus[kPortIndexInput] == ENABLED
|
||||||
|
&& mPortStatus[kPortIndexOutput] == ENABLED) {
|
||||||
|
LOGV("Finished flushing both ports, now completing "
|
||||||
|
"transition from EXECUTING to IDLE.");
|
||||||
|
|
||||||
|
mPortStatus[kPortIndexInput] = SHUTTING_DOWN;
|
||||||
|
mPortStatus[kPortIndexOutput] = SHUTTING_DOWN;
|
||||||
|
|
||||||
|
status_t err =
|
||||||
|
mOMX->send_command(mNode, OMX_CommandStateSet, OMX_StateIdle);
|
||||||
|
CHECK_EQ(err, OK);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// We're flushing both ports in preparation for seeking.
|
// We're flushing both ports in preparation for seeking.
|
||||||
|
|
||||||
@@ -1180,7 +1198,8 @@ void OMXCodec::onPortSettingsChanged(OMX_U32 portIndex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OMXCodec::flushPortAsync(OMX_U32 portIndex) {
|
bool OMXCodec::flushPortAsync(OMX_U32 portIndex) {
|
||||||
CHECK(mState == EXECUTING || mState == RECONFIGURING);
|
CHECK(mState == EXECUTING || mState == RECONFIGURING
|
||||||
|
|| mState == EXECUTING_TO_IDLE);
|
||||||
|
|
||||||
LOGV("flushPortAsync(%ld): we own %d out of %d buffers already.",
|
LOGV("flushPortAsync(%ld): we own %d out of %d buffers already.",
|
||||||
portIndex, countBuffersWeOwn(mPortBuffers[portIndex]),
|
portIndex, countBuffersWeOwn(mPortBuffers[portIndex]),
|
||||||
@@ -1625,12 +1644,31 @@ status_t OMXCodec::stop() {
|
|||||||
{
|
{
|
||||||
setState(EXECUTING_TO_IDLE);
|
setState(EXECUTING_TO_IDLE);
|
||||||
|
|
||||||
mPortStatus[kPortIndexInput] = SHUTTING_DOWN;
|
if (mQuirks & kRequiresFlushBeforeShutdown) {
|
||||||
mPortStatus[kPortIndexOutput] = SHUTTING_DOWN;
|
LOGV("This component requires a flush before transitioning "
|
||||||
|
"from EXECUTING to IDLE...");
|
||||||
|
|
||||||
status_t err =
|
bool emulateInputFlushCompletion =
|
||||||
mOMX->send_command(mNode, OMX_CommandStateSet, OMX_StateIdle);
|
!flushPortAsync(kPortIndexInput);
|
||||||
CHECK_EQ(err, OK);
|
|
||||||
|
bool emulateOutputFlushCompletion =
|
||||||
|
!flushPortAsync(kPortIndexOutput);
|
||||||
|
|
||||||
|
if (emulateInputFlushCompletion) {
|
||||||
|
onCmdComplete(OMX_CommandFlush, kPortIndexInput);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (emulateOutputFlushCompletion) {
|
||||||
|
onCmdComplete(OMX_CommandFlush, kPortIndexOutput);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
mPortStatus[kPortIndexInput] = SHUTTING_DOWN;
|
||||||
|
mPortStatus[kPortIndexOutput] = SHUTTING_DOWN;
|
||||||
|
|
||||||
|
status_t err =
|
||||||
|
mOMX->send_command(mNode, OMX_CommandStateSet, OMX_StateIdle);
|
||||||
|
CHECK_EQ(err, OK);
|
||||||
|
}
|
||||||
|
|
||||||
while (mState != LOADED && mState != ERROR) {
|
while (mState != LOADED && mState != ERROR) {
|
||||||
mAsyncCompletion.wait(mLock);
|
mAsyncCompletion.wait(mLock);
|
||||||
|
|||||||
Reference in New Issue
Block a user