liboboe: rename Oboe to AAudio

All of the edits were done using scripts in media/liboboe/scripts.
The conversion is done using SED, which is called from
convert_oboe_aaudio.sh
The conversion can be reverted when debugging using revert_all_aaudio.sh
The string substitutions are in oboe_to_aaudio.sed

Bug: 34749573
Test: cts/tests/tests/nativemedia/aaudio

Change-Id: Ia10b34472a90df2652b87607c99156e9084e57aa
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/liboboe/src/client/AudioEndpoint.cpp b/media/liboboe/src/client/AudioEndpoint.cpp
index 160c37e..5cd9782 100644
--- a/media/liboboe/src/client/AudioEndpoint.cpp
+++ b/media/liboboe/src/client/AudioEndpoint.cpp
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <cassert>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "AudioEndpointParcelable.h"
 #include "AudioEndpoint.h"
-#include "OboeServiceMessage.h"
+#include "AAudioServiceMessage.h"
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 AudioEndpoint::AudioEndpoint()
     : mOutputFreeRunning(false)
@@ -80,13 +80,13 @@
     AudioEndpoint_validateQueueDescriptor("data", &pEndpointDescriptor->downDataQueueDescriptor);
 }
 
-oboe_result_t AudioEndpoint::configure(const EndpointDescriptor *pEndpointDescriptor)
+aaudio_result_t AudioEndpoint::configure(const EndpointDescriptor *pEndpointDescriptor)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
     AudioEndpoint_validateDescriptor(pEndpointDescriptor); // FIXME remove after debugging
 
     const RingBufferDescriptor *descriptor = &pEndpointDescriptor->upMessageQueueDescriptor;
-    assert(descriptor->bytesPerFrame == sizeof(OboeServiceMessage));
+    assert(descriptor->bytesPerFrame == sizeof(AAudioServiceMessage));
     assert(descriptor->readCounterAddress != nullptr);
     assert(descriptor->writeCounterAddress != nullptr);
     mUpCommandQueue = new FifoBuffer(
@@ -137,12 +137,12 @@
     return result;
 }
 
-oboe_result_t AudioEndpoint::readUpCommand(OboeServiceMessage *commandPtr)
+aaudio_result_t AudioEndpoint::readUpCommand(AAudioServiceMessage *commandPtr)
 {
     return mUpCommandQueue->read(commandPtr, 1);
 }
 
-oboe_result_t AudioEndpoint::writeDataNow(const void *buffer, int32_t numFrames)
+aaudio_result_t AudioEndpoint::writeDataNow(const void *buffer, int32_t numFrames)
 {
     return mDownDataQueue->write(buffer, numFrames);
 }
@@ -167,15 +167,15 @@
     return mDownDataQueue->getWriteCounter();
 }
 
-oboe_size_frames_t AudioEndpoint::setBufferSizeInFrames(oboe_size_frames_t requestedFrames,
-                                            oboe_size_frames_t *actualFrames)
+aaudio_size_frames_t AudioEndpoint::setBufferSizeInFrames(aaudio_size_frames_t requestedFrames,
+                                            aaudio_size_frames_t *actualFrames)
 {
     if (requestedFrames < ENDPOINT_DATA_QUEUE_SIZE_MIN) {
         requestedFrames = ENDPOINT_DATA_QUEUE_SIZE_MIN;
     }
     mDownDataQueue->setThreshold(requestedFrames);
     *actualFrames = mDownDataQueue->getThreshold();
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
 int32_t AudioEndpoint::getBufferSizeInFrames() const
diff --git a/media/liboboe/src/client/AudioEndpoint.h b/media/liboboe/src/client/AudioEndpoint.h
index 6ae8b72..e786513 100644
--- a/media/liboboe/src/client/AudioEndpoint.h
+++ b/media/liboboe/src/client/AudioEndpoint.h
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIO_ENDPOINT_H
-#define OBOE_AUDIO_ENDPOINT_H
+#ifndef AAUDIO_AUDIO_ENDPOINT_H
+#define AAUDIO_AUDIO_ENDPOINT_H
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-#include "OboeServiceMessage.h"
+#include "AAudioServiceMessage.h"
 #include "AudioEndpointParcelable.h"
 #include "fifo/FifoBuffer.h"
 
-namespace oboe {
+namespace aaudio {
 
 #define ENDPOINT_DATA_QUEUE_SIZE_MIN   64
 
@@ -40,19 +40,19 @@
     /**
      * Configure based on the EndPointDescriptor_t.
      */
-    oboe_result_t configure(const EndpointDescriptor *pEndpointDescriptor);
+    aaudio_result_t configure(const EndpointDescriptor *pEndpointDescriptor);
 
     /**
      * Read from a command passed up from the Server.
      * @return 1 if command received, 0 for no command, or negative error.
      */
-    oboe_result_t readUpCommand(OboeServiceMessage *commandPtr);
+    aaudio_result_t readUpCommand(AAudioServiceMessage *commandPtr);
 
     /**
      * Non-blocking write.
      * @return framesWritten or a negative error code.
      */
-    oboe_result_t writeDataNow(const void *buffer, int32_t numFrames);
+    aaudio_result_t writeDataNow(const void *buffer, int32_t numFrames);
 
     /**
      * Set the read index in the downData queue.
@@ -71,13 +71,13 @@
      */
     bool isOutputFreeRunning() const { return mOutputFreeRunning; }
 
-    int32_t setBufferSizeInFrames(oboe_size_frames_t requestedFrames,
-                                  oboe_size_frames_t *actualFrames);
-    oboe_size_frames_t getBufferSizeInFrames() const;
+    int32_t setBufferSizeInFrames(aaudio_size_frames_t requestedFrames,
+                                  aaudio_size_frames_t *actualFrames);
+    aaudio_size_frames_t getBufferSizeInFrames() const;
 
-    oboe_size_frames_t getBufferCapacityInFrames() const;
+    aaudio_size_frames_t getBufferCapacityInFrames() const;
 
-    oboe_size_frames_t getFullFramesAvailable();
+    aaudio_size_frames_t getFullFramesAvailable();
 
 private:
     FifoBuffer   * mUpCommandQueue;
@@ -87,6 +87,6 @@
     fifo_counter_t mDataWriteCounter; // only used if free-running
 };
 
-} // namespace oboe
+} // namespace aaudio
 
