APM: Make the GetStatistics call independent of the locks in APM

This CL changes the GetStatistics call in the audio processing module
(APM) to not aquire the render or capture locks in APM, while still
being thread-safe.
This change eliminates the risk of thread-priority inversion due to the
GetStatistics call.

Apart from the above the CL:
-Corrects the GetStatistics to not be const (it was const even though it
 aquired locks).
-Slightly changes the statistics reporting, so that the stats received
may be older than the most recent stats reported.

Bug: webrtc:11241
Change-Id: I00deb5507e004cbe6e4a19a8bad357491f86f4ab
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/163982
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Commit-Queue: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30131}
This commit is contained in:
Per Åhgren
2019-12-30 14:32:14 +01:00
committed by Commit Bot
parent a43777dead
commit cf4c872dbd
7 changed files with 90 additions and 67 deletions

View File

@ -129,7 +129,8 @@ class MockAudioProcessing : public ::testing::NiceMock<AudioProcessing> {
MOCK_METHOD0(DetachPlayoutAudioGenerator, void());
MOCK_METHOD0(UpdateHistogramsOnCallEnd, void());
MOCK_CONST_METHOD1(GetStatistics, AudioProcessingStats(bool));
MOCK_METHOD0(GetStatistics, AudioProcessingStats());
MOCK_METHOD1(GetStatistics, AudioProcessingStats(bool));
MOCK_CONST_METHOD0(GetConfig, AudioProcessing::Config());
};