codec2: do not request VDA reset again before previous one is done
If stop() is called right after flush() (before flush done callback from VDA),
it should prevent to call VDA->reset() twice.
Bug: 73261432
Test: CtsMediaTestCases android.media.cts.MediaPlayerTest#testLocalVideo_MP4_H264_480x360_1000kbps_25fps_AAC_Stereo_128kbps_44110Hz
Change-Id: If063e53816f6bf82213aba0d07f7012996957b42
diff --git a/C2VDAComponent.cpp b/C2VDAComponent.cpp
index 35cf4eb..a8f69c4 100644
--- a/C2VDAComponent.cpp
+++ b/C2VDAComponent.cpp
@@ -790,7 +790,12 @@
ALOGV("onStop");
EXPECT_RUNNING_OR_RETURN_ON_ERROR();
- mVDAAdaptor->reset();
+ // Do not request VDA reset again before the previous one is done. If reset is already sent by
+ // onFlush(), just regard the following NotifyResetDone callback as for stopping.
+ if (mComponentState != ComponentState::FLUSHING) {
+ mVDAAdaptor->reset();
+ }
+
// Pop all works in mQueue and put into mPendingWorks.
while (!mQueue.empty()) {
mPendingWorks.emplace_back(std::move(mQueue.front().mWork));