ndk-samples
ndk-samples copied to clipboard
Best effort to get the exact timestamp of audio stream
Is it possible to get the exact timestamp on starting the audio stream? There are some APIs such as media.AudioTimeStamp and AAudioStream_getTimestamp(), but I am not sure if they can guarantee the high accuracy(microseconds level).
You can back calculate the time of frame zero. But the accuracy is not great. The CDD requests an accuracy of <2 msec. But many devices are more like 5 msec. We are trying to make the timestamp work for AV Sync. Anything under 10 msec is usually not noticeable, particularly if the audio comes after the video. If you move your chair five feet then it will change the AV sync by about 5 msec.
What use case requires microsecond accuracy?
You can back calculate the time of frame zero. But the accuracy is not great. The CDD requests an accuracy of <2 msec. But many devices are more like 5 msec. We are trying to make the timestamp work for AV Sync. Anything under 10 msec is usually not noticeable, particularly if the audio comes after the video. If you move your chair five feet then it will change the AV sync by about 5 msec.
What use case requires microsecond accuracy?
Thanks for your great response. I try to compute the distance based on the AV arrival time difference for the AV event. To achieve high resolution of distance measurement, accurate AV sync is required. How about the variance of the AV sync error? If the variance is small, it is also acceptable.
CDD
I am more interested in minimizing input latency.
You can back calculate the time of frame zero. But the accuracy is not great. The CDD requests an accuracy of <2 msec. But many devices are more like 5 msec. We are trying to make the timestamp work for AV Sync. Anything under 10 msec is usually not noticeable, particularly if the audio comes after the video. If you move your chair five feet then it will change the AV sync by about 5 msec.
What use case requires microsecond accuracy?
Hi Phil, could you share more experience on the input latency such as mean value and variance value, and how to keep input latency stable? Thanks!
AAudioStream_getTimestamp()
Hi Phil, for AAudioStream_getTimestamp(), how are errors of timestamp distributed?
Not really a samples problem, so closing.
If you feel there's a missing API (and Phil's comment makes me believe that what you're asking for is not useful with the laws of physics that I live by), file a request against the framework at http://b.android.com