aaudio: use xruns detected in the service
The service knows when an actual xrun occurs so we pass
that value to the client.
Bug: 38512417
Test: write_sine_callback -pl -n1 -s20 -c2 -u
Change-Id: I9e5ff1edd2e9378957309280162d7cda855f5adb
diff --git a/services/oboeservice/AAudioServiceStreamBase.h b/services/oboeservice/AAudioServiceStreamBase.h
index af435b4..29987f6 100644
--- a/services/oboeservice/AAudioServiceStreamBase.h
+++ b/services/oboeservice/AAudioServiceStreamBase.h
@@ -129,11 +129,15 @@
// -------------------------------------------------------------------
/**
- * Send a message to the client.
+ * Send a message to the client with an int64_t data value.
*/
aaudio_result_t sendServiceEvent(aaudio_service_event_t event,
- double dataDouble = 0.0,
int64_t dataLong = 0);
+ /**
+ * Send a message to the client with an double data value.
+ */
+ aaudio_result_t sendServiceEvent(aaudio_service_event_t event,
+ double dataDouble);
/**
* Fill in a parcelable description of stream.
@@ -182,6 +186,19 @@
void onVolumeChanged(float volume);
+ /**
+ * Set false when the stream is started.
+ * Set true when data is first read from the stream.
+ * @param b
+ */
+ void setFlowing(bool b) {
+ mFlowing = b;
+ }
+
+ bool isFlowing() const {
+ return mFlowing;
+ }
+
protected:
/**
@@ -204,6 +221,8 @@
aaudio_result_t sendCurrentTimestamp();
+ aaudio_result_t sendXRunCount(int32_t xRunCount);
+
/**
* @param positionFrames
* @param timeNanos
@@ -237,6 +256,8 @@
private:
aaudio_handle_t mHandle = -1;
+
+ bool mFlowing = false;
};
} /* namespace aaudio */