From 21aaee86e742428ba99346fb51ad7f4e49f340cb Mon Sep 17 00:00:00 2001
From: Atsushi Eno <atsushieno@gmail.com>
Date: Sun, 28 Apr 2024 00:25:24 +0900
Subject: [PATCH] [manager] OboeAudioDevice::stopCallback() should clean up
 stream.

This seems to fix the instancing issue at https://github.com/atsushieno/aap-core/issues/199#issuecomment-2080429725
---
 .../src/main/cpp/OboeAudioDeviceManager.cpp                      | 1 +
 1 file changed, 1 insertion(+)

diff --git a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp
index 5ab671f7..cd21b7b0 100644
--- a/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp
+++ b/androidaudioplugin-manager/src/main/cpp/OboeAudioDeviceManager.cpp
@@ -143,6 +143,7 @@ void aap::OboeAudioDevice::stopCallback() {
     oboe::Result result = stream->stop();
     if (result != oboe::Result::OK)
         throw std::runtime_error(std::string{"Failed to stop Oboe stream: "} + oboe::convertToText(result));
+    stream = nullptr;
 }
 
 oboe::DataCallbackResult