Karl Wiberg 075bb8d125 Fix race in AudioCodingModuleImpl::Add10MsData()
AudioCodingModuleImpl::Add10MsData() calls two private methods that
together do all the work: Add10MsDataInternal() and Encode(). They
each took locks internally in order to protect access to, among other
things, codec_manager_.

This turned out to be inadequate. Add10MsDataInternal() calls
codec_manager_.CurrentEncoder()->SampleRateHz() in order to be able to
resample the audio data to what the current encoder wants. When the
resampled data is fed to the encoder deep inside the Encode() call,
that sample rate must still be correct, but occasionally it wasn't,
which triggered a CHECK. (The specific test that failed was the
voe_auto_test subtest
CodecTest.OpusMaxPlaybackRateCannotBeSetForNonOpus, which changes the
current encoder while encoding is in progress.)

This CL solves the problem by covering all of
AudioCodingModuleImpl::Add10MsData() in a single critical section, so
that the sample rate obtained in Add10MsDataInternal() is guaranteed
to still be valid during the Encode() call.

BUG=4644
R=henrik.lundin@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/52459004

Cr-Commit-Position: refs/heads/master@{#9174}
2015-05-12 08:09:58 +00:00
2015-05-11 12:34:53 +00:00
2015-04-28 13:43:45 +00:00
2015-03-06 08:03:47 +00:00
2014-06-17 08:54:03 +00:00
Description
No description provided
108 MiB
Languages
C++ 76%
C 16%
Python 2.3%
Java 2.1%
Objective-C++ 1.5%
Other 1.9%