Release buffers on MediaCodec#stop()
Release all buffers on Codec2 stop() in order to quick release in case
of using multiple Codec's from application.
Bug: 146679370
Test: atest CtsMediaTestCases -- --module-arg CtsMediaTestCases:size:small
Change-Id: I7a025c2d349442f93dbfab0bd1892df46229ef56
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 01d106f..1e4560c 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -1406,6 +1406,9 @@
// TODO: convert err into status_t
mCallback->onError(UNKNOWN_ERROR, ACTION_CODE_FATAL);
}
+ // Assure buffers are not owned when stop() was called without flush().
+ std::list<std::unique_ptr<C2Work>> flushedWork;
+ mChannel->flush(flushedWork);
{
Mutexed<std::unique_ptr<Config>>::Locked configLocked(mConfig);