Prevent data race in GetStaticInstance
Prevent data race in GetStaticInstance

The previous code attempted to lock instance_count and instance with a
CriticalSection, but the CriticalSection was not static, so each
function invocation got its own instance. Locking this call-specific
instance doesn't actually stop any other threads from concurrently
accessing the same function-scope globals, so this function had a data
race, which broke tsan tests (and possibly other things).

Making the CriticalSection shared among function calls will actually
synchronize access to the globals and allow our tsan tests to pass.

BUG=webrtc:3062

Review-Url: https://codereview.webrtc.org/2890213002
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#18296}

ShiftMediaProject/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,TimothyGu/libilbc,ShiftMediaProject/libilbc,ShiftMediaProject/libilbc,TimothyGu/libilbc