Fix status error to avoid releasing component twice
When flush action is stuck, component will be released,
and state will be changed to RELEASED.
Then flush completed or returned error, and state will be
changed to FLUSHED.
When shutdown, release is called again, and exception happens.
Solution: Change state to FLUSHED only when it is FLUSHING
Bug: 136790747
Test: It is a seldom issue, and only happens when flush action
is stuck. We test this patch by modifying code to make flush
time more than 3s.
Change-Id: I74cb2599a9e029332d600469f38630651d9f43c0
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index c78cdc1..31e5406 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1524,7 +1524,9 @@
{
Mutexed<State>::Locked state(mState);
- state->set(FLUSHED);
+ if (state->get() == FLUSHING) {
+ state->set(FLUSHED);
+ }
}
mCallback->onFlushCompleted();
}