Annotating the rest of AcmGenericCodec
A few locks had to be acquired to fully annotate the class, and a few others had to be moved. Removing an API method that was not used. BUG=3401 R=kwiberg@webrtc.org Review URL: https://webrtc-codereview.appspot.com/12759004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@6526 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
f6d37de466
commit
b338ca6557
@ -35,7 +35,8 @@ class ACMCNG: public ACMGenericCodec {
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
|
||||
|
||||
protected:
|
||||
void DestructEncoderSafe();
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalCreateEncoder();
|
||||
|
||||
|
@ -33,7 +33,9 @@ class ACMG722 : public ACMGenericCodec {
|
||||
// For FEC.
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
|
||||
|
||||
@ -44,7 +46,8 @@ class ACMG722 : public ACMGenericCodec {
|
||||
const uint8_t audio_channel)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
void DestructEncoderSafe();
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalCreateEncoder();
|
||||
|
||||
|
@ -312,7 +312,10 @@ class ACMGenericCodec {
|
||||
// true if the codec has an internal DTX, e.g. G729,
|
||||
// false otherwise.
|
||||
//
|
||||
bool HasInternalDTX() const { return has_internal_dtx_; }
|
||||
bool HasInternalDTX() const {
|
||||
ReadLockScoped rl(codec_wrapper_lock_);
|
||||
return has_internal_dtx_;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t GetEstimatedBandwidth()
|
||||
@ -436,7 +439,8 @@ class ACMGenericCodec {
|
||||
// -1 if failed, or if this is meaningless for the given codec.
|
||||
// 0 if succeeded.
|
||||
//
|
||||
virtual int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz);
|
||||
virtual int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// EncoderSampFreq()
|
||||
@ -450,7 +454,8 @@ class ACMGenericCodec {
|
||||
// -1 if failed to output sampling rate.
|
||||
// 0 if the sample rate is returned successfully.
|
||||
//
|
||||
virtual int16_t EncoderSampFreq(uint16_t* samp_freq_hz);
|
||||
virtual int16_t EncoderSampFreq(uint16_t* samp_freq_hz)
|
||||
SHARED_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int32_t ConfigISACBandwidthEstimator()
|
||||
@ -515,8 +520,6 @@ class ACMGenericCodec {
|
||||
//
|
||||
virtual int32_t SetISACMaxRate(const uint32_t max_rate_bps);
|
||||
|
||||
int32_t FrameSize() { return frame_len_smpl_; }
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// REDPayloadISAC()
|
||||
// This is an iSAC-specific function. The function is called to get RED
|
||||
@ -569,7 +572,10 @@ class ACMGenericCodec {
|
||||
// true if the codec has an internal FEC, e.g. Opus.
|
||||
// false otherwise.
|
||||
//
|
||||
bool HasInternalFEC() const { return has_internal_fec_; }
|
||||
bool HasInternalFEC() const {
|
||||
ReadLockScoped rl(codec_wrapper_lock_);
|
||||
return has_internal_fec_;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int SetFEC();
|
||||
@ -624,7 +630,8 @@ class ACMGenericCodec {
|
||||
// See EncoderParam() for the description of function, input(s)/output(s)
|
||||
// and return value.
|
||||
//
|
||||
int16_t EncoderParamsSafe(WebRtcACMCodecParams* enc_params);
|
||||
int16_t EncoderParamsSafe(WebRtcACMCodecParams* enc_params)
|
||||
SHARED_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// See ResetEncoder() for the description of function, input(s)/output(s)
|
||||
@ -651,7 +658,8 @@ class ACMGenericCodec {
|
||||
// See DestructEncoder() for the description of function,
|
||||
// input(s)/output(s) and return value.
|
||||
//
|
||||
virtual void DestructEncoderSafe() = 0;
|
||||
virtual void DestructEncoderSafe()
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// See SetBitRate() for the description of function, input(s)/output(s)
|
||||
@ -659,7 +667,8 @@ class ACMGenericCodec {
|
||||
//
|
||||
// Any codec that can change the bit-rate has to implement this.
|
||||
//
|
||||
virtual int16_t SetBitRateSafe(const int32_t bitrate_bps);
|
||||
virtual int16_t SetBitRateSafe(const int32_t bitrate_bps)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// See GetEstimatedBandwidth() for the description of function,
|
||||
@ -707,7 +716,7 @@ class ACMGenericCodec {
|
||||
// -1 if failed,
|
||||
// 0 if succeeded.
|
||||
//
|
||||
int16_t CreateEncoder();
|
||||
int16_t CreateEncoder() EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int16_t EnableVAD();
|
||||
@ -773,7 +782,8 @@ class ACMGenericCodec {
|
||||
// otherwise the length of the bit-stream is returned.
|
||||
//
|
||||
virtual int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) = 0;
|
||||
int16_t* bitstream_len_byte)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int16_t InternalInitEncoder()
|
||||
@ -794,7 +804,8 @@ class ACMGenericCodec {
|
||||
// -1 if failed,
|
||||
// 0 if succeeded.
|
||||
//
|
||||
virtual int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) = 0;
|
||||
virtual int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_) = 0;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// void IncreaseNoMissedSamples()
|
||||
@ -805,7 +816,8 @@ class ACMGenericCodec {
|
||||
// -num_samples : the number of overwritten samples is incremented
|
||||
// by this value.
|
||||
//
|
||||
void IncreaseNoMissedSamples(const int16_t num_samples);
|
||||
void IncreaseNoMissedSamples(const int16_t num_samples)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int16_t InternalCreateEncoder()
|
||||
@ -849,7 +861,8 @@ class ACMGenericCodec {
|
||||
// -1 if failed,
|
||||
// 0 if succeeded.
|
||||
//
|
||||
virtual int16_t InternalResetEncoder();
|
||||
virtual int16_t InternalResetEncoder()
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// int16_t ProcessFrameVADDTX()
|
||||
@ -900,41 +913,42 @@ class ACMGenericCodec {
|
||||
|
||||
// &in_audio_[in_audio_ix_write_] always point to where new audio can be
|
||||
// written to
|
||||
int16_t in_audio_ix_write_;
|
||||
int16_t in_audio_ix_write_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// &in_audio_[in_audio_ix_read_] points to where audio has to be read from
|
||||
int16_t in_audio_ix_read_;
|
||||
int16_t in_audio_ix_read_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
int16_t in_timestamp_ix_write_;
|
||||
int16_t in_timestamp_ix_write_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// Where the audio is stored before encoding,
|
||||
// To save memory the following buffer can be allocated
|
||||
// dynamically for 80 ms depending on the sampling frequency
|
||||
// of the codec.
|
||||
int16_t* in_audio_;
|
||||
uint32_t* in_timestamp_;
|
||||
int16_t* in_audio_ GUARDED_BY(codec_wrapper_lock_);
|
||||
uint32_t* in_timestamp_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
int16_t frame_len_smpl_;
|
||||
uint16_t num_channels_;
|
||||
int16_t frame_len_smpl_ GUARDED_BY(codec_wrapper_lock_);
|
||||
uint16_t num_channels_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// This will point to a static database of the supported codecs
|
||||
int16_t codec_id_;
|
||||
int16_t codec_id_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// This will account for the number of samples were not encoded
|
||||
// the case is rare, either samples are missed due to overwrite
|
||||
// at input buffer or due to encoding error
|
||||
uint32_t num_missed_samples_;
|
||||
uint32_t num_missed_samples_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// True if the encoder instance created
|
||||
bool encoder_exist_;
|
||||
bool encoder_exist_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// True if the encoder instance initialized
|
||||
bool encoder_initialized_;
|
||||
bool encoder_initialized_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
const bool registered_in_neteq_; // TODO(henrik.lundin) Remove?
|
||||
const bool registered_in_neteq_
|
||||
GUARDED_BY(codec_wrapper_lock_); // TODO(henrik.lundin) Remove?
|
||||
|
||||
// VAD/DTX
|
||||
bool has_internal_dtx_;
|
||||
bool has_internal_dtx_ GUARDED_BY(codec_wrapper_lock_);
|
||||
WebRtcVadInst* ptr_vad_inst_ GUARDED_BY(codec_wrapper_lock_);
|
||||
bool vad_enabled_ GUARDED_BY(codec_wrapper_lock_);
|
||||
ACMVADMode vad_mode_ GUARDED_BY(codec_wrapper_lock_);
|
||||
@ -947,9 +961,9 @@ class ACMGenericCodec {
|
||||
int16_t prev_frame_cng_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// FEC.
|
||||
bool has_internal_fec_;
|
||||
bool has_internal_fec_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
WebRtcACMCodecParams encoder_params_;
|
||||
WebRtcACMCodecParams encoder_params_ GUARDED_BY(codec_wrapper_lock_);
|
||||
|
||||
// Used as a global lock for all available decoders
|
||||
// so that no decoder is used when NetEQ decodes.
|
||||
|
@ -29,14 +29,18 @@ class ACMILBC : public ACMGenericCodec {
|
||||
// for FEC
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
|
||||
|
||||
protected:
|
||||
int16_t SetBitRateSafe(const int32_t rate);
|
||||
int16_t SetBitRateSafe(const int32_t rate) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
void DestructEncoderSafe();
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalCreateEncoder();
|
||||
|
||||
|
@ -694,7 +694,10 @@ int32_t ACMISAC::ConfigISACBandwidthEstimator(
|
||||
"Couldn't config iSAC BWE.");
|
||||
return -1;
|
||||
}
|
||||
UpdateFrameLen();
|
||||
{
|
||||
WriteLockScoped wl(codec_wrapper_lock_);
|
||||
UpdateFrameLen();
|
||||
}
|
||||
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
|
||||
ACM_ISAC_GETSENDBITRATE(codec_inst_ptr_->inst, &isac_current_bn_);
|
||||
return 0;
|
||||
@ -792,6 +795,7 @@ int ACMISAC::ErrorCode() {
|
||||
|
||||
AudioDecoder* ACMISAC::Decoder(int codec_id) {
|
||||
// Create iSAC instance if it does not exist.
|
||||
WriteLockScoped wl(codec_wrapper_lock_);
|
||||
if (!encoder_exist_) {
|
||||
CriticalSectionScoped lock(codec_inst_crit_sect_.get());
|
||||
assert(codec_inst_ptr_->inst == NULL);
|
||||
|
@ -34,19 +34,23 @@ class ACMISAC : public ACMGenericCodec, AudioDecoder {
|
||||
explicit ACMISAC(int16_t codec_id);
|
||||
~ACMISAC();
|
||||
|
||||
int16_t InternalInitDecoder(WebRtcACMCodecParams* codec_params);
|
||||
int16_t InternalInitDecoder(WebRtcACMCodecParams* codec_params)
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
// Methods below are inherited from ACMGenericCodec.
|
||||
ACMGenericCodec* CreateInstance(void) OVERRIDE;
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE;
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) OVERRIDE;
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t UpdateDecoderSampFreq(int16_t codec_id) OVERRIDE;
|
||||
|
||||
int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz) OVERRIDE;
|
||||
int16_t UpdateEncoderSampFreq(uint16_t samp_freq_hz) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t EncoderSampFreq(uint16_t* samp_freq_hz) OVERRIDE;
|
||||
|
||||
@ -95,12 +99,14 @@ class ACMISAC : public ACMGenericCodec, AudioDecoder {
|
||||
int32_t rate,
|
||||
bool is_red);
|
||||
|
||||
void UpdateFrameLen();
|
||||
void UpdateFrameLen() EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
// Methods below are inherited from ACMGenericCodec.
|
||||
void DestructEncoderSafe() OVERRIDE;
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t SetBitRateSafe(const int32_t bit_rate) OVERRIDE;
|
||||
int16_t SetBitRateSafe(const int32_t bit_rate) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int32_t GetEstimatedBandwidthSafe() OVERRIDE;
|
||||
|
||||
|
@ -28,7 +28,9 @@ class ACMOpus : public ACMGenericCodec {
|
||||
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams *codec_params);
|
||||
|
||||
@ -43,7 +45,8 @@ class ACMOpus : public ACMGenericCodec {
|
||||
|
||||
void InternalDestructEncoderInst(void* ptr_inst);
|
||||
|
||||
int16_t SetBitRateSafe(const int32_t rate);
|
||||
int16_t SetBitRateSafe(const int32_t rate) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
WebRtcOpusEncInst* encoder_inst_ptr_;
|
||||
uint16_t sample_freq_;
|
||||
|
@ -25,12 +25,15 @@ class ACMPCM16B : public ACMGenericCodec {
|
||||
// For FEC.
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
|
||||
|
||||
protected:
|
||||
void DestructEncoderSafe();
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalCreateEncoder();
|
||||
|
||||
|
@ -25,7 +25,9 @@ class ACMPCMA : public ACMGenericCodec {
|
||||
// For FEC.
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
|
||||
|
||||
|
@ -25,12 +25,15 @@ class ACMPCMU : public ACMGenericCodec {
|
||||
// For FEC.
|
||||
ACMGenericCodec* CreateInstance(void);
|
||||
|
||||
int16_t InternalEncode(uint8_t* bitstream, int16_t* bitstream_len_byte);
|
||||
int16_t InternalEncode(uint8_t* bitstream,
|
||||
int16_t* bitstream_len_byte) OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalInitEncoder(WebRtcACMCodecParams* codec_params);
|
||||
|
||||
protected:
|
||||
void DestructEncoderSafe();
|
||||
void DestructEncoderSafe() OVERRIDE
|
||||
EXCLUSIVE_LOCKS_REQUIRED(codec_wrapper_lock_);
|
||||
|
||||
int16_t InternalCreateEncoder();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user