Merge pull request #70 from google/getstream
oboe: add debug method for getting AAudioStream
diff --git a/include/oboe/AudioStream.h b/include/oboe/AudioStream.h
index f1565ae..8317ad4 100644
--- a/include/oboe/AudioStream.h
+++ b/include/oboe/AudioStream.h
@@ -200,6 +200,18 @@
return getAudioApi() == AudioApi::AAudio;
}
+ /**
+ * Do not use this for production. This is only for debugging.
+ * If you need to call this method then something is wrong.
+ * If you think you need it for production then please let us know
+ * so we can modify Oboe so that you don't need this.
+ *
+ * @return nullptr or a pointer to a stream from the system API
+ */
+ virtual void *getUnderlyingStream() const {
+ return nullptr;
+ }
+
protected:
virtual int64_t incrementFramesWritten(int32_t frames) {
diff --git a/src/aaudio/AudioStreamAAudio.h b/src/aaudio/AudioStreamAAudio.h
index 51ded91..caf53c1 100644
--- a/src/aaudio/AudioStreamAAudio.h
+++ b/src/aaudio/AudioStreamAAudio.h
@@ -91,7 +91,6 @@
return AudioApi::AAudio;
}
-public:
DataCallbackResult callOnAudioReady(AAudioStream *stream,
void *audioData,
int32_t numFrames);
@@ -100,6 +99,11 @@
void onErrorInThread(AAudioStream *stream, Result error);
+
+ void *getUnderlyingStream() const override {
+ return mAAudioStream.load();
+ }
+
protected:
Result convertApplicationDataToNative(int32_t numFrames); // TODO remove?