Loading services/oboeservice/AAudioServiceEndpoint.h +7 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,13 @@ public: */ virtual aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) = 0; /** * Set time that the associated frame was presented to the hardware. * * @param positionFrames receive position, input value is ignored * @param timeNanos receive time, input value is ignored * @return AAUDIO_OK or AAUDIO_ERROR_UNAVAILABLE or other negative error */ virtual aaudio_result_t getTimestamp(int64_t *positionFrames, int64_t *timeNanos) = 0; int32_t getFramesPerBurst() const { Loading services/oboeservice/AAudioServiceEndpointShared.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -192,5 +192,13 @@ aaudio_result_t AAudioServiceEndpointShared::getFreeRunningPosition(int64_t *pos aaudio_result_t AAudioServiceEndpointShared::getTimestamp(int64_t *positionFrames, int64_t *timeNanos) { return mStreamInternal->getTimestamp(CLOCK_MONOTONIC, positionFrames, timeNanos); aaudio_result_t result = mStreamInternal->getTimestamp(CLOCK_MONOTONIC, positionFrames, timeNanos); if (result == AAUDIO_ERROR_INVALID_STATE) { // getTimestamp() can return AAUDIO_ERROR_INVALID_STATE if the stream has // not completely started. This can cause a race condition that kills the // timestamp service thread. So we reduce the error to a less serious one // that allows the timestamp thread to continue. result = AAUDIO_ERROR_UNAVAILABLE; } return result; } Loading
services/oboeservice/AAudioServiceEndpoint.h +7 −0 Original line number Diff line number Diff line Loading @@ -77,6 +77,13 @@ public: */ virtual aaudio_result_t getFreeRunningPosition(int64_t *positionFrames, int64_t *timeNanos) = 0; /** * Set time that the associated frame was presented to the hardware. * * @param positionFrames receive position, input value is ignored * @param timeNanos receive time, input value is ignored * @return AAUDIO_OK or AAUDIO_ERROR_UNAVAILABLE or other negative error */ virtual aaudio_result_t getTimestamp(int64_t *positionFrames, int64_t *timeNanos) = 0; int32_t getFramesPerBurst() const { Loading
services/oboeservice/AAudioServiceEndpointShared.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -192,5 +192,13 @@ aaudio_result_t AAudioServiceEndpointShared::getFreeRunningPosition(int64_t *pos aaudio_result_t AAudioServiceEndpointShared::getTimestamp(int64_t *positionFrames, int64_t *timeNanos) { return mStreamInternal->getTimestamp(CLOCK_MONOTONIC, positionFrames, timeNanos); aaudio_result_t result = mStreamInternal->getTimestamp(CLOCK_MONOTONIC, positionFrames, timeNanos); if (result == AAUDIO_ERROR_INVALID_STATE) { // getTimestamp() can return AAUDIO_ERROR_INVALID_STATE if the stream has // not completely started. This can cause a race condition that kills the // timestamp service thread. So we reduce the error to a less serious one // that allows the timestamp thread to continue. result = AAUDIO_ERROR_UNAVAILABLE; } return result; }