-#endif //OBOE_AUDIO_ENDPOINT_H
+#endif //AAUDIO_AUDIO_ENDPOINT_H
diff --git a/media/liboboe/src/client/AudioStreamInternal.cpp b/media/liboboe/src/client/AudioStreamInternal.cpp
index dc6fe90..8d7e93f 100644
--- a/media/liboboe/src/client/AudioStreamInternal.cpp
+++ b/media/liboboe/src/client/AudioStreamInternal.cpp
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
@@ -24,14 +24,14 @@
 #include <binder/IServiceManager.h>
 #include <utils/Mutex.h>
 
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
 #include "AudioClock.h"
 #include "AudioEndpointParcelable.h"
-#include "binding/OboeStreamRequest.h"
-#include "binding/OboeStreamConfiguration.h"
-#include "binding/IOboeAudioService.h"
-#include "binding/OboeServiceMessage.h"
+#include "binding/AAudioStreamRequest.h"
+#include "binding/AAudioStreamConfiguration.h"
+#include "binding/IAAudioService.h"
+#include "binding/AAudioServiceMessage.h"
 
 #include "AudioStreamInternal.h"
 
@@ -43,24 +43,24 @@
 using android::interface_cast;
 using android::Mutex;
 
-using namespace oboe;
+using namespace aaudio;
 
 static android::Mutex gServiceLock;
-static sp<IOboeAudioService>  gOboeService;
+static sp<IAAudioService>  gAAudioService;
 
-#define OBOE_SERVICE_NAME   "OboeAudioService"
+#define AAUDIO_SERVICE_NAME   "AAudioService"
 
-// Helper function to get access to the "OboeAudioService" service.
+// Helper function to get access to the "AAudioService" service.
 // This code was modeled after frameworks/av/media/libaudioclient/AudioSystem.cpp
