Switch CriticalSectionWrapper->rtc::CriticalSection in modules/audio_coding.

This is a part of cleaning up CriticalSectionWrapper in general.

BUG=
R=henrik.lundin@webrtc.org

Review URL: https://codereview.webrtc.org/1610073003 .

Cr-Commit-Position: refs/heads/master@{#11319}
This commit is contained in:
Tommi
2016-01-20 13:39:36 +01:00
parent 84df580d52
commit 9090e0b147
12 changed files with 118 additions and 132 deletions

View File

@ -15,7 +15,6 @@
#include "webrtc/base/format_macros.h"
#include "webrtc/system_wrappers/include/tick_util.h"
#include "webrtc/system_wrappers/include/critical_section_wrapper.h"
namespace webrtc {
@ -95,7 +94,7 @@ int32_t Channel::SendData(FrameType frameType,
}
}
_channelCritSect->Enter();
_channelCritSect.Enter();
if (_saveBitStream) {
//fwrite(payloadData, sizeof(uint8_t), payloadSize, _bitStreamFile);
}
@ -106,7 +105,7 @@ int32_t Channel::SendData(FrameType frameType,
_useLastFrameSize = false;
_lastInTimestamp = timeStamp;
_totalBytes += payloadDataSize;
_channelCritSect->Leave();
_channelCritSect.Leave();
if (_useFECTestWithPacketLoss) {
_packetLoss += 1;
@ -225,7 +224,6 @@ void Channel::CalcStatistics(WebRtcRTPHeader& rtpInfo, size_t payloadSize) {
Channel::Channel(int16_t chID)
: _receiverACM(NULL),
_seqNo(0),
_channelCritSect(CriticalSectionWrapper::CreateCriticalSection()),
_bitStreamFile(NULL),
_saveBitStream(false),
_lastPayloadType(-1),
@ -265,7 +263,6 @@ Channel::Channel(int16_t chID)
}
Channel::~Channel() {
delete _channelCritSect;
}
void Channel::RegisterReceiverACM(AudioCodingModule* acm) {
@ -276,7 +273,7 @@ void Channel::RegisterReceiverACM(AudioCodingModule* acm) {
void Channel::ResetStats() {
int n;
int k;
_channelCritSect->Enter();
_channelCritSect.Enter();
_lastPayloadType = -1;
for (n = 0; n < MAX_NUM_PAYLOADS; n++) {
_payloadStats[n].payloadType = -1;
@ -291,12 +288,12 @@ void Channel::ResetStats() {
}
_beginTime = TickTime::MillisecondTimestamp();
_totalBytes = 0;
_channelCritSect->Leave();
_channelCritSect.Leave();
}
int16_t Channel::Stats(CodecInst& codecInst,
ACMTestPayloadStats& payloadStats) {
_channelCritSect->Enter();
_channelCritSect.Enter();
int n;
payloadStats.payloadType = -1;
for (n = 0; n < MAX_NUM_PAYLOADS; n++) {
@ -306,12 +303,12 @@ int16_t Channel::Stats(CodecInst& codecInst,
}
}
if (payloadStats.payloadType == -1) {
_channelCritSect->Leave();
_channelCritSect.Leave();
return -1;
}
for (n = 0; n < MAX_NUM_FRAMESIZES; n++) {
if (payloadStats.frameSizeStats[n].frameSizeSample == 0) {
_channelCritSect->Leave();
_channelCritSect.Leave();
return 0;
}
payloadStats.frameSizeStats[n].usageLenSec = (double) payloadStats
@ -322,12 +319,12 @@ int16_t Channel::Stats(CodecInst& codecInst,
/ payloadStats.frameSizeStats[n].usageLenSec;
}
_channelCritSect->Leave();
_channelCritSect.Leave();
return 0;
}
void Channel::Stats(uint32_t* numPackets) {
_channelCritSect->Enter();
_channelCritSect.Enter();
int k;
int n;
memset(numPackets, 0, MAX_NUM_PAYLOADS * sizeof(uint32_t));
@ -343,11 +340,11 @@ void Channel::Stats(uint32_t* numPackets) {
numPackets[k] += _payloadStats[k].frameSizeStats[n].numPackets;
}
}
_channelCritSect->Leave();
_channelCritSect.Leave();
}
void Channel::Stats(uint8_t* payloadType, uint32_t* payloadLenByte) {
_channelCritSect->Enter();
_channelCritSect.Enter();
int k;
int n;
@ -367,7 +364,7 @@ void Channel::Stats(uint8_t* payloadType, uint32_t* payloadLenByte) {
}
}
_channelCritSect->Leave();
_channelCritSect.Leave();
}
void Channel::PrintStats(CodecInst& codecInst) {
@ -406,18 +403,18 @@ void Channel::PrintStats(CodecInst& codecInst) {
uint32_t Channel::LastInTimestamp() {
uint32_t timestamp;
_channelCritSect->Enter();
_channelCritSect.Enter();
timestamp = _lastInTimestamp;
_channelCritSect->Leave();
_channelCritSect.Leave();
return timestamp;
}
double Channel::BitRate() {
double rate;
uint64_t currTime = TickTime::MillisecondTimestamp();
_channelCritSect->Enter();
_channelCritSect.Enter();
rate = ((double) _totalBytes * 8.0) / (double) (currTime - _beginTime);
_channelCritSect->Leave();
_channelCritSect.Leave();
return rate;
}