Removed usage of the deprecated critical section constructor in audio_conference_mixer.
Review URL: http://webrtc-codereview.appspot.com/320007 git-svn-id: http://webrtc.googlecode.com/svn/trunk@1226 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
8a44259ea8
commit
cf5bcd1fd2
@ -230,7 +230,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::TimeUntilNextProcess()
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"TimeUntilNextProcess()");
|
"TimeUntilNextProcess()");
|
||||||
WebRtc_Word32 timeUntilNextProcess = 0;
|
WebRtc_Word32 timeUntilNextProcess = 0;
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
if(_timeScheduler.TimeToNextUpdate(timeUntilNextProcess) != 0)
|
if(_timeScheduler.TimeToNextUpdate(timeUntilNextProcess) != 0)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceError, kTraceAudioMixerServer, _id,
|
||||||
@ -247,7 +247,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
WebRtc_UWord32 remainingParticipantsAllowedToMix =
|
WebRtc_UWord32 remainingParticipantsAllowedToMix =
|
||||||
kMaximumAmountOfMixedParticipants;
|
kMaximumAmountOfMixedParticipants;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
assert(_processCalls == 0);
|
assert(_processCalls == 0);
|
||||||
_processCalls++;
|
_processCalls++;
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
ListWrapper additionalFramesList;
|
ListWrapper additionalFramesList;
|
||||||
MapWrapper mixedParticipantsMap;
|
MapWrapper mixedParticipantsMap;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
|
|
||||||
WebRtc_Word32 lowFreq = GetLowestMixingFrequency();
|
WebRtc_Word32 lowFreq = GetLowestMixingFrequency();
|
||||||
// SILK can run in 12 kHz and 24 kHz. These frequencies are not
|
// SILK can run in 12 kHz and 24 kHz. These frequencies are not
|
||||||
@ -276,7 +276,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
}
|
}
|
||||||
if(lowFreq <= 0)
|
if(lowFreq <= 0)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
_processCalls--;
|
_processCalls--;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
@ -303,7 +303,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
|
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
_processCalls--;
|
_processCalls--;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -348,7 +348,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
// TODO(henrike): it might be better to decide the number of channels
|
// TODO(henrike): it might be better to decide the number of channels
|
||||||
// with an API instead of dynamically.
|
// with an API instead of dynamically.
|
||||||
|
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
if (!SetNumLimiterChannels(numberOfChannels))
|
if (!SetNumLimiterChannels(numberOfChannels))
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
if(_mixReceiver != NULL)
|
if(_mixReceiver != NULL)
|
||||||
{
|
{
|
||||||
const AudioFrame** dummy = NULL;
|
const AudioFrame** dummy = NULL;
|
||||||
@ -424,7 +424,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
|||||||
ClearAudioFrameList(rampOutList);
|
ClearAudioFrameList(rampOutList);
|
||||||
ClearAudioFrameList(additionalFramesList);
|
ClearAudioFrameList(additionalFramesList);
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
_processCalls--;
|
_processCalls--;
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
@ -435,7 +435,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixedStreamCallback(
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"RegisterMixedStreamCallback(mixReceiver)");
|
"RegisterMixedStreamCallback(mixReceiver)");
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
if(_mixReceiver != NULL)
|
if(_mixReceiver != NULL)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -448,7 +448,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixedStreamCallback()
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"UnRegisterMixedStreamCallback()");
|
"UnRegisterMixedStreamCallback()");
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
if(_mixReceiver == NULL)
|
if(_mixReceiver == NULL)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
@ -460,7 +460,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixedStreamCallback()
|
|||||||
WebRtc_Word32 AudioConferenceMixerImpl::SetOutputFrequency(
|
WebRtc_Word32 AudioConferenceMixerImpl::SetOutputFrequency(
|
||||||
const Frequency frequency)
|
const Frequency frequency)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
const int error = _limiter->set_sample_rate_hz(frequency);
|
const int error = _limiter->set_sample_rate_hz(frequency);
|
||||||
if(error != _limiter->kNoError)
|
if(error != _limiter->kNoError)
|
||||||
{
|
{
|
||||||
@ -478,7 +478,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetOutputFrequency(
|
|||||||
AudioConferenceMixer::Frequency
|
AudioConferenceMixer::Frequency
|
||||||
AudioConferenceMixerImpl::OutputFrequency() const
|
AudioConferenceMixerImpl::OutputFrequency() const
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
return _outputFrequency;
|
return _outputFrequency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +520,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixerStatusCallback(
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
if(_mixerStatusCallback != NULL)
|
if(_mixerStatusCallback != NULL)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
|
||||||
@ -530,7 +530,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixerStatusCallback(
|
|||||||
_mixerStatusCallback = &mixerStatusCallback;
|
_mixerStatusCallback = &mixerStatusCallback;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
_amountOf10MsBetweenCallbacks = amountOf10MsBetweenCallbacks;
|
_amountOf10MsBetweenCallbacks = amountOf10MsBetweenCallbacks;
|
||||||
_amountOf10MsUntilNextCallback = 0;
|
_amountOf10MsUntilNextCallback = 0;
|
||||||
_mixerStatusCb = true;
|
_mixerStatusCb = true;
|
||||||
@ -543,7 +543,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixerStatusCallback()
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"UnRegisterMixerStatusCallback()");
|
"UnRegisterMixerStatusCallback()");
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
if(!_mixerStatusCb)
|
if(!_mixerStatusCb)
|
||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceWarning, kTraceAudioMixerServer, _id,
|
||||||
@ -553,7 +553,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixerStatusCallback()
|
|||||||
_mixerStatusCb = false;
|
_mixerStatusCb = false;
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
_mixerStatusCallback = NULL;
|
_mixerStatusCallback = NULL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -574,7 +574,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
|||||||
}
|
}
|
||||||
WebRtc_UWord32 amountOfMixableParticipants;
|
WebRtc_UWord32 amountOfMixableParticipants;
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
const bool isMixed =
|
const bool isMixed =
|
||||||
IsParticipantInList(participant,_participantList);
|
IsParticipantInList(participant,_participantList);
|
||||||
// API must be called with a new state.
|
// API must be called with a new state.
|
||||||
@ -607,7 +607,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
|||||||
// A MixerParticipant was added or removed. Make sure the scratch
|
// A MixerParticipant was added or removed. Make sure the scratch
|
||||||
// buffer is updated if necessary.
|
// buffer is updated if necessary.
|
||||||
// Note: The scratch buffer may only be updated in Process().
|
// Note: The scratch buffer may only be updated in Process().
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
_amountOfMixableParticipants = amountOfMixableParticipants;
|
_amountOfMixableParticipants = amountOfMixableParticipants;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -618,7 +618,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::MixabilityStatus(
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"MixabilityStatus(participant,mixable)");
|
"MixabilityStatus(participant,mixable)");
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
mixable = IsParticipantInList(participant, _participantList);
|
mixable = IsParticipantInList(participant, _participantList);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -628,7 +628,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::AmountOfMixables(
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"AmountOfMixables(amountOfMixableParticipants)");
|
"AmountOfMixables(amountOfMixableParticipants)");
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit.get());
|
||||||
amountOfMixableParticipants = _amountOfMixableParticipants;
|
amountOfMixableParticipants = _amountOfMixableParticipants;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -639,7 +639,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetAnonymousMixabilityStatus(
|
|||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"SetAnonymousMixabilityStatus(participant,anonymous:%s)",
|
"SetAnonymousMixabilityStatus(participant,anonymous:%s)",
|
||||||
anonymous ? "true" : "false");
|
anonymous ? "true" : "false");
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
if(IsParticipantInList(participant, _additionalParticipantList))
|
if(IsParticipantInList(participant, _additionalParticipantList))
|
||||||
{
|
{
|
||||||
if(anonymous)
|
if(anonymous)
|
||||||
@ -681,7 +681,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::AnonymousMixabilityStatus(
|
|||||||
{
|
{
|
||||||
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
WEBRTC_TRACE(kTraceModuleCall, kTraceAudioMixerServer, _id,
|
||||||
"AnonymousMixabilityStatus(participant,mixable)");
|
"AnonymousMixabilityStatus(participant,mixable)");
|
||||||
CriticalSectionScoped cs(*_cbCrit);
|
CriticalSectionScoped cs(_cbCrit.get());
|
||||||
mixable = IsParticipantInList(participant,
|
mixable = IsParticipantInList(participant,
|
||||||
_additionalParticipantList);
|
_additionalParticipantList);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -70,7 +70,7 @@ MemoryPoolImpl<MemoryType>::~MemoryPoolImpl()
|
|||||||
template<class MemoryType>
|
template<class MemoryType>
|
||||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
if(_terminate)
|
if(_terminate)
|
||||||
{
|
{
|
||||||
memory = NULL;
|
memory = NULL;
|
||||||
@ -101,7 +101,7 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
|||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
_outstandingMemory--;
|
_outstandingMemory--;
|
||||||
if(_memoryPool.GetSize() > (_initialPoolSize << 1))
|
if(_memoryPool.GetSize() > (_initialPoolSize << 1))
|
||||||
{
|
{
|
||||||
@ -119,14 +119,14 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
|||||||
template<class MemoryType>
|
template<class MemoryType>
|
||||||
bool MemoryPoolImpl<MemoryType>::Initialize()
|
bool MemoryPoolImpl<MemoryType>::Initialize()
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
return CreateMemory(_initialPoolSize) == 0;
|
return CreateMemory(_initialPoolSize) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class MemoryType>
|
template<class MemoryType>
|
||||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::Terminate()
|
WebRtc_Word32 MemoryPoolImpl<MemoryType>::Terminate()
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
assert(_createdMemory == _outstandingMemory + _memoryPool.GetSize());
|
assert(_createdMemory == _outstandingMemory + _memoryPool.GetSize());
|
||||||
|
|
||||||
_terminate = true;
|
_terminate = true;
|
||||||
|
@ -29,7 +29,7 @@ TimeScheduler::~TimeScheduler()
|
|||||||
|
|
||||||
WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
if(!_isStarted)
|
if(!_isStarted)
|
||||||
{
|
{
|
||||||
_isStarted = true;
|
_isStarted = true;
|
||||||
@ -79,7 +79,7 @@ WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
|||||||
WebRtc_Word32 TimeScheduler::TimeToNextUpdate(
|
WebRtc_Word32 TimeScheduler::TimeToNextUpdate(
|
||||||
WebRtc_Word32& updateTimeInMS) const
|
WebRtc_Word32& updateTimeInMS) const
|
||||||
{
|
{
|
||||||
CriticalSectionScoped cs(*_crit);
|
CriticalSectionScoped cs(_crit);
|
||||||
// Missed periods means that the next UpdateScheduler() should happen
|
// Missed periods means that the next UpdateScheduler() should happen
|
||||||
// immediately.
|
// immediately.
|
||||||
if(_missedPeriods > 0)
|
if(_missedPeriods > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user