CCodec: Delay stop using surface until the end of stop()
Delay stop using surface until the end of stop() in order not to
interface internal Codec work.
Bug: 227223204
Test: atest android.media.codec.cts.MediaCodecTest
Test: atest android.media.decoder.cts.AdaptivePlaybackTest
Change-Id: I3d12869e51ecee7c01a796c54f9fd26b0ed8e712
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 296d7ed..43bdb21 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1899,6 +1899,7 @@
comp = state->comp;
}
status_t err = comp->stop();
+ mChannel->stopUseOutputSurface();
if (err != C2_OK) {
// TODO: convert err into status_t
mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL);
@@ -1972,6 +1973,7 @@
}
mChannel->reset();
+ mChannel->stopUseOutputSurface();
// thiz holds strong ref to this while the thread is running.
sp<CCodec> thiz(this);
std::thread([thiz, sendCallback] { thiz->release(sendCallback); }).detach();