Fixes thread-safety-analysis warnings for Windows ADM.
Now using attribute to ensure that we avoid error like these when bulding with -Wthread-safety-analysis: error: mutex '_critSect' is still held at the end of function [-Werror,-Wthread-safety-analysis] RTC_NO_THREAD_SAFETY_ANALYSIS is an attribute on functions or methods, which turns off thread safety checking for that method. It provides an escape hatch for functions which are either (1) deliberately thread-unsafe, or (2) are thread-safe, but too complicated for the analysis to understand. Bug: webrtc:9202 Change-Id: Ie332bca7eb7eb535ed965de5ddc42872c4f30602 Reviewed-on: https://webrtc-review.googlesource.com/76562 Reviewed-by: Oskar Sundbom <ossu@webrtc.org> Commit-Queue: Henrik Andreassson <henrika@webrtc.org> Cr-Commit-Position: refs/heads/master@{#23221}
This commit is contained in:
parent
858c4d70cd
commit
52cab50c22
@ -33,10 +33,6 @@ config("audio_device_warnings_config") {
|
||||
"-Wno-microsoft-goto",
|
||||
"-Wno-reorder",
|
||||
"-Wno-shift-overflow",
|
||||
|
||||
# See https://bugs.chromium.org/p/webrtc/issues/detail?id=6265
|
||||
# for -Wno-thread-safety-analysis
|
||||
"-Wno-thread-safety-analysis",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
|
||||
#include "rtc_base/logging.h"
|
||||
#include "rtc_base/platform_thread.h"
|
||||
#include "rtc_base/thread_annotations.h"
|
||||
#include "system_wrappers/include/sleep.h"
|
||||
|
||||
// Macro that calls a COM method returning HRESULT value.
|
||||
@ -3399,6 +3400,14 @@ int32_t AudioDeviceWindowsCore::EnableBuiltInAEC(bool enable) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AudioDeviceWindowsCore::_Lock() RTC_NO_THREAD_SAFETY_ANALYSIS {
|
||||
_critSect.Enter();
|
||||
}
|
||||
|
||||
void AudioDeviceWindowsCore::_UnLock() RTC_NO_THREAD_SAFETY_ANALYSIS {
|
||||
_critSect.Leave();
|
||||
}
|
||||
|
||||
int AudioDeviceWindowsCore::SetDMOProperties() {
|
||||
HRESULT hr = S_OK;
|
||||
assert(_dmo != NULL);
|
||||
|
||||
@ -201,8 +201,8 @@ private: // thread functions
|
||||
static DWORD WINAPI WSAPIRenderThread(LPVOID context);
|
||||
DWORD DoRenderThread();
|
||||
|
||||
void _Lock() { _critSect.Enter(); };
|
||||
void _UnLock() { _critSect.Leave(); };
|
||||
void _Lock();
|
||||
void _UnLock();
|
||||
|
||||
int SetDMOProperties();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user