mirror of
https://github.com/WiVRn/WiVRn.git
synced 2026-11-20 00:51:32 -08:00
Free mediacodec resources on stream quit
This commit is contained in:
1 parent
dfa74c2f98
commit
62d74db3dc
1 file changed
+9
@@ -253,6 +253,8 @@ decoder::decoder(
|
||||
try
|
||||
{
|
||||
auto index = output_buffers.pop();
|
||||
if (index == -1)
|
||||
return;
|
||||
auto status = AMediaCodec_releaseOutputBuffer(media_codec.get(), index, true);
|
||||
// will trigger on_image_available through ImageReader
|
||||
if (status != AMEDIA_OK)
|
||||
@@ -273,6 +275,13 @@ decoder::decoder(
|
||||
|
||||
decoder::~decoder()
|
||||
{
|
||||
if (media_codec)
|
||||
{
|
||||
AMediaCodec_stop(media_codec.get());
|
||||
output_buffers.push(-1);
|
||||
if (output_releaser.joinable())
|
||||
output_releaser.join();
|
||||
}
|
||||
input_buffers.close();
|
||||
output_buffers.close();
|
||||
|
||||
|
||||
Reference in new issue
Block a user