What is thread unsafe about AudioStream::getTimestamp?

  android, oboe

The Oboe documentation says that some functions are thread-unsafe and are recommended to be protected with a mutex. https://github.com/google/oboe/blob/master/docs/FullGuide.md#thread-safety.

getTimestamp is a getter. Can you clarify what exactly is thread-unsafe about it? Is it simply not guaranteed to be monotonically increasing between threads? Is there an actual race condition between what sets some underlying state and that state as it is read by AAudio? is getTimestamp modifying state of the underlying stream in some way that is unsafe?

I wasn’t able to find the implementation of getTimestamp. It seems AAudio asks the audio stream https://android.googlesource.com/platform/frameworks/av/+/master/media/libaaudio/src/core/AAudioAudio.cpp#519. But the audio stream asks AAudio? https://android.googlesource.com/platform/frameworks/av/+/master/media/libaaudio/src/core/AudioStream.h#99

Source: Android Questions

LEAVE A COMMENT