My application uses AudioTrack in streaming mode and AudioRecord simultaneously.
My problem is that I start them at the same time, but I have no guarantee that they will actually start playbackrecording in the same timestamp.
The reason I need this kind of accuracy is because I use echo cancellation (subtracting audio played to speaker from the recording). My echo canceller doesn't require an exact delay, but the delay introduced between AudioTrack and AudioRecord moves in the range of 250ms (between different runs), and that's too much - each run is different because they start themselves asynchronously. The API doesn't provide me a way to make sure they start in the same time, so I thought about measuring this starting delay somehow and then using it in my calculation.
Does anyone have an idea how to do that, utilizing their API or in any other way?
Thanks for any help!