Atomically access RealtimeAnalyser write_index_
The write index for the buffer that holds the time domain data is read from the main thread and written by the audio thread. Atomically access these and also read (and write) them exactly once in each routine so that they don't get out of sync within each routine. Can't add a trylock to protect access in WriteInput because if the audio thread can't get the lock, there will be strange gaps in the saved data. It's ok if the main thread reads a slightly old value of the index; the data is just a bit stale, which is fine for the AnalyserNode. Bug: 786829 Test: test case from bug passes Change-Id: Id8d5658b9610beb0d78c2c16d9eac579406e4c2b Reviewed-on: https://chromium-review.googlesource.com/790945Reviewed-by:Hongchan Choi <hongchan@chromium.org> Commit-Queue: Raymond Toy <rtoy@chromium.org> Cr-Commit-Position: refs/heads/master@{#519767}
Showing
Please register or sign in to comment