oboe icon indicating copy to clipboard operation
oboe copied to clipboard

CLOCK_BOOTTIME does not work for gettimestamp

Open sunwell1994 opened this issue 3 years ago • 2 comments

Android version(s): 10 Android device(s): Pixel 3 XL Oboe version: 1.6.1 App name used for testing: (Please try to reproduce the issue using the OboeTester or an Oboe sample.) LiveEffect Short description (Please only report one bug per Issue. Do not combine multiple bugs.) Steps to reproduce Try stream->getTimestamp(CLOCK_MONOTONIC) and stream->getTimestamp(CLOCK_BOOTTIME) in LiveEffect. Expected behavior They should output different timestamps for the same frame position. Actual behavior They output the same timestamps whose clock source is the same as System.nanotime(). Device

Any additional context

If applicable, please attach a few seconds of an uncompressed recording of the sound in a WAV or AIFF file.

sunwell1994 avatar Jan 16 '22 03:01 sunwell1994

How much time difference are you seeing between CLOCK_MONOTONIC and CLOCK_BOOTTIME?

It appears the clockId is ignored for MMAP streams in AAudio: https://cs.android.com/android/platform/superproject/+/master:frameworks/av/media/libaaudio/src/client/AudioStreamInternal.cpp;l=514;drc=master

We will track this as an AAudio issue. I think Oboe is passing the clockId correctly to AAudio.

philburk avatar Jan 16 '22 15:01 philburk

The difference of returned timestamps is 0. between CLOCK_MONOTONIC and CLOCK_BOOTTIME. The correct difference of my device should be 330738680632263 nanoseconds based on Java System clock APIs. It is the AAudio issue. I also verified it through AAudio directly.

sunwell1994 avatar Jan 16 '22 22:01 sunwell1994