-static const sp<IOboeAudioService> getOboeAudioService() {
+static const sp<IAAudioService> getAAudioService() {
     sp<IBinder> binder;
     Mutex::Autolock _l(gServiceLock);
-    if (gOboeService == 0) {
+    if (gAAudioService == 0) {
         sp<IServiceManager> sm = defaultServiceManager();
         // Try several times to get the service.
         int retries = 4;
         do {
-            binder = sm->getService(String16(OBOE_SERVICE_NAME)); // This will wait a while.
+            binder = sm->getService(String16(AAUDIO_SERVICE_NAME)); // This will wait a while.
             if (binder != 0) {
                 break;
             }
@@ -69,19 +69,19 @@
         if (binder != 0) {
             // TODO Add linkToDeath() like in frameworks/av/media/libaudioclient/AudioSystem.cpp
             // TODO Create a DeathRecipient that disconnects all active streams.
-            gOboeService = interface_cast<IOboeAudioService>(binder);
+            gAAudioService = interface_cast<IAAudioService>(binder);
         } else {
-            ALOGE("AudioStreamInternal could not get %s", OBOE_SERVICE_NAME);
+            ALOGE("AudioStreamInternal could not get %s", AAUDIO_SERVICE_NAME);
         }
     }
-    return gOboeService;
+    return gAAudioService;
 }
 
 AudioStreamInternal::AudioStreamInternal()
         : AudioStream()
         , mClockModel()
         , mAudioEndpoint()
-        , mServiceStreamHandle(OBOE_HANDLE_INVALID)
+        , mServiceStreamHandle(AAUDIO_HANDLE_INVALID)
         , mFramesPerBurst(16)
 {
 }
@@ -89,14 +89,14 @@
 AudioStreamInternal::~AudioStreamInternal() {
 }
 
-oboe_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
+aaudio_result_t AudioStreamInternal::open(const AudioStreamBuilder &builder) {
 
-    const sp<IOboeAudioService>& service = getOboeAudioService();
-    if (service == 0) return OBOE_ERROR_NO_SERVICE;
+    const sp<IAAudioService>& service = getAAudioService();
+    if (service == 0) return AAUDIO_ERROR_NO_SERVICE;
 
-    oboe_result_t result = OBOE_OK;
-    OboeStreamRequest request;
-    OboeStreamConfiguration configuration;
+    aaudio_result_t result = AAUDIO_OK;
+    AAudioStreamRequest request;
+    AAudioStreamConfiguration configuration;
 
     result = AudioStream::open(builder);
     if (result < 0) {
@@ -117,10 +117,10 @@
          (unsigned int)mServiceStreamHandle);
     if (mServiceStreamHandle < 0) {
         result = mServiceStreamHandle;
-        ALOGE("AudioStreamInternal.open(): acquireRealtimeStream oboe_result_t = 0x%08X", result);
+        ALOGE("AudioStreamInternal.open(): acquireRealtimeStream aaudio_result_t = 0x%08X", result);
     } else {
         result = configuration.validate();
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             close();
             return result;
         }
@@ -129,9 +129,9 @@
         setSamplesPerFrame(configuration.getSamplesPerFrame());
         setFormat(configuration.getAudioFormat());
 
-        oboe::AudioEndpointParcelable parcelable;
+        aaudio::AudioEndpointParcelable parcelable;
         result = service->getStreamDescription(mServiceStreamHandle, parcelable);
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             ALOGE("AudioStreamInternal.open(): getStreamDescriptor returns %d", result);
             service->closeStream(mServiceStreamHandle);
             return result;
@@ -150,143 +150,143 @@
         mClockModel.setSampleRate(getSampleRate());
         mClockModel.setFramesPerBurst(mFramesPerBurst);
 
-        setState(OBOE_STREAM_STATE_OPEN);
+        setState(AAUDIO_STREAM_STATE_OPEN);
     }
     return result;
 }
 
-oboe_result_t AudioStreamInternal::close() {
+aaudio_result_t AudioStreamInternal::close() {
     ALOGD("AudioStreamInternal.close(): mServiceStreamHandle = 0x%08X", mServiceStreamHandle);
-    if (mServiceStreamHandle != OBOE_HANDLE_INVALID) {
-        oboe_handle_t serviceStreamHandle = mServiceStreamHandle;
-        mServiceStreamHandle = OBOE_HANDLE_INVALID;
-        const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-        if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-        oboeService->closeStream(serviceStreamHandle);
-        return OBOE_OK;
+    if (mServiceStreamHandle != AAUDIO_HANDLE_INVALID) {
+        aaudio_handle_t serviceStreamHandle = mServiceStreamHandle;
+        mServiceStreamHandle = AAUDIO_HANDLE_INVALID;
+        const sp<IAAudioService>& aaudioService = getAAudioService();
+        if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+        aaudioService->closeStream(serviceStreamHandle);
+        return AAUDIO_OK;
     } else {
-        return OBOE_ERROR_INVALID_HANDLE;
+        return AAUDIO_ERROR_INVALID_HANDLE;
     }
 }
 
-oboe_result_t AudioStreamInternal::requestStart()
+aaudio_result_t AudioStreamInternal::requestStart()
 {
-    oboe_nanoseconds_t startTime;
+    aaudio_nanoseconds_t startTime;
     ALOGD("AudioStreamInternal(): start()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    startTime = Oboe_getNanoseconds(OBOE_CLOCK_MONOTONIC);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    startTime = AAudio_getNanoseconds(AAUDIO_CLOCK_MONOTONIC);
     mClockModel.start(startTime);
     processTimestamp(0, startTime);
-    setState(OBOE_STREAM_STATE_STARTING);
-    return oboeService->startStream(mServiceStreamHandle);
+    setState(AAUDIO_STREAM_STATE_STARTING);
+    return aaudioService->startStream(mServiceStreamHandle);
 }
 
-oboe_result_t AudioStreamInternal::requestPause()
+aaudio_result_t AudioStreamInternal::requestPause()
 {
     ALOGD("AudioStreamInternal(): pause()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    mClockModel.stop(Oboe_getNanoseconds(OBOE_CLOCK_MONOTONIC));
-    setState(OBOE_STREAM_STATE_PAUSING);
-    return oboeService->pauseStream(mServiceStreamHandle);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    mClockModel.stop(AAudio_getNanoseconds(AAUDIO_CLOCK_MONOTONIC));
+    setState(AAUDIO_STREAM_STATE_PAUSING);
+    return aaudioService->pauseStream(mServiceStreamHandle);
 }
 
-oboe_result_t AudioStreamInternal::requestFlush() {
+aaudio_result_t AudioStreamInternal::requestFlush() {
     ALOGD("AudioStreamInternal(): flush()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-setState(OBOE_STREAM_STATE_FLUSHING);
-    return oboeService->flushStream(mServiceStreamHandle);
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+setState(AAUDIO_STREAM_STATE_FLUSHING);
+    return aaudioService->flushStream(mServiceStreamHandle);
 }
 
 void AudioStreamInternal::onFlushFromServer() {
     ALOGD("AudioStreamInternal(): onFlushFromServer()");
-    oboe_position_frames_t readCounter = mAudioEndpoint.getDownDataReadCounter();
-    oboe_position_frames_t writeCounter = mAudioEndpoint.getDownDataWriteCounter();
+    aaudio_position_frames_t readCounter = mAudioEndpoint.getDownDataReadCounter();
+    aaudio_position_frames_t writeCounter = mAudioEndpoint.getDownDataWriteCounter();
     // Bump offset so caller does not see the retrograde motion in getFramesRead().
-    oboe_position_frames_t framesFlushed = writeCounter - readCounter;
+    aaudio_position_frames_t framesFlushed = writeCounter - readCounter;
     mFramesOffsetFromService += framesFlushed;
     // Flush written frames by forcing writeCounter to readCounter.
     // This is because we cannot move the read counter in the hardware.
     mAudioEndpoint.setDownDataWriteCounter(readCounter);
 }
 
-oboe_result_t AudioStreamInternal::requestStop()
+aaudio_result_t AudioStreamInternal::requestStop()
 {
     // TODO better implementation of requestStop()
-    oboe_result_t result = requestPause();
-    if (result == OBOE_OK) {
-        oboe_stream_state_t state;
-        result = waitForStateChange(OBOE_STREAM_STATE_PAUSING,
+    aaudio_result_t result = requestPause();
+    if (result == AAUDIO_OK) {
+        aaudio_stream_state_t state;
+        result = waitForStateChange(AAUDIO_STREAM_STATE_PAUSING,
                                     &state,
-                                    500 * OBOE_NANOS_PER_MILLISECOND);// TODO temporary code
-        if (result == OBOE_OK) {
+                                    500 * AAUDIO_NANOS_PER_MILLISECOND);// TODO temporary code
+        if (result == AAUDIO_OK) {
             result = requestFlush();
         }
     }
     return result;
 }
 
-oboe_result_t AudioStreamInternal::registerThread() {
+aaudio_result_t AudioStreamInternal::registerThread() {
     ALOGD("AudioStreamInternal(): registerThread()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    return oboeService->registerAudioThread(mServiceStreamHandle,
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    return aaudioService->registerAudioThread(mServiceStreamHandle,
                                          gettid(),
                                          getPeriodNanoseconds());
 }
 
-oboe_result_t AudioStreamInternal::unregisterThread() {
+aaudio_result_t AudioStreamInternal::unregisterThread() {
     ALOGD("AudioStreamInternal(): unregisterThread()");
-    if (mServiceStreamHandle == OBOE_HANDLE_INVALID) {
-        return OBOE_ERROR_INVALID_STATE;
+    if (mServiceStreamHandle == AAUDIO_HANDLE_INVALID) {
+        return AAUDIO_ERROR_INVALID_STATE;
     }
-    const sp<IOboeAudioService>& oboeService = getOboeAudioService();
-    if (oboeService == 0) return OBOE_ERROR_NO_SERVICE;
-    return oboeService->unregisterAudioThread(mServiceStreamHandle, gettid());
+    const sp<IAAudioService>& aaudioService = getAAudioService();
+    if (aaudioService == 0) return AAUDIO_ERROR_NO_SERVICE;
+    return aaudioService->unregisterAudioThread(mServiceStreamHandle, gettid());
 }
 
-// TODO use oboe_clockid_t all the way down to AudioClock
-oboe_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,
-                           oboe_position_frames_t *framePosition,
-                           oboe_nanoseconds_t *timeNanoseconds) {
+// TODO use aaudio_clockid_t all the way down to AudioClock
+aaudio_result_t AudioStreamInternal::getTimestamp(clockid_t clockId,
+                           aaudio_position_frames_t *framePosition,
+                           aaudio_nanoseconds_t *timeNanoseconds) {
 // TODO implement using real HAL
-    oboe_nanoseconds_t time = AudioClock::getNanoseconds();
+    aaudio_nanoseconds_t time = AudioClock::getNanoseconds();
     *framePosition = mClockModel.convertTimeToPosition(time);
-    *timeNanoseconds = time + (10 * OBOE_NANOS_PER_MILLISECOND); // Fake hardware delay
-    return OBOE_OK;
+    *timeNanoseconds = time + (10 * AAUDIO_NANOS_PER_MILLISECOND); // Fake hardware delay
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamInternal::updateState() {
+aaudio_result_t AudioStreamInternal::updateState() {
     return processCommands();
 }
 
 #if LOG_TIMESTAMPS
-static void AudioStreamInternal_LogTimestamp(OboeServiceMessage &command) {
+static void AudioStreamInternal_LogTimestamp(AAudioServiceMessage &command) {
     static int64_t oldPosition = 0;
-    static oboe_nanoseconds_t oldTime = 0;
+    static aaudio_nanoseconds_t oldTime = 0;
     int64_t framePosition = command.timestamp.position;
-    oboe_nanoseconds_t nanoTime = command.timestamp.timestamp;
+    aaudio_nanoseconds_t nanoTime = command.timestamp.timestamp;
     ALOGD("AudioStreamInternal() timestamp says framePosition = %08lld at nanoTime %llu",
          (long long) framePosition,
          (long long) nanoTime);
     int64_t nanosDelta = nanoTime - oldTime;
     if (nanosDelta > 0 && oldTime > 0) {
         int64_t framesDelta = framePosition - oldPosition;
-        int64_t rate = (framesDelta * OBOE_NANOS_PER_SECOND) / nanosDelta;
+        int64_t rate = (framesDelta * AAUDIO_NANOS_PER_SECOND) / nanosDelta;
         ALOGD("AudioStreamInternal() - framesDelta = %08lld", (long long) framesDelta);
         ALOGD("AudioStreamInternal() - nanosDelta = %08lld", (long long) nanosDelta);
         ALOGD("AudioStreamInternal() - measured rate = %llu", (unsigned long long) rate);
@@ -296,40 +296,40 @@
 }
 #endif
 
-oboe_result_t AudioStreamInternal::onTimestampFromServer(OboeServiceMessage *message) {
-    oboe_position_frames_t framePosition = 0;
+aaudio_result_t AudioStreamInternal::onTimestampFromServer(AAudioServiceMessage *message) {
+    aaudio_position_frames_t framePosition = 0;
 #if LOG_TIMESTAMPS
     AudioStreamInternal_LogTimestamp(command);
 #endif
     framePosition = message->timestamp.position;
     processTimestamp(framePosition, message->timestamp.timestamp);
-    return OBOE_OK;
+    return AAUDIO_OK;
 }
 
-oboe_result_t AudioStreamInternal::onEventFromServer(OboeServiceMessage *message) {
-    oboe_result_t result = OBOE_OK;
+aaudio_result_t AudioStreamInternal::onEventFromServer(AAudioServiceMessage *message) {
+    aaudio_result_t result = AAUDIO_OK;
     ALOGD("processCommands() got event %d", message->event.event);
     switch (message->event.event) {
-        case OBOE_SERVICE_EVENT_STARTED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_STARTED");
-            setState(OBOE_STREAM_STATE_STARTED);
+        case AAUDIO_SERVICE_EVENT_STARTED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_STARTED");
+            setState(AAUDIO_STREAM_STATE_STARTED);
             break;
-        case OBOE_SERVICE_EVENT_PAUSED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_PAUSED");
-            setState(OBOE_STREAM_STATE_PAUSED);
+        case AAUDIO_SERVICE_EVENT_PAUSED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_PAUSED");
+            setState(AAUDIO_STREAM_STATE_PAUSED);
             break;
-        case OBOE_SERVICE_EVENT_FLUSHED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_FLUSHED");
-            setState(OBOE_STREAM_STATE_FLUSHED);
+        case AAUDIO_SERVICE_EVENT_FLUSHED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_FLUSHED");
+            setState(AAUDIO_STREAM_STATE_FLUSHED);
             onFlushFromServer();
             break;
-        case OBOE_SERVICE_EVENT_CLOSED:
-            ALOGD("processCommands() got OBOE_SERVICE_EVENT_CLOSED");
-            setState(OBOE_STREAM_STATE_CLOSED);
+        case AAUDIO_SERVICE_EVENT_CLOSED:
+            ALOGD("processCommands() got AAUDIO_SERVICE_EVENT_CLOSED");
+            setState(AAUDIO_STREAM_STATE_CLOSED);
             break;
-        case OBOE_SERVICE_EVENT_DISCONNECTED:
-            result = OBOE_ERROR_DISCONNECTED;
-            ALOGW("WARNING - processCommands() OBOE_SERVICE_EVENT_DISCONNECTED");
+        case AAUDIO_SERVICE_EVENT_DISCONNECTED:
+            result = AAUDIO_ERROR_DISCONNECTED;
+            ALOGW("WARNING - processCommands() AAUDIO_SERVICE_EVENT_DISCONNECTED");
             break;
         default:
             ALOGW("WARNING - processCommands() Unrecognized event = %d",
@@ -340,27 +340,27 @@
 }
 
 // Process all the commands coming from the server.
-oboe_result_t AudioStreamInternal::processCommands() {
-    oboe_result_t result = OBOE_OK;
+aaudio_result_t AudioStreamInternal::processCommands() {
+    aaudio_result_t result = AAUDIO_OK;
 
-    while (result == OBOE_OK) {
-        OboeServiceMessage message;
+    while (result == AAUDIO_OK) {
+        AAudioServiceMessage message;
         if (mAudioEndpoint.readUpCommand(&message) != 1) {
             break; // no command this time, no problem
         }
         switch (message.what) {
-        case OboeServiceMessage::code::TIMESTAMP:
+        case AAudioServiceMessage::code::TIMESTAMP:
             result = onTimestampFromServer(&message);
             break;
 
-        case OboeServiceMessage::code::EVENT:
+        case AAudioServiceMessage::code::EVENT:
             result = onEventFromServer(&message);
             break;
 
         default:
             ALOGW("WARNING - AudioStreamInternal::processCommands() Unrecognized what = %d",
                  (int) message.what);
-            result = OBOE_ERROR_UNEXPECTED_VALUE;
+            result = AAUDIO_ERROR_UNEXPECTED_VALUE;
             break;
         }
     }
@@ -368,13 +368,13 @@
 }
 
 // Write the data, block if needed and timeoutMillis > 0
-oboe_result_t AudioStreamInternal::write(const void *buffer, int32_t numFrames,
-                                         oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamInternal::write(const void *buffer, int32_t numFrames,
+                                         aaudio_nanoseconds_t timeoutNanoseconds)
 {
-    oboe_result_t result = OBOE_OK;
+    aaudio_result_t result = AAUDIO_OK;
     uint8_t* source = (uint8_t*)buffer;
-    oboe_nanoseconds_t currentTimeNanos = AudioClock::getNanoseconds();
-    oboe_nanoseconds_t deadlineNanos = currentTimeNanos + timeoutNanoseconds;
+    aaudio_nanoseconds_t currentTimeNanos = AudioClock::getNanoseconds();
+    aaudio_nanoseconds_t deadlineNanos = currentTimeNanos + timeoutNanoseconds;
     int32_t framesLeft = numFrames;
 //    ALOGD("AudioStreamInternal::write(%p, %d) at time %08llu , mState = %d ------------------",
 //         buffer, numFrames, (unsigned long long) currentTimeNanos, mState);
@@ -382,8 +382,8 @@
     // Write until all the data has been written or until a timeout occurs.
     while (framesLeft > 0) {
         // The call to writeNow() will not block. It will just write as much as it can.
-        oboe_nanoseconds_t wakeTimeNanos = 0;
-        oboe_result_t framesWritten = writeNow(source, framesLeft,
+        aaudio_nanoseconds_t wakeTimeNanos = 0;
+        aaudio_result_t framesWritten = writeNow(source, framesLeft,
                                                currentTimeNanos, &wakeTimeNanos);
 //        ALOGD("AudioStreamInternal::write() writeNow() framesLeft = %d --> framesWritten = %d", framesLeft, framesWritten);
         if (framesWritten < 0) {
@@ -420,11 +420,11 @@
 }
 
 // Write as much data as we can without blocking.
-oboe_result_t AudioStreamInternal::writeNow(const void *buffer, int32_t numFrames,
-                                         oboe_nanoseconds_t currentNanoTime, oboe_nanoseconds_t *wakeTimePtr) {
+aaudio_result_t AudioStreamInternal::writeNow(const void *buffer, int32_t numFrames,
+                                         aaudio_nanoseconds_t currentNanoTime, aaudio_nanoseconds_t *wakeTimePtr) {
     {
-        oboe_result_t result = processCommands();
-        if (result != OBOE_OK) {
+        aaudio_result_t result = processCommands();
+        if (result != AAUDIO_OK) {
             return result;
         }
     }
@@ -451,16 +451,16 @@
     // Calculate an ideal time to wake up.
     if (wakeTimePtr != nullptr && framesWritten >= 0) {
         // By default wake up a few milliseconds from now.  // TODO review
-        oboe_nanoseconds_t wakeTime = currentNanoTime + (2 * OBOE_NANOS_PER_MILLISECOND);
+        aaudio_nanoseconds_t wakeTime = currentNanoTime + (2 * AAUDIO_NANOS_PER_MILLISECOND);
         switch (getState()) {
-            case OBOE_STREAM_STATE_OPEN:
-            case OBOE_STREAM_STATE_STARTING:
+            case AAUDIO_STREAM_STATE_OPEN:
+            case AAUDIO_STREAM_STATE_STARTING:
                 if (framesWritten != 0) {
                     // Don't wait to write more data. Just prime the buffer.
                     wakeTime = currentNanoTime;
                 }
                 break;
-            case OBOE_STREAM_STATE_STARTED:   // When do we expect the next read burst to occur?
+            case AAUDIO_STREAM_STATE_STARTED:   // When do we expect the next read burst to occur?
                 {
                     uint32_t burstSize = mFramesPerBurst;
                     if (burstSize < 32) {
@@ -484,19 +484,19 @@
     return framesWritten;
 }
 
-oboe_result_t AudioStreamInternal::waitForStateChange(oboe_stream_state_t currentState,
-                                                      oboe_stream_state_t *nextState,
-                                                      oboe_nanoseconds_t timeoutNanoseconds)
+aaudio_result_t AudioStreamInternal::waitForStateChange(aaudio_stream_state_t currentState,
+                                                      aaudio_stream_state_t *nextState,
+                                                      aaudio_nanoseconds_t timeoutNanoseconds)
 
 {
-    oboe_result_t result = processCommands();
+    aaudio_result_t result = processCommands();
 //    ALOGD("AudioStreamInternal::waitForStateChange() - processCommands() returned %d", result);
-    if (result != OBOE_OK) {
+    if (result != AAUDIO_OK) {
         return result;
     }
     // TODO replace this polling with a timed sleep on a futex on the message queue
-    int32_t durationNanos = 5 * OBOE_NANOS_PER_MILLISECOND;
-    oboe_stream_state_t state = getState();
+    int32_t durationNanos = 5 * AAUDIO_NANOS_PER_MILLISECOND;
+    aaudio_stream_state_t state = getState();
 //    ALOGD("AudioStreamInternal::waitForStateChange() - state = %d", state);
     while (state == currentState && timeoutNanoseconds > 0) {
         // TODO use futex from service message queue
@@ -507,7 +507,7 @@
         timeoutNanoseconds -= durationNanos;
 
         result = processCommands();
-        if (result != OBOE_OK) {
+        if (result != AAUDIO_OK) {
             return result;
         }
 
@@ -517,37 +517,37 @@
     if (nextState != nullptr) {
         *nextState = state;
     }
-    return (state == currentState) ? OBOE_ERROR_TIMEOUT : OBOE_OK;
+    return (state == currentState) ? AAUDIO_ERROR_TIMEOUT : AAUDIO_OK;
 }
 
 
-void AudioStreamInternal::processTimestamp(uint64_t position, oboe_nanoseconds_t time) {
+void AudioStreamInternal::processTimestamp(uint64_t position, aaudio_nanoseconds_t time) {
     mClockModel.processTimestamp( position, time);
 }
 
-oboe_result_t AudioStreamInternal::setBufferSize(oboe_size_frames_t requestedFrames,
-                                        oboe_size_frames_t *actualFrames) {
+aaudio_result_t AudioStreamInternal::setBufferSize(aaudio_size_frames_t requestedFrames,
+                                        aaudio_size_frames_t *actualFrames) {
     return mAudioEndpoint.setBufferSizeInFrames(requestedFrames, actualFrames);
 }
 
-oboe_size_frames_t AudioStreamInternal::getBufferSize() const
+aaudio_size_frames_t AudioStreamInternal::getBufferSize() const
 {
     return mAudioEndpoint.getBufferSizeInFrames();
 }
 
-oboe_size_frames_t AudioStreamInternal::getBufferCapacity() const
+aaudio_size_frames_t AudioStreamInternal::getBufferCapacity() const
 {
     return mAudioEndpoint.getBufferCapacityInFrames();
 }
 
-oboe_size_frames_t AudioStreamInternal::getFramesPerBurst() const
+aaudio_size_frames_t AudioStreamInternal::getFramesPerBurst() const
 {
     return mEndpointDescriptor.downDataQueueDescriptor.framesPerBurst;
 }
 
-oboe_position_frames_t AudioStreamInternal::getFramesRead()
+aaudio_position_frames_t AudioStreamInternal::getFramesRead()
 {
-    oboe_position_frames_t framesRead =
+    aaudio_position_frames_t framesRead =
             mClockModel.convertTimeToPosition(AudioClock::getNanoseconds())
             + mFramesOffsetFromService;
     // Prevent retrograde motion.
diff --git a/media/liboboe/src/client/AudioStreamInternal.h b/media/liboboe/src/client/AudioStreamInternal.h
index 9459f97..666df3a 100644
--- a/media/liboboe/src/client/AudioStreamInternal.h
+++ b/media/liboboe/src/client/AudioStreamInternal.h
@@ -14,24 +14,24 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_AUDIOSTREAMINTERNAL_H
-#define OBOE_AUDIOSTREAMINTERNAL_H
+#ifndef AAUDIO_AUDIOSTREAMINTERNAL_H
+#define AAUDIO_AUDIOSTREAMINTERNAL_H
 
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-#include "binding/IOboeAudioService.h"
+#include "binding/IAAudioService.h"
 #include "binding/AudioEndpointParcelable.h"
 #include "client/IsochronousClockModel.h"
 #include "client/AudioEndpoint.h"
 #include "core/AudioStream.h"
 
 using android::sp;
-using android::IOboeAudioService;
+using android::IAAudioService;
 
-namespace oboe {
+namespace aaudio {
 
-// A stream that talks to the OboeService or directly to a HAL.
+// A stream that talks to the AAudioService or directly to a HAL.
 class AudioStreamInternal : public AudioStream {
 
 public:
@@ -39,57 +39,57 @@
     virtual ~AudioStreamInternal();
 
     // =========== Begin ABSTRACT methods ===========================
-    virtual oboe_result_t requestStart() override;
+    virtual aaudio_result_t requestStart() override;
 
-    virtual oboe_result_t requestPause() override;
+    virtual aaudio_result_t requestPause() override;
 
-    virtual oboe_result_t requestFlush() override;
+    virtual aaudio_result_t requestFlush() override;
 
-    virtual oboe_result_t requestStop() override;
+    virtual aaudio_result_t requestStop() override;
 
-    // TODO use oboe_clockid_t all the way down to AudioClock
-    virtual oboe_result_t getTimestamp(clockid_t clockId,
-                                       oboe_position_frames_t *framePosition,
-                                       oboe_nanoseconds_t *timeNanoseconds) override;
+    // TODO use aaudio_clockid_t all the way down to AudioClock
+    virtual aaudio_result_t getTimestamp(clockid_t clockId,
+                                       aaudio_position_frames_t *framePosition,
+                                       aaudio_nanoseconds_t *timeNanoseconds) override;
 
 
-    virtual oboe_result_t updateState() override;
+    virtual aaudio_result_t updateState() override;
     // =========== End ABSTRACT methods ===========================
 
-    virtual oboe_result_t open(const AudioStreamBuilder &builder) override;
+    virtual aaudio_result_t open(const AudioStreamBuilder &builder) override;
 
-    virtual oboe_result_t close() override;
+    virtual aaudio_result_t close() override;
 
-    virtual oboe_result_t write(const void *buffer,
+    virtual aaudio_result_t write(const void *buffer,
                              int32_t numFrames,
-                             oboe_nanoseconds_t timeoutNanoseconds) override;
+                             aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t waitForStateChange(oboe_stream_state_t currentState,
-                                          oboe_stream_state_t *nextState,
-                                          oboe_nanoseconds_t timeoutNanoseconds) override;
+    virtual aaudio_result_t waitForStateChange(aaudio_stream_state_t currentState,
+                                          aaudio_stream_state_t *nextState,
+                                          aaudio_nanoseconds_t timeoutNanoseconds) override;
 
-    virtual oboe_result_t setBufferSize(oboe_size_frames_t requestedFrames,
-                                        oboe_size_frames_t *actualFrames) override;
+    virtual aaudio_result_t setBufferSize(aaudio_size_frames_t requestedFrames,
+                                        aaudio_size_frames_t *actualFrames) override;
 
-    virtual oboe_size_frames_t getBufferSize() const override;
+    virtual aaudio_size_frames_t getBufferSize() const override;
 
-    virtual oboe_size_frames_t getBufferCapacity() const override;
+    virtual aaudio_size_frames_t getBufferCapacity() const override;
 
-    virtual oboe_size_frames_t getFramesPerBurst() const override;
+    virtual aaudio_size_frames_t getFramesPerBurst() const override;
 
-    virtual oboe_position_frames_t getFramesRead() override;
+    virtual aaudio_position_frames_t getFramesRead() override;
 
     virtual int32_t getXRunCount() const override {
         return mXRunCount;
     }
 
-    virtual oboe_result_t registerThread() override;
+    virtual aaudio_result_t registerThread() override;
 
-    virtual oboe_result_t unregisterThread() override;
+    virtual aaudio_result_t unregisterThread() override;
 
 protected:
 
-    oboe_result_t processCommands();
+    aaudio_result_t processCommands();
 
 /**
  * Low level write that will not block. It will just write as much as it can.
@@ -98,31 +98,31 @@
  *
  * @return the number of frames written or a negative error code.
  */
-    virtual oboe_result_t writeNow(const void *buffer,
+    virtual aaudio_result_t writeNow(const void *buffer,
                                 int32_t numFrames,
-                                oboe_nanoseconds_t currentTimeNanos,
-                                oboe_nanoseconds_t *wakeTimePtr);
+                                aaudio_nanoseconds_t currentTimeNanos,
+                                aaudio_nanoseconds_t *wakeTimePtr);
 
     void onFlushFromServer();
 
-    oboe_result_t onEventFromServer(OboeServiceMessage *message);
+    aaudio_result_t onEventFromServer(AAudioServiceMessage *message);
 
-    oboe_result_t onTimestampFromServer(OboeServiceMessage *message);
+    aaudio_result_t onTimestampFromServer(AAudioServiceMessage *message);
 
 private:
     IsochronousClockModel    mClockModel;
     AudioEndpoint            mAudioEndpoint;
-    oboe_handle_t            mServiceStreamHandle;
+    aaudio_handle_t            mServiceStreamHandle;
     EndpointDescriptor       mEndpointDescriptor;
     // Offset from underlying frame position.
-    oboe_position_frames_t   mFramesOffsetFromService = 0;
-    oboe_position_frames_t   mLastFramesRead = 0;
-    oboe_size_frames_t       mFramesPerBurst;
+    aaudio_position_frames_t   mFramesOffsetFromService = 0;
+    aaudio_position_frames_t   mLastFramesRead = 0;
+    aaudio_size_frames_t       mFramesPerBurst;
     int32_t                  mXRunCount = 0;
 
-    void processTimestamp(uint64_t position, oboe_nanoseconds_t time);
+    void processTimestamp(uint64_t position, aaudio_nanoseconds_t time);
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif //OBOE_AUDIOSTREAMINTERNAL_H
+#endif //AAUDIO_AUDIOSTREAMINTERNAL_H
diff --git a/media/liboboe/src/client/IsochronousClockModel.cpp b/media/liboboe/src/client/IsochronousClockModel.cpp
index b8e5538..bdb491d 100644
--- a/media/liboboe/src/client/IsochronousClockModel.cpp
+++ b/media/liboboe/src/client/IsochronousClockModel.cpp
@@ -14,19 +14,19 @@
  * limitations under the License.
  */
 
-#define LOG_TAG "OboeAudio"
+#define LOG_TAG "AAudio"
 //#define LOG_NDEBUG 0
 #include <utils/Log.h>
 
 #include <stdint.h>
-#include <oboe/OboeDefinitions.h>
+#include <aaudio/AAudioDefinitions.h>
 
 #include "IsochronousClockModel.h"
 
-#define MIN_LATENESS_NANOS (10 * OBOE_NANOS_PER_MICROSECOND)
+#define MIN_LATENESS_NANOS (10 * AAUDIO_NANOS_PER_MICROSECOND)
 
 using namespace android;
-using namespace oboe;
+using namespace aaudio;
 
 IsochronousClockModel::IsochronousClockModel()
         : mSampleRate(48000)
@@ -41,21 +41,21 @@
 IsochronousClockModel::~IsochronousClockModel() {
 }
 
-void IsochronousClockModel::start(oboe_nanoseconds_t nanoTime)
+void IsochronousClockModel::start(aaudio_nanoseconds_t nanoTime)
 {
     mMarkerNanoTime = nanoTime;
     mState = STATE_STARTING;
 }
 
-void IsochronousClockModel::stop(oboe_nanoseconds_t nanoTime)
+void IsochronousClockModel::stop(aaudio_nanoseconds_t nanoTime)
 {
     mMarkerNanoTime = nanoTime;
     mMarkerFramePosition = convertTimeToPosition(nanoTime); // TODO should we do this?
     mState = STATE_STOPPED;
 }
 
-void IsochronousClockModel::processTimestamp(oboe_position_frames_t framePosition,
-                                             oboe_nanoseconds_t nanoTime) {
+void IsochronousClockModel::processTimestamp(aaudio_position_frames_t framePosition,
+                                             aaudio_nanoseconds_t nanoTime) {
     int64_t framesDelta = framePosition - mMarkerFramePosition;
     int64_t nanosDelta = nanoTime - mMarkerNanoTime;
     if (nanosDelta < 1000) {
@@ -133,41 +133,41 @@
     mMaxLatenessInNanos = (nanosLate > MIN_LATENESS_NANOS) ? nanosLate : MIN_LATENESS_NANOS;
 }
 
-oboe_nanoseconds_t IsochronousClockModel::convertDeltaPositionToTime(
-        oboe_position_frames_t framesDelta) const {
-    return (OBOE_NANOS_PER_SECOND * framesDelta) / mSampleRate;
+aaudio_nanoseconds_t IsochronousClockModel::convertDeltaPositionToTime(
+        aaudio_position_frames_t framesDelta) const {
+    return (AAUDIO_NANOS_PER_SECOND * framesDelta) / mSampleRate;
 }
 
-int64_t IsochronousClockModel::convertDeltaTimeToPosition(oboe_nanoseconds_t nanosDelta) const {
-    return (mSampleRate * nanosDelta) / OBOE_NANOS_PER_SECOND;
+int64_t IsochronousClockModel::convertDeltaTimeToPosition(aaudio_nanoseconds_t nanosDelta) const {
+    return (mSampleRate * nanosDelta) / AAUDIO_NANOS_PER_SECOND;
 }
 
-oboe_nanoseconds_t IsochronousClockModel::convertPositionToTime(
-        oboe_position_frames_t framePosition) const {
+aaudio_nanoseconds_t IsochronousClockModel::convertPositionToTime(
+        aaudio_position_frames_t framePosition) const {
     if (mState == STATE_STOPPED) {
         return mMarkerNanoTime;
     }
-    oboe_position_frames_t nextBurstIndex = (framePosition + mFramesPerBurst - 1) / mFramesPerBurst;
-    oboe_position_frames_t nextBurstPosition = mFramesPerBurst * nextBurstIndex;
-    oboe_position_frames_t framesDelta = nextBurstPosition - mMarkerFramePosition;
-    oboe_nanoseconds_t nanosDelta = convertDeltaPositionToTime(framesDelta);
-    oboe_nanoseconds_t time = (oboe_nanoseconds_t) (mMarkerNanoTime + nanosDelta);
+    aaudio_position_frames_t nextBurstIndex = (framePosition + mFramesPerBurst - 1) / mFramesPerBurst;
+    aaudio_position_frames_t nextBurstPosition = mFramesPerBurst * nextBurstIndex;
+    aaudio_position_frames_t framesDelta = nextBurstPosition - mMarkerFramePosition;
+    aaudio_nanoseconds_t nanosDelta = convertDeltaPositionToTime(framesDelta);
+    aaudio_nanoseconds_t time = (aaudio_nanoseconds_t) (mMarkerNanoTime + nanosDelta);
 //    ALOGI("IsochronousClockModel::convertPositionToTime: pos = %llu --> time = %llu",
 //         (unsigned long long)framePosition,
 //         (unsigned long long)time);
     return time;
 }
 
-oboe_position_frames_t IsochronousClockModel::convertTimeToPosition(
-        oboe_nanoseconds_t nanoTime) const {
+aaudio_position_frames_t IsochronousClockModel::convertTimeToPosition(
+        aaudio_nanoseconds_t nanoTime) const {
     if (mState == STATE_STOPPED) {
         return mMarkerFramePosition;
     }
-    oboe_nanoseconds_t nanosDelta = nanoTime - mMarkerNanoTime;
-    oboe_position_frames_t framesDelta = convertDeltaTimeToPosition(nanosDelta);
-    oboe_position_frames_t nextBurstPosition = mMarkerFramePosition + framesDelta;
-    oboe_position_frames_t nextBurstIndex = nextBurstPosition / mFramesPerBurst;
-    oboe_position_frames_t position = nextBurstIndex * mFramesPerBurst;
+    aaudio_nanoseconds_t nanosDelta = nanoTime - mMarkerNanoTime;
+    aaudio_position_frames_t framesDelta = convertDeltaTimeToPosition(nanosDelta);
+    aaudio_position_frames_t nextBurstPosition = mMarkerFramePosition + framesDelta;
+    aaudio_position_frames_t nextBurstIndex = nextBurstPosition / mFramesPerBurst;
+    aaudio_position_frames_t position = nextBurstIndex * mFramesPerBurst;
 //    ALOGI("IsochronousClockModel::convertTimeToPosition: time = %llu --> pos = %llu",
 //         (unsigned long long)nanoTime,
 //         (unsigned long long)position);
diff --git a/media/liboboe/src/client/IsochronousClockModel.h b/media/liboboe/src/client/IsochronousClockModel.h
index 97be325..b188a3d 100644
--- a/media/liboboe/src/client/IsochronousClockModel.h
+++ b/media/liboboe/src/client/IsochronousClockModel.h
@@ -14,13 +14,13 @@
  * limitations under the License.
  */
 
-#ifndef OBOE_ISOCHRONOUSCLOCKMODEL_H
-#define OBOE_ISOCHRONOUSCLOCKMODEL_H
+#ifndef AAUDIO_ISOCHRONOUSCLOCKMODEL_H
+#define AAUDIO_ISOCHRONOUSCLOCKMODEL_H
 
 #include <stdint.h>
-#include <oboe/OboeAudio.h>
+#include <aaudio/AAudio.h>
 
-namespace oboe {
+namespace aaudio {
 
 /**
  * Model an isochronous data stream using occasional timestamps as input.
@@ -34,17 +34,17 @@
     IsochronousClockModel();
     virtual ~IsochronousClockModel();
 
-    void start(oboe_nanoseconds_t nanoTime);
-    void stop(oboe_nanoseconds_t nanoTime);
+    void start(aaudio_nanoseconds_t nanoTime);
+    void stop(aaudio_nanoseconds_t nanoTime);
 
-    void processTimestamp(oboe_position_frames_t framePosition, oboe_nanoseconds_t nanoTime);
+    void processTimestamp(aaudio_position_frames_t framePosition, aaudio_nanoseconds_t nanoTime);
 
     /**
      * @param sampleRate rate of the stream in frames per second
      */
-    void setSampleRate(oboe_sample_rate_t sampleRate);
+    void setSampleRate(aaudio_sample_rate_t sampleRate);
 
-    oboe_sample_rate_t getSampleRate() const {
+    aaudio_sample_rate_t getSampleRate() const {
         return mSampleRate;
     }
 
@@ -53,9 +53,9 @@
      *
      * @param framesPerBurst number of frames that stream advance at one time.
      */
-    void setFramesPerBurst(oboe_size_frames_t framesPerBurst);
+    void setFramesPerBurst(aaudio_size_frames_t framesPerBurst);
 
-    oboe_size_frames_t getFramesPerBurst() const {
+    aaudio_size_frames_t getFramesPerBurst() const {
         return mFramesPerBurst;
     }
 
@@ -65,7 +65,7 @@
      * @param framePosition position of the stream in frames
      * @return time in nanoseconds
      */
-    oboe_nanoseconds_t convertPositionToTime(oboe_position_frames_t framePosition) const;
+    aaudio_nanoseconds_t convertPositionToTime(aaudio_position_frames_t framePosition) const;
 
     /**
      * Calculate an estimated position where the stream will be at the specified time.
@@ -73,19 +73,19 @@
      * @param nanoTime time of interest
      * @return position in frames
      */
-    oboe_position_frames_t convertTimeToPosition(oboe_nanoseconds_t nanoTime) const;
+    aaudio_position_frames_t convertTimeToPosition(aaudio_nanoseconds_t nanoTime) const;
 
     /**
      * @param framesDelta difference in frames
      * @return duration in nanoseconds
      */
-    oboe_nanoseconds_t convertDeltaPositionToTime(oboe_position_frames_t framesDelta) const;
+    aaudio_nanoseconds_t convertDeltaPositionToTime(aaudio_position_frames_t framesDelta) const;
 
     /**
      * @param nanosDelta duration in nanoseconds
      * @return frames that stream will advance in that time
      */
-    oboe_position_frames_t convertDeltaTimeToPosition(oboe_nanoseconds_t nanosDelta) const;
+    aaudio_position_frames_t convertDeltaTimeToPosition(aaudio_nanoseconds_t nanosDelta) const;
 
 private:
     enum clock_model_state_t {
@@ -95,17 +95,17 @@
         STATE_RUNNING
     };
 
-    oboe_sample_rate_t     mSampleRate;
-    oboe_size_frames_t     mFramesPerBurst;
+    aaudio_sample_rate_t     mSampleRate;
+    aaudio_size_frames_t     mFramesPerBurst;
     int32_t                mMaxLatenessInNanos;
-    oboe_position_frames_t mMarkerFramePosition;
-    oboe_nanoseconds_t     mMarkerNanoTime;
+    aaudio_position_frames_t mMarkerFramePosition;
+    aaudio_nanoseconds_t     mMarkerNanoTime;
     int32_t                mTimestampCount;
     clock_model_state_t     mState;
 
     void update();
 };
 
-} /* namespace oboe */
+} /* namespace aaudio */
 
-#endif //OBOE_ISOCHRONOUSCLOCKMODEL_H
+#endif //AAUDIO_ISOCHRONOUSCLOCKMODEL_H