Annotating the rest of AudioCodingModuleImpl

A few extra locks had to be acquired as a result of the annotation.

BUG=3401
R=kwiberg@webrtc.org

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6524 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2014-06-23 19:52:27 +00:00
parent 1227ab89a7
commit ceb5a1d724
3 changed files with 17 additions and 8 deletions

View File

@ -1203,6 +1203,7 @@ int AudioCodingModuleImpl::SendBitrate() const {
// Set available bandwidth, inform the encoder about the estimated bandwidth
// received from the remote party.
int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) {
CriticalSectionScoped lock(acm_crit_sect_);
return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
}
@ -1452,6 +1453,7 @@ int AudioCodingModuleImpl::SetREDStatus(
//
bool AudioCodingModuleImpl::CodecFEC() const {
CriticalSectionScoped lock(acm_crit_sect_);
return codec_fec_enabled_;
}
@ -1476,6 +1478,7 @@ int AudioCodingModuleImpl::SetCodecFEC(bool enable_codec_fec) {
}
int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
CriticalSectionScoped lock(acm_crit_sect_);
if (HaveValidEncoder("SetPacketLossRate") &&
codecs_[current_send_codec_idx_]->SetPacketLossRate(loss_rate) < 0) {
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
@ -1950,6 +1953,7 @@ int AudioCodingModuleImpl::REDPayloadISAC(int isac_rate,
int isac_bw_estimate,
uint8_t* payload,
int16_t* length_bytes) {
CriticalSectionScoped lock(acm_crit_sect_);
if (!HaveValidEncoder("EncodeData")) {
return -1;
}

View File

@ -214,6 +214,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// GET RED payload for iSAC. The method id called when 'this' ACM is
// the default ACM.
// TODO(henrik.lundin) Not used. Remove?
int REDPayloadISAC(int isac_rate,
int isac_bw_estimate,
uint8_t* payload,
@ -248,7 +249,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
int InitializeReceiverSafe() EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
bool HaveValidEncoder(const char* caller_name) const;
bool HaveValidEncoder(const char* caller_name) const
EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
// Set VAD/DTX status. This function does not acquire a lock, and it is
// created to be called only from inside a critical section.
@ -303,7 +305,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
// codec owns the decoder-instance. For such codecs |*decoder| should be a
// valid pointer, otherwise it will be NULL.
int GetAudioDecoder(const CodecInst& codec, int codec_id,
int mirror_id, AudioDecoder** decoder);
int mirror_id, AudioDecoder** decoder)
EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
CriticalSectionWrapper* acm_crit_sect_;
int id_; // TODO(henrik.lundin) Make const.
@ -320,13 +323,14 @@ class AudioCodingModuleImpl : public AudioCodingModule {
bool vad_enabled_ GUARDED_BY(acm_crit_sect_);
bool dtx_enabled_ GUARDED_BY(acm_crit_sect_);
ACMVADMode vad_mode_ GUARDED_BY(acm_crit_sect_);
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs];
int mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs];
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs]
GUARDED_BY(acm_crit_sect_);
int mirror_codec_idx_[ACMCodecDB::kMaxNumCodecs] GUARDED_BY(acm_crit_sect_);
bool stereo_send_ GUARDED_BY(acm_crit_sect_);
int current_send_codec_idx_;
bool send_codec_registered_;
int current_send_codec_idx_ GUARDED_BY(acm_crit_sect_);
bool send_codec_registered_ GUARDED_BY(acm_crit_sect_);
ACMResampler resampler_ GUARDED_BY(acm_crit_sect_);
AcmReceiver receiver_;
AcmReceiver receiver_; // AcmReceiver has it's own internal lock.
// RED.
bool is_first_red_ GUARDED_BY(acm_crit_sect_);
@ -345,7 +349,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
uint32_t last_red_timestamp_ GUARDED_BY(acm_crit_sect_);
// Codec internal FEC
bool codec_fec_enabled_;
bool codec_fec_enabled_ GUARDED_BY(acm_crit_sect_);
// This is to keep track of CN instances where we can send DTMFs.
uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_);

View File

@ -330,6 +330,7 @@ class AudioCodingModule: public Module {
// -1 if error occurred in setting the bandwidth,
// 0 bandwidth is set successfully.
//
// TODO(henrik.lundin) Unused. Remove?
virtual int32_t SetReceivedEstimatedBandwidth(
const int32_t bw) = 0;