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:
@ -1203,6 +1203,7 @@ int AudioCodingModuleImpl::SendBitrate() const {
|
|||||||
// Set available bandwidth, inform the encoder about the estimated bandwidth
|
// Set available bandwidth, inform the encoder about the estimated bandwidth
|
||||||
// received from the remote party.
|
// received from the remote party.
|
||||||
int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) {
|
int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) {
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
|
return codecs_[current_send_codec_idx_]->SetEstimatedBandwidth(bw);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,6 +1453,7 @@ int AudioCodingModuleImpl::SetREDStatus(
|
|||||||
//
|
//
|
||||||
|
|
||||||
bool AudioCodingModuleImpl::CodecFEC() const {
|
bool AudioCodingModuleImpl::CodecFEC() const {
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
return codec_fec_enabled_;
|
return codec_fec_enabled_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1476,6 +1478,7 @@ int AudioCodingModuleImpl::SetCodecFEC(bool enable_codec_fec) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
|
int AudioCodingModuleImpl::SetPacketLossRate(int loss_rate) {
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
if (HaveValidEncoder("SetPacketLossRate") &&
|
if (HaveValidEncoder("SetPacketLossRate") &&
|
||||||
codecs_[current_send_codec_idx_]->SetPacketLossRate(loss_rate) < 0) {
|
codecs_[current_send_codec_idx_]->SetPacketLossRate(loss_rate) < 0) {
|
||||||
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
|
||||||
@ -1950,6 +1953,7 @@ int AudioCodingModuleImpl::REDPayloadISAC(int isac_rate,
|
|||||||
int isac_bw_estimate,
|
int isac_bw_estimate,
|
||||||
uint8_t* payload,
|
uint8_t* payload,
|
||||||
int16_t* length_bytes) {
|
int16_t* length_bytes) {
|
||||||
|
CriticalSectionScoped lock(acm_crit_sect_);
|
||||||
if (!HaveValidEncoder("EncodeData")) {
|
if (!HaveValidEncoder("EncodeData")) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -214,6 +214,7 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
|
|
||||||
// GET RED payload for iSAC. The method id called when 'this' ACM is
|
// GET RED payload for iSAC. The method id called when 'this' ACM is
|
||||||
// the default ACM.
|
// the default ACM.
|
||||||
|
// TODO(henrik.lundin) Not used. Remove?
|
||||||
int REDPayloadISAC(int isac_rate,
|
int REDPayloadISAC(int isac_rate,
|
||||||
int isac_bw_estimate,
|
int isac_bw_estimate,
|
||||||
uint8_t* payload,
|
uint8_t* payload,
|
||||||
@ -248,7 +249,8 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
|
|
||||||
int InitializeReceiverSafe() EXCLUSIVE_LOCKS_REQUIRED(acm_crit_sect_);
|
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
|
// Set VAD/DTX status. This function does not acquire a lock, and it is
|
||||||
// created to be called only from inside a critical section.
|
// 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
|
// codec owns the decoder-instance. For such codecs |*decoder| should be a
|
||||||
// valid pointer, otherwise it will be NULL.
|
// valid pointer, otherwise it will be NULL.
|
||||||
int GetAudioDecoder(const CodecInst& codec, int codec_id,
|
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_;
|
CriticalSectionWrapper* acm_crit_sect_;
|
||||||
int id_; // TODO(henrik.lundin) Make const.
|
int id_; // TODO(henrik.lundin) Make const.
|
||||||
@ -320,13 +323,14 @@ class AudioCodingModuleImpl : public AudioCodingModule {
|
|||||||
bool vad_enabled_ GUARDED_BY(acm_crit_sect_);
|
bool vad_enabled_ GUARDED_BY(acm_crit_sect_);
|
||||||
bool dtx_enabled_ GUARDED_BY(acm_crit_sect_);
|
bool dtx_enabled_ GUARDED_BY(acm_crit_sect_);
|
||||||
ACMVADMode vad_mode_ GUARDED_BY(acm_crit_sect_);
|
ACMVADMode vad_mode_ GUARDED_BY(acm_crit_sect_);
|
||||||
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs];
|
ACMGenericCodec* codecs_[ACMCodecDB::kMaxNumCodecs]
|
||||||
int mirror_codec_idx_[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_);
|
bool stereo_send_ GUARDED_BY(acm_crit_sect_);
|
||||||
int current_send_codec_idx_;
|
int current_send_codec_idx_ GUARDED_BY(acm_crit_sect_);
|
||||||
bool send_codec_registered_;
|
bool send_codec_registered_ GUARDED_BY(acm_crit_sect_);
|
||||||
ACMResampler resampler_ GUARDED_BY(acm_crit_sect_);
|
ACMResampler resampler_ GUARDED_BY(acm_crit_sect_);
|
||||||
AcmReceiver receiver_;
|
AcmReceiver receiver_; // AcmReceiver has it's own internal lock.
|
||||||
|
|
||||||
// RED.
|
// RED.
|
||||||
bool is_first_red_ GUARDED_BY(acm_crit_sect_);
|
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_);
|
uint32_t last_red_timestamp_ GUARDED_BY(acm_crit_sect_);
|
||||||
|
|
||||||
// Codec internal FEC
|
// 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.
|
// This is to keep track of CN instances where we can send DTMFs.
|
||||||
uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_);
|
uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_);
|
||||||
|
@ -330,6 +330,7 @@ class AudioCodingModule: public Module {
|
|||||||
// -1 if error occurred in setting the bandwidth,
|
// -1 if error occurred in setting the bandwidth,
|
||||||
// 0 bandwidth is set successfully.
|
// 0 bandwidth is set successfully.
|
||||||
//
|
//
|
||||||
|
// TODO(henrik.lundin) Unused. Remove?
|
||||||
virtual int32_t SetReceivedEstimatedBandwidth(
|
virtual int32_t SetReceivedEstimatedBandwidth(
|
||||||
const int32_t bw) = 0;
|
const int32_t bw) = 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user