Use the timestamp reported by the HAL for aaudio.
Use the timestamp reported by the HAL if it is accurate. For the audio HAL whose version is less than 7.0, getPresentationPosition is an optional API. In that case, it may not report the timestamp correctly. If the reported position is not changed within the time of 5 burst size, the reported timestamp from the HAL will not be used. For the audio HAL whose version is 7.0 or later, the getPresentationPosition API is mandatory. In that case, the reported timestamp is expected to be a valid one. But in the real practice, the HAL may not always report the timestamp correctly for MMAP case. To avoid reporting wrong timestamp to apps, the timestamp from the HAL is not trusted if 1) reported position is going backwards or 2) reported timestamp is going backwards or 3) timestamp or position is frozon for a certain time. Bug: 158609200 Test: atest AAudioTests Change-Id: Ib6a9825936f3db15b68d2c7af8c578182566f52a
Loading
Please register or sign in to comment