WebRtc_Word32 -> int32_t in audio_conference_mixer/
BUG=314 Review URL: https://webrtc-codereview.appspot.com/1306004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@3804 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
b09130763b
commit
ac891627c6
@ -40,44 +40,42 @@ public:
|
||||
virtual ~AudioConferenceMixer() {}
|
||||
|
||||
// Module functions
|
||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id) = 0;
|
||||
virtual WebRtc_Word32 TimeUntilNextProcess() = 0 ;
|
||||
virtual WebRtc_Word32 Process() = 0;
|
||||
virtual int32_t ChangeUniqueId(const int32_t id) = 0;
|
||||
virtual int32_t TimeUntilNextProcess() = 0 ;
|
||||
virtual int32_t Process() = 0;
|
||||
|
||||
// Register/unregister a callback class for receiving the mixed audio.
|
||||
virtual WebRtc_Word32 RegisterMixedStreamCallback(
|
||||
virtual int32_t RegisterMixedStreamCallback(
|
||||
AudioMixerOutputReceiver& receiver) = 0;
|
||||
virtual WebRtc_Word32 UnRegisterMixedStreamCallback() = 0;
|
||||
virtual int32_t UnRegisterMixedStreamCallback() = 0;
|
||||
|
||||
// Register/unregister a callback class for receiving status information.
|
||||
virtual WebRtc_Word32 RegisterMixerStatusCallback(
|
||||
virtual int32_t RegisterMixerStatusCallback(
|
||||
AudioMixerStatusReceiver& mixerStatusCallback,
|
||||
const WebRtc_UWord32 amountOf10MsBetweenCallbacks) = 0;
|
||||
virtual WebRtc_Word32 UnRegisterMixerStatusCallback() = 0;
|
||||
const uint32_t amountOf10MsBetweenCallbacks) = 0;
|
||||
virtual int32_t UnRegisterMixerStatusCallback() = 0;
|
||||
|
||||
// Add/remove participants as candidates for mixing.
|
||||
virtual WebRtc_Word32 SetMixabilityStatus(
|
||||
MixerParticipant& participant,
|
||||
virtual int32_t SetMixabilityStatus(MixerParticipant& participant,
|
||||
const bool mixable) = 0;
|
||||
// mixable is set to true if a participant is a candidate for mixing.
|
||||
virtual WebRtc_Word32 MixabilityStatus(
|
||||
MixerParticipant& participant,
|
||||
virtual int32_t MixabilityStatus(MixerParticipant& participant,
|
||||
bool& mixable) = 0;
|
||||
|
||||
// Inform the mixer that the participant should always be mixed and not
|
||||
// count toward the number of mixed participants. Note that a participant
|
||||
// must have been added to the mixer (by calling SetMixabilityStatus())
|
||||
// before this function can be successfully called.
|
||||
virtual WebRtc_Word32 SetAnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, const bool mixable) = 0;
|
||||
virtual int32_t SetAnonymousMixabilityStatus(MixerParticipant& participant,
|
||||
const bool mixable) = 0;
|
||||
// mixable is set to true if the participant is mixed anonymously.
|
||||
virtual WebRtc_Word32 AnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, bool& mixable) = 0;
|
||||
virtual int32_t AnonymousMixabilityStatus(MixerParticipant& participant,
|
||||
bool& mixable) = 0;
|
||||
|
||||
// Set the minimum sampling frequency at which to mix. The mixing algorithm
|
||||
// may still choose to mix at a higher samling frequency to avoid
|
||||
// downsampling of audio contributing to the mixed audio.
|
||||
virtual WebRtc_Word32 SetMinimumMixingFrequency(Frequency freq) = 0;
|
||||
virtual int32_t SetMinimumMixingFrequency(Frequency freq) = 0;
|
||||
|
||||
protected:
|
||||
AudioConferenceMixer() {}
|
||||
|
@ -26,15 +26,14 @@ public:
|
||||
// audio every time it's called.
|
||||
//
|
||||
// If it returns -1, the frame will not be added to the mix.
|
||||
virtual WebRtc_Word32 GetAudioFrame(const WebRtc_Word32 id,
|
||||
AudioFrame& audioFrame) = 0;
|
||||
virtual int32_t GetAudioFrame(const int32_t id, AudioFrame& audioFrame) = 0;
|
||||
|
||||
// mixed will be set to true if the participant was mixed this mix iteration
|
||||
WebRtc_Word32 IsMixed(bool& mixed) const;
|
||||
int32_t IsMixed(bool& mixed) const;
|
||||
|
||||
// This function specifies the sampling frequency needed for the AudioFrame
|
||||
// for future GetAudioFrame(..) calls.
|
||||
virtual WebRtc_Word32 NeededFrequency(const WebRtc_Word32 id) = 0;
|
||||
virtual int32_t NeededFrequency(const int32_t id) = 0;
|
||||
|
||||
MixHistory* _mixHistory;
|
||||
protected:
|
||||
@ -45,8 +44,8 @@ protected:
|
||||
// Container struct for participant statistics.
|
||||
struct ParticipantStatistics
|
||||
{
|
||||
WebRtc_Word32 participant;
|
||||
WebRtc_Word32 level;
|
||||
int32_t participant;
|
||||
int32_t level;
|
||||
};
|
||||
|
||||
class AudioMixerStatusReceiver
|
||||
@ -55,20 +54,20 @@ public:
|
||||
// Callback function that provides an array of ParticipantStatistics for the
|
||||
// participants that were mixed last mix iteration.
|
||||
virtual void MixedParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size) = 0;
|
||||
const uint32_t size) = 0;
|
||||
// Callback function that provides an array of the ParticipantStatistics for
|
||||
// the participants that had a positiv VAD last mix iteration.
|
||||
virtual void VADPositiveParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size) = 0;
|
||||
const uint32_t size) = 0;
|
||||
// Callback function that provides the audio level of the mixed audio frame
|
||||
// from the last mix iteration.
|
||||
virtual void MixedAudioLevel(
|
||||
const WebRtc_Word32 id,
|
||||
const WebRtc_UWord32 level) = 0;
|
||||
const int32_t id,
|
||||
const uint32_t level) = 0;
|
||||
protected:
|
||||
AudioMixerStatusReceiver() {}
|
||||
virtual ~AudioMixerStatusReceiver() {}
|
||||
@ -80,10 +79,10 @@ public:
|
||||
// This callback function provides the mixed audio for this mix iteration.
|
||||
// Note that uniqueAudioFrames is an array of AudioFrame pointers with the
|
||||
// size according to the size parameter.
|
||||
virtual void NewMixedAudio(const WebRtc_Word32 id,
|
||||
virtual void NewMixedAudio(const int32_t id,
|
||||
const AudioFrame& generalAudioFrame,
|
||||
const AudioFrame** uniqueAudioFrames,
|
||||
const WebRtc_UWord32 size) = 0;
|
||||
const uint32_t size) = 0;
|
||||
protected:
|
||||
AudioMixerOutputReceiver() {}
|
||||
virtual ~AudioMixerOutputReceiver() {}
|
||||
@ -95,7 +94,7 @@ public:
|
||||
// This callback function provides the mix decision for this mix iteration.
|
||||
// mixerList is a list of elements of the type
|
||||
// [int,MixerParticipant*]
|
||||
virtual void NewAudioToRelay(const WebRtc_Word32 id,
|
||||
virtual void NewAudioToRelay(const int32_t id,
|
||||
const MapWrapper& mixerList) = 0;
|
||||
protected:
|
||||
AudioRelayReceiver() {}
|
||||
|
@ -71,7 +71,7 @@ MixerParticipant::~MixerParticipant()
|
||||
delete _mixHistory;
|
||||
}
|
||||
|
||||
WebRtc_Word32 MixerParticipant::IsMixed(bool& mixed) const
|
||||
int32_t MixerParticipant::IsMixed(bool& mixed) const
|
||||
{
|
||||
return _mixHistory->IsMixed(mixed);
|
||||
}
|
||||
@ -85,20 +85,20 @@ MixHistory::~MixHistory()
|
||||
{
|
||||
}
|
||||
|
||||
WebRtc_Word32 MixHistory::IsMixed(bool& mixed) const
|
||||
int32_t MixHistory::IsMixed(bool& mixed) const
|
||||
{
|
||||
mixed = _isMixed;
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 MixHistory::WasMixed(bool& wasMixed) const
|
||||
int32_t MixHistory::WasMixed(bool& wasMixed) const
|
||||
{
|
||||
// Was mixed is the same as is mixed depending on perspective. This function
|
||||
// is for the perspective of AudioConferenceMixerImpl.
|
||||
return IsMixed(wasMixed);
|
||||
}
|
||||
|
||||
WebRtc_Word32 MixHistory::SetIsMixed(const bool mixed)
|
||||
int32_t MixHistory::SetIsMixed(const bool mixed)
|
||||
{
|
||||
_isMixed = mixed;
|
||||
return 0;
|
||||
@ -202,16 +202,16 @@ AudioConferenceMixerImpl::~AudioConferenceMixerImpl()
|
||||
assert(_audioFramePool == NULL);
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::ChangeUniqueId(const WebRtc_Word32 id)
|
||||
int32_t AudioConferenceMixerImpl::ChangeUniqueId(const int32_t id)
|
||||
{
|
||||
_id = id;
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Process should be called every kProcessPeriodicityInMs ms
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::TimeUntilNextProcess()
|
||||
int32_t AudioConferenceMixerImpl::TimeUntilNextProcess()
|
||||
{
|
||||
WebRtc_Word32 timeUntilNextProcess = 0;
|
||||
int32_t timeUntilNextProcess = 0;
|
||||
CriticalSectionScoped cs(_crit.get());
|
||||
if(_timeScheduler.TimeToNextUpdate(timeUntilNextProcess) != 0)
|
||||
{
|
||||
@ -224,9 +224,9 @@ WebRtc_Word32 AudioConferenceMixerImpl::TimeUntilNextProcess()
|
||||
return timeUntilNextProcess;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
||||
int32_t AudioConferenceMixerImpl::Process()
|
||||
{
|
||||
WebRtc_UWord32 remainingParticipantsAllowedToMix =
|
||||
uint32_t remainingParticipantsAllowedToMix =
|
||||
kMaximumAmountOfMixedParticipants;
|
||||
{
|
||||
CriticalSectionScoped cs(_crit.get());
|
||||
@ -244,7 +244,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
|
||||
WebRtc_Word32 lowFreq = GetLowestMixingFrequency();
|
||||
int32_t lowFreq = GetLowestMixingFrequency();
|
||||
// SILK can run in 12 kHz and 24 kHz. These frequencies are not
|
||||
// supported so use the closest higher frequency to not lose any
|
||||
// information.
|
||||
@ -322,7 +322,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
||||
|
||||
bool timeForMixerCallback = false;
|
||||
int retval = 0;
|
||||
WebRtc_Word32 audioLevel = 0;
|
||||
int32_t audioLevel = 0;
|
||||
{
|
||||
CriticalSectionScoped cs(_crit.get());
|
||||
|
||||
@ -415,7 +415,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::Process()
|
||||
return retval;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixedStreamCallback(
|
||||
int32_t AudioConferenceMixerImpl::RegisterMixedStreamCallback(
|
||||
AudioMixerOutputReceiver& mixReceiver)
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
@ -427,7 +427,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixedStreamCallback(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixedStreamCallback()
|
||||
int32_t AudioConferenceMixerImpl::UnRegisterMixedStreamCallback()
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
if(_mixReceiver == NULL)
|
||||
@ -438,7 +438,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixedStreamCallback()
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::SetOutputFrequency(
|
||||
int32_t AudioConferenceMixerImpl::SetOutputFrequency(
|
||||
const Frequency frequency)
|
||||
{
|
||||
CriticalSectionScoped cs(_crit.get());
|
||||
@ -481,9 +481,9 @@ bool AudioConferenceMixerImpl::SetNumLimiterChannels(int numChannels)
|
||||
return true;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixerStatusCallback(
|
||||
int32_t AudioConferenceMixerImpl::RegisterMixerStatusCallback(
|
||||
AudioMixerStatusReceiver& mixerStatusCallback,
|
||||
const WebRtc_UWord32 amountOf10MsBetweenCallbacks)
|
||||
const uint32_t amountOf10MsBetweenCallbacks)
|
||||
{
|
||||
if(amountOf10MsBetweenCallbacks == 0)
|
||||
{
|
||||
@ -513,7 +513,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::RegisterMixerStatusCallback(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixerStatusCallback()
|
||||
int32_t AudioConferenceMixerImpl::UnRegisterMixerStatusCallback()
|
||||
{
|
||||
{
|
||||
CriticalSectionScoped cs(_crit.get());
|
||||
@ -532,7 +532,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::UnRegisterMixerStatusCallback()
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
||||
int32_t AudioConferenceMixerImpl::SetMixabilityStatus(
|
||||
MixerParticipant& participant,
|
||||
const bool mixable)
|
||||
{
|
||||
@ -542,7 +542,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
||||
// participant is in the _participantList if it is being mixed.
|
||||
SetAnonymousMixabilityStatus(participant, false);
|
||||
}
|
||||
WebRtc_UWord32 numMixedParticipants;
|
||||
uint32_t numMixedParticipants;
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
const bool isMixed =
|
||||
@ -589,7 +589,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMixabilityStatus(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::MixabilityStatus(
|
||||
int32_t AudioConferenceMixerImpl::MixabilityStatus(
|
||||
MixerParticipant& participant,
|
||||
bool& mixable)
|
||||
{
|
||||
@ -598,7 +598,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::MixabilityStatus(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::SetAnonymousMixabilityStatus(
|
||||
int32_t AudioConferenceMixerImpl::SetAnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, const bool anonymous)
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
@ -638,7 +638,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetAnonymousMixabilityStatus(
|
||||
0 : -1;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::AnonymousMixabilityStatus(
|
||||
int32_t AudioConferenceMixerImpl::AnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, bool& mixable)
|
||||
{
|
||||
CriticalSectionScoped cs(_cbCrit.get());
|
||||
@ -647,7 +647,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::AnonymousMixabilityStatus(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::SetMinimumMixingFrequency(
|
||||
int32_t AudioConferenceMixerImpl::SetMinimumMixingFrequency(
|
||||
Frequency freq)
|
||||
{
|
||||
// Make sure that only allowed sampling frequencies are used. Use closest
|
||||
@ -676,7 +676,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::SetMinimumMixingFrequency(
|
||||
|
||||
// Check all AudioFrames that are to be mixed. The highest sampling frequency
|
||||
// found is the lowest that can be used without losing information.
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::GetLowestMixingFrequency()
|
||||
int32_t AudioConferenceMixerImpl::GetLowestMixingFrequency()
|
||||
{
|
||||
const int participantListFrequency =
|
||||
GetLowestMixingFrequencyFromList(_participantList);
|
||||
@ -696,16 +696,16 @@ WebRtc_Word32 AudioConferenceMixerImpl::GetLowestMixingFrequency()
|
||||
return highestFreq;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::GetLowestMixingFrequencyFromList(
|
||||
int32_t AudioConferenceMixerImpl::GetLowestMixingFrequencyFromList(
|
||||
ListWrapper& mixList)
|
||||
{
|
||||
WebRtc_Word32 highestFreq = 8000;
|
||||
int32_t highestFreq = 8000;
|
||||
ListItem* item = mixList.First();
|
||||
while(item)
|
||||
{
|
||||
MixerParticipant* participant =
|
||||
static_cast<MixerParticipant*>(item->GetItem());
|
||||
const WebRtc_Word32 neededFrequency = participant->NeededFrequency(_id);
|
||||
const int32_t neededFrequency = participant->NeededFrequency(_id);
|
||||
if(neededFrequency > highestFreq)
|
||||
{
|
||||
highestFreq = neededFrequency;
|
||||
@ -719,12 +719,12 @@ void AudioConferenceMixerImpl::UpdateToMix(
|
||||
ListWrapper& mixList,
|
||||
ListWrapper& rampOutList,
|
||||
MapWrapper& mixParticipantList,
|
||||
WebRtc_UWord32& maxAudioFrameCounter)
|
||||
uint32_t& maxAudioFrameCounter)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
|
||||
"UpdateToMix(mixList,rampOutList,mixParticipantList,%d)",
|
||||
maxAudioFrameCounter);
|
||||
const WebRtc_UWord32 mixListStartSize = mixList.GetSize();
|
||||
const uint32_t mixListStartSize = mixList.GetSize();
|
||||
ListWrapper activeList; // Elements are AudioFrames
|
||||
// Struct needed by the passive lists to keep track of which AudioFrame
|
||||
// belongs to which MixerParticipant.
|
||||
@ -790,7 +790,7 @@ void AudioConferenceMixerImpl::UpdateToMix(
|
||||
// mixed. Only keep the ones with the highest energy.
|
||||
ListItem* replaceItem = NULL;
|
||||
CalculateEnergy(*audioFrame);
|
||||
WebRtc_UWord32 lowestEnergy = audioFrame->energy_;
|
||||
uint32_t lowestEnergy = audioFrame->energy_;
|
||||
|
||||
ListItem* activeItem = activeList.First();
|
||||
while(activeItem)
|
||||
@ -1108,13 +1108,13 @@ bool AudioConferenceMixerImpl::RemoveParticipantFromList(
|
||||
return false;
|
||||
}
|
||||
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::MixFromList(
|
||||
int32_t AudioConferenceMixerImpl::MixFromList(
|
||||
AudioFrame& mixedAudio,
|
||||
const ListWrapper& audioFrameList)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceStream, kTraceAudioMixerServer, _id,
|
||||
"MixFromList(mixedAudio, audioFrameList)");
|
||||
WebRtc_UWord32 position = 0;
|
||||
uint32_t position = 0;
|
||||
ListItem* item = audioFrameList.First();
|
||||
if(item == NULL)
|
||||
{
|
||||
@ -1159,7 +1159,7 @@ WebRtc_Word32 AudioConferenceMixerImpl::MixFromList(
|
||||
}
|
||||
|
||||
// TODO(andrew): consolidate this function with MixFromList.
|
||||
WebRtc_Word32 AudioConferenceMixerImpl::MixAnonomouslyFromList(
|
||||
int32_t AudioConferenceMixerImpl::MixAnonomouslyFromList(
|
||||
AudioFrame& mixedAudio,
|
||||
const ListWrapper& audioFrameList)
|
||||
{
|
||||
|
@ -32,14 +32,14 @@ public:
|
||||
~MixHistory();
|
||||
|
||||
// MixerParticipant function
|
||||
WebRtc_Word32 IsMixed(bool& mixed) const;
|
||||
int32_t IsMixed(bool& mixed) const;
|
||||
|
||||
// Sets wasMixed to true if the participant was mixed previous mix
|
||||
// iteration.
|
||||
WebRtc_Word32 WasMixed(bool& wasMixed) const;
|
||||
int32_t WasMixed(bool& wasMixed) const;
|
||||
|
||||
// Updates the mixed status.
|
||||
WebRtc_Word32 SetIsMixed(const bool mixed);
|
||||
int32_t SetIsMixed(const bool mixed);
|
||||
|
||||
void ResetMixedStatus();
|
||||
private:
|
||||
@ -59,32 +59,32 @@ public:
|
||||
bool Init();
|
||||
|
||||
// Module functions
|
||||
virtual WebRtc_Word32 ChangeUniqueId(const WebRtc_Word32 id);
|
||||
virtual WebRtc_Word32 TimeUntilNextProcess();
|
||||
virtual WebRtc_Word32 Process();
|
||||
virtual int32_t ChangeUniqueId(const int32_t id);
|
||||
virtual int32_t TimeUntilNextProcess();
|
||||
virtual int32_t Process();
|
||||
|
||||
// AudioConferenceMixer functions
|
||||
virtual WebRtc_Word32 RegisterMixedStreamCallback(
|
||||
virtual int32_t RegisterMixedStreamCallback(
|
||||
AudioMixerOutputReceiver& mixReceiver);
|
||||
virtual WebRtc_Word32 UnRegisterMixedStreamCallback();
|
||||
virtual WebRtc_Word32 RegisterMixerStatusCallback(
|
||||
virtual int32_t UnRegisterMixedStreamCallback();
|
||||
virtual int32_t RegisterMixerStatusCallback(
|
||||
AudioMixerStatusReceiver& mixerStatusCallback,
|
||||
const WebRtc_UWord32 amountOf10MsBetweenCallbacks);
|
||||
virtual WebRtc_Word32 UnRegisterMixerStatusCallback();
|
||||
virtual WebRtc_Word32 SetMixabilityStatus(MixerParticipant& participant,
|
||||
const uint32_t amountOf10MsBetweenCallbacks);
|
||||
virtual int32_t UnRegisterMixerStatusCallback();
|
||||
virtual int32_t SetMixabilityStatus(MixerParticipant& participant,
|
||||
const bool mixable);
|
||||
virtual WebRtc_Word32 MixabilityStatus(MixerParticipant& participant,
|
||||
virtual int32_t MixabilityStatus(MixerParticipant& participant,
|
||||
bool& mixable);
|
||||
virtual WebRtc_Word32 SetMinimumMixingFrequency(Frequency freq);
|
||||
virtual WebRtc_Word32 SetAnonymousMixabilityStatus(
|
||||
virtual int32_t SetMinimumMixingFrequency(Frequency freq);
|
||||
virtual int32_t SetAnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, const bool mixable);
|
||||
virtual WebRtc_Word32 AnonymousMixabilityStatus(
|
||||
virtual int32_t AnonymousMixabilityStatus(
|
||||
MixerParticipant& participant, bool& mixable);
|
||||
private:
|
||||
enum{DEFAULT_AUDIO_FRAME_POOLSIZE = 50};
|
||||
|
||||
// Set/get mix frequency
|
||||
WebRtc_Word32 SetOutputFrequency(const Frequency frequency);
|
||||
int32_t SetOutputFrequency(const Frequency frequency);
|
||||
Frequency OutputFrequency() const;
|
||||
|
||||
// Must be called whenever an audio frame indicates the number of channels
|
||||
@ -101,12 +101,12 @@ private:
|
||||
// should be ramped out over this AudioFrame to avoid audio discontinuities.
|
||||
void UpdateToMix(ListWrapper& mixList, ListWrapper& rampOutList,
|
||||
MapWrapper& mixParticipantList,
|
||||
WebRtc_UWord32& maxAudioFrameCounter);
|
||||
uint32_t& maxAudioFrameCounter);
|
||||
|
||||
// Return the lowest mixing frequency that can be used without having to
|
||||
// downsample any audio.
|
||||
WebRtc_Word32 GetLowestMixingFrequency();
|
||||
WebRtc_Word32 GetLowestMixingFrequencyFromList(ListWrapper& mixList);
|
||||
int32_t GetLowestMixingFrequency();
|
||||
int32_t GetLowestMixingFrequencyFromList(ListWrapper& mixList);
|
||||
|
||||
// Return the AudioFrames that should be mixed anonymously.
|
||||
void GetAdditionalAudio(ListWrapper& additionalFramesList);
|
||||
@ -139,13 +139,13 @@ private:
|
||||
ListWrapper& participantList);
|
||||
|
||||
// Mix the AudioFrames stored in audioFrameList into mixedAudio.
|
||||
WebRtc_Word32 MixFromList(
|
||||
int32_t MixFromList(
|
||||
AudioFrame& mixedAudio,
|
||||
const ListWrapper& audioFrameList);
|
||||
// Mix the AudioFrames stored in audioFrameList into mixedAudio. No
|
||||
// record will be kept of this mix (e.g. the corresponding MixerParticipants
|
||||
// will not be marked as IsMixed()
|
||||
WebRtc_Word32 MixAnonomouslyFromList(AudioFrame& mixedAudio,
|
||||
int32_t MixAnonomouslyFromList(AudioFrame& mixedAudio,
|
||||
const ListWrapper& audioFrameList);
|
||||
|
||||
bool LimitMixedAudio(AudioFrame& mixedAudio);
|
||||
@ -153,17 +153,17 @@ private:
|
||||
// Scratch memory
|
||||
// Note that the scratch memory may only be touched in the scope of
|
||||
// Process().
|
||||
WebRtc_UWord32 _scratchParticipantsToMixAmount;
|
||||
uint32_t _scratchParticipantsToMixAmount;
|
||||
ParticipantStatistics _scratchMixedParticipants[
|
||||
kMaximumAmountOfMixedParticipants];
|
||||
WebRtc_UWord32 _scratchVadPositiveParticipantsAmount;
|
||||
uint32_t _scratchVadPositiveParticipantsAmount;
|
||||
ParticipantStatistics _scratchVadPositiveParticipants[
|
||||
kMaximumAmountOfMixedParticipants];
|
||||
|
||||
scoped_ptr<CriticalSectionWrapper> _crit;
|
||||
scoped_ptr<CriticalSectionWrapper> _cbCrit;
|
||||
|
||||
WebRtc_Word32 _id;
|
||||
int32_t _id;
|
||||
|
||||
Frequency _minimumMixingFreq;
|
||||
|
||||
@ -171,13 +171,13 @@ private:
|
||||
AudioMixerOutputReceiver* _mixReceiver;
|
||||
|
||||
AudioMixerStatusReceiver* _mixerStatusCallback;
|
||||
WebRtc_UWord32 _amountOf10MsBetweenCallbacks;
|
||||
WebRtc_UWord32 _amountOf10MsUntilNextCallback;
|
||||
uint32_t _amountOf10MsBetweenCallbacks;
|
||||
uint32_t _amountOf10MsUntilNextCallback;
|
||||
bool _mixerStatusCb;
|
||||
|
||||
// The current sample frequency and sample size when mixing.
|
||||
Frequency _outputFrequency;
|
||||
WebRtc_UWord16 _sampleSize;
|
||||
uint16_t _sampleSize;
|
||||
|
||||
// Memory pool to avoid allocating/deallocating AudioFrames
|
||||
MemoryPool<AudioFrame>* _audioFramePool;
|
||||
@ -186,9 +186,9 @@ private:
|
||||
ListWrapper _participantList; // May be mixed.
|
||||
ListWrapper _additionalParticipantList; // Always mixed, anonomously.
|
||||
|
||||
WebRtc_UWord32 _numMixedParticipants;
|
||||
uint32_t _numMixedParticipants;
|
||||
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint32_t _timeStamp;
|
||||
|
||||
// Metronome class.
|
||||
TimeScheduler _timeScheduler;
|
||||
@ -198,7 +198,7 @@ private:
|
||||
|
||||
// Counter keeping track of concurrent calls to process.
|
||||
// Note: should never be higher than 1 or lower than 0.
|
||||
WebRtc_Word16 _processCalls;
|
||||
int16_t _processCalls;
|
||||
|
||||
// Used for inhibiting saturation in mixing.
|
||||
scoped_ptr<AudioProcessing> _limiter;
|
||||
|
@ -60,8 +60,8 @@ void RampIn(AudioFrame& audioFrame)
|
||||
assert(rampSize <= audioFrame.samples_per_channel_);
|
||||
for(int i = 0; i < rampSize; i++)
|
||||
{
|
||||
audioFrame.data_[i] = static_cast<WebRtc_Word16>
|
||||
(rampArray[i] * audioFrame.data_[i]);
|
||||
audioFrame.data_[i] = static_cast<int16_t>(rampArray[i] *
|
||||
audioFrame.data_[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,8 @@ void RampOut(AudioFrame& audioFrame)
|
||||
for(int i = 0; i < rampSize; i++)
|
||||
{
|
||||
const int rampPos = rampSize - 1 - i;
|
||||
audioFrame.data_[i] = static_cast<WebRtc_Word16>
|
||||
(rampArray[rampPos] * audioFrame.data_[i]);
|
||||
audioFrame.data_[i] = static_cast<int16_t>(rampArray[rampPos] *
|
||||
audioFrame.data_[i]);
|
||||
}
|
||||
memset(&audioFrame.data_[rampSize], 0,
|
||||
(audioFrame.samples_per_channel_ - rampSize) *
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
namespace webrtc {
|
||||
// Array for adding smothing to level changes (ad-hoc).
|
||||
const WebRtc_UWord32 perm[] =
|
||||
const uint32_t perm[] =
|
||||
{0,1,2,3,4,4,5,5,5,5,6,6,6,6,6,7,7,7,7,8,8,8,9,9,9,9,9,9,9,9,9,9,9};
|
||||
|
||||
LevelIndicator::LevelIndicator()
|
||||
@ -27,11 +27,11 @@ LevelIndicator::~LevelIndicator()
|
||||
}
|
||||
|
||||
// Level is based on the highest absolute value for all samples.
|
||||
void LevelIndicator::ComputeLevel(const WebRtc_Word16* speech,
|
||||
const WebRtc_UWord16 nrOfSamples)
|
||||
void LevelIndicator::ComputeLevel(const int16_t* speech,
|
||||
const uint16_t nrOfSamples)
|
||||
{
|
||||
WebRtc_Word32 min = 0;
|
||||
for(WebRtc_UWord32 i = 0; i < nrOfSamples; i++)
|
||||
int32_t min = 0;
|
||||
for(uint32_t i = 0; i < nrOfSamples; i++)
|
||||
{
|
||||
if(_max < speech[i])
|
||||
{
|
||||
@ -52,7 +52,7 @@ void LevelIndicator::ComputeLevel(const WebRtc_Word16* speech,
|
||||
if(_count == TICKS_BEFORE_CALCULATION)
|
||||
{
|
||||
// Highest sample value maps directly to a level.
|
||||
WebRtc_Word32 position = _max / 1000;
|
||||
int32_t position = _max / 1000;
|
||||
if ((position == 0) &&
|
||||
(_max > 250))
|
||||
{
|
||||
@ -68,7 +68,7 @@ void LevelIndicator::ComputeLevel(const WebRtc_Word16* speech,
|
||||
}
|
||||
}
|
||||
|
||||
WebRtc_Word32 LevelIndicator::GetLevel()
|
||||
int32_t LevelIndicator::GetLevel()
|
||||
{
|
||||
return _currentLevel;
|
||||
}
|
||||
|
@ -23,14 +23,14 @@ public:
|
||||
~LevelIndicator();
|
||||
|
||||
// Updates the level.
|
||||
void ComputeLevel(const WebRtc_Word16* speech,
|
||||
const WebRtc_UWord16 nrOfSamples);
|
||||
void ComputeLevel(const int16_t* speech,
|
||||
const uint16_t nrOfSamples);
|
||||
|
||||
WebRtc_Word32 GetLevel();
|
||||
int32_t GetLevel();
|
||||
private:
|
||||
WebRtc_Word32 _max;
|
||||
WebRtc_UWord32 _count;
|
||||
WebRtc_UWord32 _currentLevel;
|
||||
int32_t _max;
|
||||
uint32_t _count;
|
||||
uint32_t _currentLevel;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -28,26 +28,26 @@ class MemoryPool
|
||||
{
|
||||
public:
|
||||
// Factory method, constructor disabled.
|
||||
static WebRtc_Word32 CreateMemoryPool(MemoryPool*& memoryPool,
|
||||
WebRtc_UWord32 initialPoolSize);
|
||||
static int32_t CreateMemoryPool(MemoryPool*& memoryPool,
|
||||
uint32_t initialPoolSize);
|
||||
|
||||
// Try to delete the memory pool. Fail with return value -1 if there is
|
||||
// outstanding memory.
|
||||
static WebRtc_Word32 DeleteMemoryPool(
|
||||
static int32_t DeleteMemoryPool(
|
||||
MemoryPool*& memoryPool);
|
||||
|
||||
// Get/return unused memory.
|
||||
WebRtc_Word32 PopMemory(MemoryType*& memory);
|
||||
WebRtc_Word32 PushMemory(MemoryType*& memory);
|
||||
int32_t PopMemory(MemoryType*& memory);
|
||||
int32_t PushMemory(MemoryType*& memory);
|
||||
private:
|
||||
MemoryPool(WebRtc_Word32 initialPoolSize);
|
||||
MemoryPool(int32_t initialPoolSize);
|
||||
~MemoryPool();
|
||||
|
||||
MemoryPoolImpl<MemoryType>* _ptrImpl;
|
||||
};
|
||||
|
||||
template<class MemoryType>
|
||||
MemoryPool<MemoryType>::MemoryPool(WebRtc_Word32 initialPoolSize)
|
||||
MemoryPool<MemoryType>::MemoryPool(int32_t initialPoolSize)
|
||||
{
|
||||
_ptrImpl = new MemoryPoolImpl<MemoryType>(initialPoolSize);
|
||||
}
|
||||
@ -58,9 +58,9 @@ MemoryPool<MemoryType>::~MemoryPool()
|
||||
delete _ptrImpl;
|
||||
}
|
||||
|
||||
template<class MemoryType> WebRtc_Word32
|
||||
template<class MemoryType> int32_t
|
||||
MemoryPool<MemoryType>::CreateMemoryPool(MemoryPool*& memoryPool,
|
||||
WebRtc_UWord32 initialPoolSize)
|
||||
uint32_t initialPoolSize)
|
||||
{
|
||||
memoryPool = new MemoryPool(initialPoolSize);
|
||||
if(memoryPool == NULL)
|
||||
@ -83,7 +83,7 @@ MemoryPool<MemoryType>::CreateMemoryPool(MemoryPool*& memoryPool,
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPool<MemoryType>::DeleteMemoryPool(MemoryPool*& memoryPool)
|
||||
int32_t MemoryPool<MemoryType>::DeleteMemoryPool(MemoryPool*& memoryPool)
|
||||
{
|
||||
if(memoryPool == NULL)
|
||||
{
|
||||
@ -103,13 +103,13 @@ WebRtc_Word32 MemoryPool<MemoryType>::DeleteMemoryPool(MemoryPool*& memoryPool)
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPool<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
int32_t MemoryPool<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
{
|
||||
return _ptrImpl->PopMemory(memory);
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPool<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
int32_t MemoryPool<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
{
|
||||
if(memory == NULL)
|
||||
{
|
||||
|
@ -23,18 +23,18 @@ class MemoryPoolImpl
|
||||
{
|
||||
public:
|
||||
// MemoryPool functions.
|
||||
WebRtc_Word32 PopMemory(MemoryType*& memory);
|
||||
WebRtc_Word32 PushMemory(MemoryType*& memory);
|
||||
int32_t PopMemory(MemoryType*& memory);
|
||||
int32_t PushMemory(MemoryType*& memory);
|
||||
|
||||
MemoryPoolImpl(WebRtc_Word32 initialPoolSize);
|
||||
MemoryPoolImpl(int32_t initialPoolSize);
|
||||
~MemoryPoolImpl();
|
||||
|
||||
// Atomic functions
|
||||
WebRtc_Word32 Terminate();
|
||||
int32_t Terminate();
|
||||
bool Initialize();
|
||||
private:
|
||||
// Non-atomic function.
|
||||
WebRtc_Word32 CreateMemory(WebRtc_UWord32 amountToCreate);
|
||||
int32_t CreateMemory(uint32_t amountToCreate);
|
||||
|
||||
CriticalSectionWrapper* _crit;
|
||||
|
||||
@ -42,13 +42,13 @@ private:
|
||||
|
||||
ListWrapper _memoryPool;
|
||||
|
||||
WebRtc_UWord32 _initialPoolSize;
|
||||
WebRtc_UWord32 _createdMemory;
|
||||
WebRtc_UWord32 _outstandingMemory;
|
||||
uint32_t _initialPoolSize;
|
||||
uint32_t _createdMemory;
|
||||
uint32_t _outstandingMemory;
|
||||
};
|
||||
|
||||
template<class MemoryType>
|
||||
MemoryPoolImpl<MemoryType>::MemoryPoolImpl(WebRtc_Word32 initialPoolSize)
|
||||
MemoryPoolImpl<MemoryType>::MemoryPoolImpl(int32_t initialPoolSize)
|
||||
: _crit(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_terminate(false),
|
||||
_memoryPool(),
|
||||
@ -68,7 +68,7 @@ MemoryPoolImpl<MemoryType>::~MemoryPoolImpl()
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
int32_t MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
{
|
||||
CriticalSectionScoped cs(_crit);
|
||||
if(_terminate)
|
||||
@ -95,7 +95,7 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
int32_t MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
{
|
||||
if(memory == NULL)
|
||||
{
|
||||
@ -124,7 +124,7 @@ bool MemoryPoolImpl<MemoryType>::Initialize()
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::Terminate()
|
||||
int32_t MemoryPoolImpl<MemoryType>::Terminate()
|
||||
{
|
||||
CriticalSectionScoped cs(_crit);
|
||||
assert(_createdMemory == _outstandingMemory + _memoryPool.GetSize());
|
||||
@ -148,10 +148,10 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::Terminate()
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::CreateMemory(
|
||||
WebRtc_UWord32 amountToCreate)
|
||||
int32_t MemoryPoolImpl<MemoryType>::CreateMemory(
|
||||
uint32_t amountToCreate)
|
||||
{
|
||||
for(WebRtc_UWord32 i = 0; i < amountToCreate; i++)
|
||||
for(uint32_t i = 0; i < amountToCreate; i++)
|
||||
{
|
||||
MemoryType* memory = new MemoryType();
|
||||
if(memory == NULL)
|
||||
|
@ -47,14 +47,14 @@ class MemoryPoolImpl
|
||||
{
|
||||
public:
|
||||
// MemoryPool functions.
|
||||
WebRtc_Word32 PopMemory(MemoryType*& memory);
|
||||
WebRtc_Word32 PushMemory(MemoryType*& memory);
|
||||
int32_t PopMemory(MemoryType*& memory);
|
||||
int32_t PushMemory(MemoryType*& memory);
|
||||
|
||||
MemoryPoolImpl(WebRtc_Word32 /*initialPoolSize*/);
|
||||
MemoryPoolImpl(int32_t /*initialPoolSize*/);
|
||||
~MemoryPoolImpl();
|
||||
|
||||
// Atomic functions.
|
||||
WebRtc_Word32 Terminate();
|
||||
int32_t Terminate();
|
||||
bool Initialize();
|
||||
private:
|
||||
// Non-atomic function.
|
||||
@ -72,7 +72,7 @@ private:
|
||||
|
||||
template<class MemoryType>
|
||||
MemoryPoolImpl<MemoryType>::MemoryPoolImpl(
|
||||
WebRtc_Word32 /*initialPoolSize*/)
|
||||
int32_t /*initialPoolSize*/)
|
||||
: _pListHead(NULL),
|
||||
_createdMemory(0),
|
||||
_outstandingMemory(0)
|
||||
@ -94,7 +94,7 @@ MemoryPoolImpl<MemoryType>::~MemoryPoolImpl()
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
int32_t MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
{
|
||||
PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(_pListHead);
|
||||
if(pListEntry == NULL)
|
||||
@ -112,7 +112,7 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::PopMemory(MemoryType*& memory)
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
int32_t MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
{
|
||||
if(memory == NULL)
|
||||
{
|
||||
@ -122,9 +122,9 @@ WebRtc_Word32 MemoryPoolImpl<MemoryType>::PushMemory(MemoryType*& memory)
|
||||
MemoryPoolItem<MemoryType>* item =
|
||||
((MemoryPoolItemPayload<MemoryType>*)memory)->base;
|
||||
|
||||
const WebRtc_Word32 usedItems = --_outstandingMemory;
|
||||
const WebRtc_Word32 totalItems = _createdMemory.Value();
|
||||
const WebRtc_Word32 freeItems = totalItems - usedItems;
|
||||
const int32_t usedItems = --_outstandingMemory;
|
||||
const int32_t totalItems = _createdMemory.Value();
|
||||
const int32_t freeItems = totalItems - usedItems;
|
||||
if(freeItems < 0)
|
||||
{
|
||||
assert(false);
|
||||
@ -157,9 +157,9 @@ bool MemoryPoolImpl<MemoryType>::Initialize()
|
||||
}
|
||||
|
||||
template<class MemoryType>
|
||||
WebRtc_Word32 MemoryPoolImpl<MemoryType>::Terminate()
|
||||
int32_t MemoryPoolImpl<MemoryType>::Terminate()
|
||||
{
|
||||
WebRtc_Word32 itemsFreed = 0;
|
||||
int32_t itemsFreed = 0;
|
||||
PSLIST_ENTRY pListEntry = InterlockedPopEntrySList(_pListHead);
|
||||
while(pListEntry != NULL)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@
|
||||
#include "time_scheduler.h"
|
||||
|
||||
namespace webrtc {
|
||||
TimeScheduler::TimeScheduler(const WebRtc_UWord32 periodicityInMs)
|
||||
TimeScheduler::TimeScheduler(const uint32_t periodicityInMs)
|
||||
: _crit(CriticalSectionWrapper::CreateCriticalSection()),
|
||||
_isStarted(false),
|
||||
_lastPeriodMark(),
|
||||
@ -27,7 +27,7 @@ TimeScheduler::~TimeScheduler()
|
||||
delete _crit;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
||||
int32_t TimeScheduler::UpdateScheduler()
|
||||
{
|
||||
CriticalSectionScoped cs(_crit);
|
||||
if(!_isStarted)
|
||||
@ -47,11 +47,11 @@ WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
||||
// Calculate the time that has past since previous call to this function.
|
||||
TickTime tickNow = TickTime::Now();
|
||||
TickInterval amassedTicks = tickNow - _lastPeriodMark;
|
||||
WebRtc_Word64 amassedMs = amassedTicks.Milliseconds();
|
||||
int64_t amassedMs = amassedTicks.Milliseconds();
|
||||
|
||||
// Calculate the number of periods the time that has passed correspond to.
|
||||
WebRtc_Word32 periodsToClaim = (WebRtc_Word32)amassedMs /
|
||||
((WebRtc_Word32)_periodicityInMs);
|
||||
int32_t periodsToClaim = static_cast<int32_t>(amassedMs /
|
||||
static_cast<int32_t>(_periodicityInMs));
|
||||
|
||||
// One period will be worked off by this call. Make sure that the number of
|
||||
// pending periods don't end up being negative (e.g. if this function is
|
||||
@ -65,7 +65,7 @@ WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
||||
// Note that if this fuunction is called to often _lastPeriodMark can
|
||||
// refer to a time in the future which in turn will yield TimeToNextUpdate
|
||||
// that is greater than the periodicity
|
||||
for(WebRtc_Word32 i = 0; i < periodsToClaim; i++)
|
||||
for(int32_t i = 0; i < periodsToClaim; i++)
|
||||
{
|
||||
_lastPeriodMark += _periodicityInTicks;
|
||||
}
|
||||
@ -76,8 +76,8 @@ WebRtc_Word32 TimeScheduler::UpdateScheduler()
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32 TimeScheduler::TimeToNextUpdate(
|
||||
WebRtc_Word32& updateTimeInMS) const
|
||||
int32_t TimeScheduler::TimeToNextUpdate(
|
||||
int32_t& updateTimeInMS) const
|
||||
{
|
||||
CriticalSectionScoped cs(_crit);
|
||||
// Missed periods means that the next UpdateScheduler() should happen
|
||||
@ -92,8 +92,8 @@ WebRtc_Word32 TimeScheduler::TimeToNextUpdate(
|
||||
// UpdateScheduler()
|
||||
TickTime tickNow = TickTime::Now();
|
||||
TickInterval ticksSinceLastUpdate = tickNow - _lastPeriodMark;
|
||||
const WebRtc_Word32 millisecondsSinceLastUpdate =
|
||||
(WebRtc_Word32) ticksSinceLastUpdate.Milliseconds();
|
||||
const int32_t millisecondsSinceLastUpdate =
|
||||
static_cast<int32_t>(ticksSinceLastUpdate.Milliseconds());
|
||||
|
||||
updateTimeInMS = _periodicityInMs - millisecondsSinceLastUpdate;
|
||||
updateTimeInMS = (updateTimeInMS < 0) ? 0 : updateTimeInMS;
|
||||
|
@ -22,15 +22,15 @@ class CriticalSectionWrapper;
|
||||
class TimeScheduler
|
||||
{
|
||||
public:
|
||||
TimeScheduler(const WebRtc_UWord32 periodicityInMs);
|
||||
TimeScheduler(const uint32_t periodicityInMs);
|
||||
~TimeScheduler();
|
||||
|
||||
// Signal that a periodic event has been triggered.
|
||||
WebRtc_Word32 UpdateScheduler();
|
||||
int32_t UpdateScheduler();
|
||||
|
||||
// Set updateTimeInMs to the amount of time until UpdateScheduler() should
|
||||
// be called. This time will never be negative.
|
||||
WebRtc_Word32 TimeToNextUpdate(WebRtc_Word32& updateTimeInMS) const;
|
||||
int32_t TimeToNextUpdate(int32_t& updateTimeInMS) const;
|
||||
|
||||
private:
|
||||
CriticalSectionWrapper* _crit;
|
||||
@ -38,9 +38,9 @@ private:
|
||||
bool _isStarted;
|
||||
TickTime _lastPeriodMark;
|
||||
|
||||
WebRtc_UWord32 _periodicityInMs;
|
||||
WebRtc_Word64 _periodicityInTicks;
|
||||
WebRtc_UWord32 _missedPeriods;
|
||||
uint32_t _periodicityInMs;
|
||||
int64_t _periodicityInTicks;
|
||||
uint32_t _missedPeriods;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
|
@ -46,8 +46,8 @@ int main(int /*argc*/, char* /*argv[]*/)
|
||||
}
|
||||
|
||||
char versionString[256] = "";
|
||||
WebRtc_UWord32 remainingBufferInBytes = 256;
|
||||
WebRtc_UWord32 position = 0;
|
||||
uint32_t remainingBufferInBytes = 256;
|
||||
uint32_t position = 0;
|
||||
AudioConferenceMixer::GetVersion(versionString,remainingBufferInBytes,position);
|
||||
|
||||
int read = 1;
|
||||
@ -70,7 +70,7 @@ int main(int /*argc*/, char* /*argv[]*/)
|
||||
getchar();
|
||||
MixerParticipant::ParticipantType participantType;
|
||||
int option = 0;
|
||||
WebRtc_UWord32 id = 0;
|
||||
uint32_t id = 0;
|
||||
ListItem* item = NULL;
|
||||
ListWrapper participants;
|
||||
if(read == 0)
|
||||
@ -122,7 +122,7 @@ int main(int /*argc*/, char* /*argv[]*/)
|
||||
std::cout << "The following participants have been created: " << std::endl;
|
||||
while(item)
|
||||
{
|
||||
WebRtc_UWord32 id = item->GetUnsignedItem();
|
||||
uint32_t id = item->GetUnsignedItem();
|
||||
std::cout << id;
|
||||
item = participants.Next(item);
|
||||
if(item != NULL)
|
||||
@ -147,7 +147,7 @@ int main(int /*argc*/, char* /*argv[]*/)
|
||||
}
|
||||
else if(read == 8)
|
||||
{
|
||||
const WebRtc_Word32 amountOfParticipants = 4;
|
||||
const int32_t amountOfParticipants = 4;
|
||||
MixerParticipant::ParticipantType instance1Participants[] =
|
||||
{MixerParticipant::VIP,
|
||||
MixerParticipant::REGULAR,
|
||||
@ -158,9 +158,9 @@ int main(int /*argc*/, char* /*argv[]*/)
|
||||
MixerParticipant::REGULAR,
|
||||
MixerParticipant::REGULAR,
|
||||
MixerParticipant::REGULAR};
|
||||
for(WebRtc_Word32 i = 0; i < amountOfParticipants; i++)
|
||||
for(int32_t i = 0; i < amountOfParticipants; i++)
|
||||
{
|
||||
WebRtc_Word32 startPosition = 0;
|
||||
int32_t startPosition = 0;
|
||||
GenerateRandomPosition(startPosition);
|
||||
testInstance1->CreateParticipant(instance1Participants[i],startPosition);
|
||||
testInstance2->CreateParticipant(instance2Participants[i],startPosition);
|
||||
@ -210,7 +210,9 @@ bool
|
||||
FileWriter::WriteToFile(
|
||||
const AudioFrame& audioFrame)
|
||||
{
|
||||
WebRtc_Word32 written = (WebRtc_Word32)fwrite(audioFrame.data_,sizeof(WebRtc_Word16),audioFrame.samples_per_channel_,_file);
|
||||
int32_t written =
|
||||
static_cast<int32_t>(fwrite(audioFrame.data_, sizeof(int16_t),
|
||||
audioFrame.samples_per_channel_, _file));
|
||||
// Do not flush buffers since that will add (a lot of) delay
|
||||
return written == audioFrame.samples_per_channel_;
|
||||
}
|
||||
@ -269,7 +271,7 @@ FileReader::ReadFromFile(
|
||||
AudioFrame& audioFrame)
|
||||
{
|
||||
|
||||
WebRtc_Word16 buffer[AudioFrame::kMaxDataSizeSamples];
|
||||
int16_t buffer[AudioFrame::kMaxDataSizeSamples];
|
||||
LoopedFileRead(buffer,AudioFrame::kMaxDataSizeSamples,_sampleSize,_file);
|
||||
|
||||
bool vad = false;
|
||||
@ -278,7 +280,7 @@ FileReader::ReadFromFile(
|
||||
AudioFrame::kVadPassive;
|
||||
|
||||
_volumeCalculator.ComputeLevel(buffer,_sampleSize);
|
||||
const WebRtc_Word32 level = _volumeCalculator.GetLevel();
|
||||
const int32_t level = _volumeCalculator.GetLevel();
|
||||
return audioFrame.UpdateFrame( -1,
|
||||
_timeStamp,
|
||||
buffer,
|
||||
@ -293,9 +295,9 @@ FileReader::ReadFromFile(
|
||||
|
||||
bool
|
||||
FileReader::FastForwardFile(
|
||||
const WebRtc_Word32 samples)
|
||||
const int32_t samples)
|
||||
{
|
||||
WebRtc_Word16* tempBuffer = new WebRtc_Word16[samples];
|
||||
int16_t* tempBuffer = new int16_t[samples];
|
||||
bool success = LoopedFileRead(tempBuffer,samples,samples,_file);
|
||||
delete[] tempBuffer;
|
||||
return success;
|
||||
@ -333,13 +335,13 @@ FileReader::SetVAD(
|
||||
|
||||
bool
|
||||
FileReader::GetVAD(
|
||||
WebRtc_Word16* buffer,
|
||||
WebRtc_UWord8 bufferLengthInSamples,
|
||||
int16_t* buffer,
|
||||
uint8_t bufferLengthInSamples,
|
||||
bool& vad)
|
||||
{
|
||||
if(_automaticVad)
|
||||
{
|
||||
WebRtc_Word16 result = WebRtcVad_Process(_vadInstr,_frequency,buffer,bufferLengthInSamples);
|
||||
int16_t result = WebRtcVad_Process(_vadInstr,_frequency,buffer,bufferLengthInSamples);
|
||||
if(result == -1)
|
||||
{
|
||||
assert(false);
|
||||
@ -353,9 +355,9 @@ FileReader::GetVAD(
|
||||
|
||||
MixerParticipant*
|
||||
MixerParticipant::CreateParticipant(
|
||||
const WebRtc_UWord32 id,
|
||||
const uint32_t id,
|
||||
ParticipantType participantType,
|
||||
const WebRtc_Word32 startPosition,
|
||||
const int32_t startPosition,
|
||||
char* outputPath)
|
||||
{
|
||||
if(participantType == RANDOM)
|
||||
@ -376,7 +378,7 @@ MixerParticipant::CreateParticipant(
|
||||
}
|
||||
|
||||
MixerParticipant::MixerParticipant(
|
||||
const WebRtc_UWord32 id,
|
||||
const uint32_t id,
|
||||
ParticipantType participantType)
|
||||
:
|
||||
_id(id),
|
||||
@ -390,9 +392,9 @@ MixerParticipant::~MixerParticipant()
|
||||
{
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
MixerParticipant::GetAudioFrame(
|
||||
const WebRtc_Word32 /*id*/,
|
||||
const int32_t /*id*/,
|
||||
AudioFrame& audioFrame)
|
||||
{
|
||||
if(!_fileReader.ReadFromFile(audioFrame))
|
||||
@ -403,14 +405,14 @@ MixerParticipant::GetAudioFrame(
|
||||
return 0;
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
MixerParticipant::MixedAudioFrame(
|
||||
const AudioFrame& audioFrame)
|
||||
{
|
||||
return _fileWriter.WriteToFile(audioFrame);
|
||||
}
|
||||
|
||||
WebRtc_Word32
|
||||
int32_t
|
||||
MixerParticipant::GetParticipantType(
|
||||
ParticipantType& participantType)
|
||||
{
|
||||
@ -420,7 +422,7 @@ MixerParticipant::GetParticipantType(
|
||||
|
||||
bool
|
||||
MixerParticipant::InitializeFileReader(
|
||||
const WebRtc_Word32 startPositionInSamples)
|
||||
const int32_t startPositionInSamples)
|
||||
{
|
||||
char fileName[128] = "";
|
||||
if(_participantType == REGULAR)
|
||||
@ -446,7 +448,7 @@ bool
|
||||
MixerParticipant::InitializeFileWriter(
|
||||
char* outputPath)
|
||||
{
|
||||
const WebRtc_Word32 stringsize = 128;
|
||||
const int32_t stringsize = 128;
|
||||
char fileName[stringsize] = "";
|
||||
strncpy(fileName,outputPath,stringsize);
|
||||
fileName[stringsize-1] = '\0';
|
||||
@ -461,7 +463,7 @@ MixerParticipant::InitializeFileWriter(
|
||||
}
|
||||
|
||||
StatusReceiver::StatusReceiver(
|
||||
const WebRtc_Word32 id)
|
||||
const int32_t id)
|
||||
:
|
||||
_id(id),
|
||||
_mixedParticipants(NULL),
|
||||
@ -482,9 +484,9 @@ StatusReceiver::~StatusReceiver()
|
||||
|
||||
void
|
||||
StatusReceiver::MixedParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size)
|
||||
const uint32_t size)
|
||||
{
|
||||
if(id != _id)
|
||||
{
|
||||
@ -502,9 +504,9 @@ StatusReceiver::MixedParticipants(
|
||||
|
||||
void
|
||||
StatusReceiver::VADPositiveParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size)
|
||||
const uint32_t size)
|
||||
{
|
||||
if(id != _id)
|
||||
{
|
||||
@ -523,8 +525,8 @@ StatusReceiver::VADPositiveParticipants(
|
||||
|
||||
void
|
||||
StatusReceiver::MixedAudioLevel(
|
||||
const WebRtc_Word32 id,
|
||||
const WebRtc_UWord32 level)
|
||||
const int32_t id,
|
||||
const uint32_t level)
|
||||
{
|
||||
if(id != _id)
|
||||
{
|
||||
@ -541,7 +543,7 @@ StatusReceiver::PrintMixedParticipants()
|
||||
{
|
||||
std::cout << "N/A" << std::endl;
|
||||
}
|
||||
for(WebRtc_UWord16 i = 0; i < _mixedParticipantsAmount; i++)
|
||||
for(uint16_t i = 0; i < _mixedParticipantsAmount; i++)
|
||||
{
|
||||
std::cout << i + 1 << ". Participant " << _mixedParticipants[i].participant << ": level = " << _mixedParticipants[i].level << std::endl;
|
||||
}
|
||||
@ -555,7 +557,7 @@ StatusReceiver::PrintVadPositiveParticipants()
|
||||
{
|
||||
std::cout << "N/A" << std::endl;
|
||||
}
|
||||
for(WebRtc_UWord16 i = 0; i < _mixedParticipantsAmount; i++)
|
||||
for(uint16_t i = 0; i < _mixedParticipantsAmount; i++)
|
||||
{
|
||||
std::cout << i + 1 << ". Participant " << _mixedParticipants[i].participant << ": level = " << _mixedParticipants[i].level << std::endl;
|
||||
}
|
||||
@ -567,7 +569,7 @@ StatusReceiver::PrintMixedAudioLevel()
|
||||
std::cout << "Mixed audio level = " << _mixedAudioLevel << std::endl;
|
||||
}
|
||||
|
||||
WebRtc_Word32 MixerWrapper::_mixerWrapperIdCounter = 0;
|
||||
int32_t MixerWrapper::_mixerWrapperIdCounter = 0;
|
||||
|
||||
MixerWrapper::MixerWrapper()
|
||||
:
|
||||
@ -648,7 +650,7 @@ bool
|
||||
MixerWrapper::CreateParticipant(
|
||||
MixerParticipant::ParticipantType participantType)
|
||||
{
|
||||
WebRtc_Word32 startPosition = 0;
|
||||
int32_t startPosition = 0;
|
||||
GenerateRandomPosition(startPosition);
|
||||
return CreateParticipant(participantType,startPosition);
|
||||
}
|
||||
@ -656,9 +658,9 @@ MixerWrapper::CreateParticipant(
|
||||
bool
|
||||
MixerWrapper::CreateParticipant(
|
||||
MixerParticipant::ParticipantType participantType,
|
||||
const WebRtc_Word32 startPosition)
|
||||
const int32_t startPosition)
|
||||
{
|
||||
WebRtc_UWord32 id;
|
||||
uint32_t id;
|
||||
if(!GetFreeItemIds(id))
|
||||
{
|
||||
return false;
|
||||
@ -684,7 +686,7 @@ MixerWrapper::CreateParticipant(
|
||||
|
||||
bool
|
||||
MixerWrapper::DeleteParticipant(
|
||||
const WebRtc_UWord32 id)
|
||||
const uint32_t id)
|
||||
{
|
||||
bool success = StopMixingParticipant(id);
|
||||
if(!success)
|
||||
@ -706,7 +708,7 @@ MixerWrapper::DeleteParticipant(
|
||||
|
||||
bool
|
||||
MixerWrapper::StartMixing(
|
||||
const WebRtc_UWord32 mixedParticipants)
|
||||
const uint32_t mixedParticipants)
|
||||
{
|
||||
if(_processThread)
|
||||
{
|
||||
@ -716,7 +718,7 @@ MixerWrapper::StartMixing(
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
WebRtc_UWord32 mixedParticipantsTest = 0;
|
||||
uint32_t mixedParticipantsTest = 0;
|
||||
_mixer->AmountOfMixedParticipants(mixedParticipantsTest);
|
||||
assert(mixedParticipantsTest == mixedParticipants);
|
||||
|
||||
@ -752,10 +754,10 @@ MixerWrapper::StopMixing()
|
||||
|
||||
void
|
||||
MixerWrapper::NewMixedAudio(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const AudioFrame& generalAudioFrame,
|
||||
const AudioFrame** uniqueAudioFrames,
|
||||
const WebRtc_UWord32 size)
|
||||
const uint32_t size)
|
||||
{
|
||||
if(id < 0)
|
||||
{
|
||||
@ -766,9 +768,9 @@ MixerWrapper::NewMixedAudio(
|
||||
|
||||
// Send the unique audio frames to its corresponding participants
|
||||
ListWrapper uniqueAudioFrameList;
|
||||
for(WebRtc_UWord32 i = 0; i < size; i++)
|
||||
for(uint32_t i = 0; i < size; i++)
|
||||
{
|
||||
WebRtc_UWord32 id = (uniqueAudioFrames[i])->_id;
|
||||
uint32_t id = (uniqueAudioFrames[i])->_id;
|
||||
MapItem* resultItem = _mixerParticipants.Find(id);
|
||||
if(resultItem == NULL)
|
||||
{
|
||||
@ -833,7 +835,7 @@ MixerWrapper::PrintStatus()
|
||||
bool
|
||||
MixerWrapper::InitializeFileWriter()
|
||||
{
|
||||
const WebRtc_Word32 stringsize = 128;
|
||||
const int32_t stringsize = 128;
|
||||
char fileName[stringsize] = "";
|
||||
strncpy(fileName,_instanceOutputPath,stringsize);
|
||||
fileName[stringsize-1] = '\0';
|
||||
@ -869,7 +871,7 @@ MixerWrapper::Process()
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
WebRtc_Word32 processOfset = 0;
|
||||
int32_t processOfset = 0;
|
||||
const TickTime currentTime = TickTime::Now();
|
||||
if(_firstProcessCall)
|
||||
{
|
||||
@ -880,12 +882,12 @@ MixerWrapper::Process()
|
||||
{
|
||||
TickInterval deltaTime = (currentTime - _previousTime);
|
||||
_previousTime += _periodicityInTicks;
|
||||
processOfset = (WebRtc_Word32) deltaTime.Milliseconds();
|
||||
processOfset = (int32_t) deltaTime.Milliseconds();
|
||||
processOfset -= FileReader::kProcessPeriodicityInMs;
|
||||
}
|
||||
|
||||
_mixer->Process();
|
||||
WebRtc_Word32 timeUntilNextProcess = _mixer->TimeUntilNextProcess();
|
||||
int32_t timeUntilNextProcess = _mixer->TimeUntilNextProcess();
|
||||
if(processOfset > FileReader::kProcessPeriodicityInMs)
|
||||
{
|
||||
std::cout << "Performance Warning: Process running " << processOfset << " too slow" << std::endl;
|
||||
@ -910,7 +912,7 @@ MixerWrapper::Process()
|
||||
|
||||
bool
|
||||
MixerWrapper::StartMixingParticipant(
|
||||
const WebRtc_UWord32 id)
|
||||
const uint32_t id)
|
||||
{
|
||||
MapItem* item = _mixerParticipants.Find(id);
|
||||
if(item == NULL)
|
||||
@ -944,7 +946,7 @@ MixerWrapper::StartMixingParticipant(
|
||||
assert(anonymouslyMixed);
|
||||
return success;
|
||||
}
|
||||
WebRtc_UWord32 previousAmountOfMixableParticipants = 0;
|
||||
uint32_t previousAmountOfMixableParticipants = 0;
|
||||
bool success = _mixer->AmountOfMixables(previousAmountOfMixableParticipants) == 0;
|
||||
assert(success);
|
||||
|
||||
@ -963,7 +965,7 @@ MixerWrapper::StartMixingParticipant(
|
||||
return false;
|
||||
}
|
||||
|
||||
WebRtc_UWord32 currentAmountOfMixableParticipants = 0;
|
||||
uint32_t currentAmountOfMixableParticipants = 0;
|
||||
success = _mixer->AmountOfMixables(currentAmountOfMixableParticipants) == 0;
|
||||
assert(currentAmountOfMixableParticipants == previousAmountOfMixableParticipants + 1);
|
||||
|
||||
@ -1001,7 +1003,7 @@ MixerWrapper::StartMixingParticipant(
|
||||
|
||||
bool
|
||||
MixerWrapper::StopMixingParticipant(
|
||||
const WebRtc_UWord32 id)
|
||||
const uint32_t id)
|
||||
{
|
||||
MapItem* item = _mixerParticipants.Find(id);
|
||||
if(item == NULL)
|
||||
@ -1010,12 +1012,12 @@ MixerWrapper::StopMixingParticipant(
|
||||
}
|
||||
MixerParticipant* participant = static_cast<MixerParticipant*>(item->GetItem());
|
||||
bool success = false;
|
||||
WebRtc_UWord32 previousAmountOfMixableParticipants = 0;
|
||||
uint32_t previousAmountOfMixableParticipants = 0;
|
||||
success = _mixer->AmountOfMixables(previousAmountOfMixableParticipants) == 0;
|
||||
assert(success);
|
||||
success = _mixer->SetMixabilityStatus(*participant,false) == 0;
|
||||
assert(success);
|
||||
WebRtc_UWord32 currentAmountOfMixableParticipants = 0;
|
||||
uint32_t currentAmountOfMixableParticipants = 0;
|
||||
success = _mixer->AmountOfMixables(currentAmountOfMixableParticipants) == 0;
|
||||
assert(success);
|
||||
assert(success ? currentAmountOfMixableParticipants == previousAmountOfMixableParticipants -1 :
|
||||
@ -1025,17 +1027,17 @@ MixerWrapper::StopMixingParticipant(
|
||||
|
||||
bool
|
||||
MixerWrapper::GetFreeItemIds(
|
||||
WebRtc_UWord32& itemId)
|
||||
uint32_t& itemId)
|
||||
{
|
||||
if(!_freeItemIds.Empty())
|
||||
{
|
||||
ListItem* item = _freeItemIds.First();
|
||||
WebRtc_UWord32* id = static_cast<WebRtc_UWord32*>(item->GetItem());
|
||||
uint32_t* id = static_cast<uint32_t*>(item->GetItem());
|
||||
itemId = *id;
|
||||
delete id;
|
||||
return true;
|
||||
}
|
||||
if(_itemIdCounter == (WebRtc_UWord32) -1)
|
||||
if(_itemIdCounter == (uint32_t) -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -1045,9 +1047,9 @@ MixerWrapper::GetFreeItemIds(
|
||||
|
||||
void
|
||||
MixerWrapper::AddFreeItemIds(
|
||||
const WebRtc_UWord32 itemId)
|
||||
const uint32_t itemId)
|
||||
{
|
||||
WebRtc_UWord32* id = new WebRtc_UWord32;
|
||||
uint32_t* id = new uint32_t;
|
||||
*id = itemId;
|
||||
_freeItemIds.PushBack(static_cast<void*>(id));
|
||||
}
|
||||
@ -1058,7 +1060,7 @@ MixerWrapper::ClearAllItemIds()
|
||||
ListItem* item = _freeItemIds.First();
|
||||
while(item != NULL)
|
||||
{
|
||||
WebRtc_UWord32* id = static_cast<WebRtc_UWord32*>(item->GetItem());
|
||||
uint32_t* id = static_cast<uint32_t*>(item->GetItem());
|
||||
delete id;
|
||||
_freeItemIds.Erase(item);
|
||||
item = _freeItemIds.First();
|
||||
@ -1067,21 +1069,24 @@ MixerWrapper::ClearAllItemIds()
|
||||
|
||||
bool
|
||||
LoopedFileRead(
|
||||
WebRtc_Word16* buffer,
|
||||
WebRtc_UWord32 bufferSizeInSamples,
|
||||
WebRtc_UWord32 samplesToRead,
|
||||
int16_t* buffer,
|
||||
uint32_t bufferSizeInSamples,
|
||||
uint32_t samplesToRead,
|
||||
FILE* file)
|
||||
{
|
||||
if(bufferSizeInSamples < samplesToRead)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
WebRtc_UWord32 gottenSamples = (WebRtc_UWord32)fread(buffer,sizeof(WebRtc_Word16),samplesToRead,file);
|
||||
uint32_t gottenSamples = static_cast<uint32_t>(
|
||||
fread(buffer, sizeof(int16_t), samplesToRead, file));
|
||||
if(gottenSamples != samplesToRead)
|
||||
{
|
||||
WebRtc_UWord32 missingSamples = samplesToRead - gottenSamples;
|
||||
uint32_t missingSamples = samplesToRead - gottenSamples;
|
||||
fseek(file,0,0);
|
||||
gottenSamples += (WebRtc_UWord32)fread(&buffer[gottenSamples],sizeof(WebRtc_Word16),missingSamples,file);
|
||||
gottenSamples +=
|
||||
static_cast<uint32_t>(fread(&buffer[gottenSamples], sizeof(int16_t),
|
||||
missingSamples, file));
|
||||
}
|
||||
if(gottenSamples != samplesToRead)
|
||||
{
|
||||
@ -1092,7 +1097,7 @@ LoopedFileRead(
|
||||
|
||||
void
|
||||
GenerateRandomPosition(
|
||||
WebRtc_Word32& startPosition)
|
||||
int32_t& startPosition)
|
||||
{
|
||||
startPosition = (rand() % (60*16000/160)) * 160;
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ public:
|
||||
AudioFrame& audioFrame);
|
||||
|
||||
bool FastForwardFile(
|
||||
const WebRtc_Word32 samples);
|
||||
const int32_t samples);
|
||||
|
||||
bool EnableAutomaticVAD(
|
||||
bool enable,
|
||||
@ -72,14 +72,14 @@ public:
|
||||
bool vad);
|
||||
private:
|
||||
bool GetVAD(
|
||||
WebRtc_Word16* buffer,
|
||||
WebRtc_UWord8 bufferLengthInSamples,
|
||||
int16_t* buffer,
|
||||
uint8_t bufferLengthInSamples,
|
||||
bool& vad);
|
||||
|
||||
Frequency _frequency;
|
||||
WebRtc_UWord8 _sampleSize;
|
||||
uint8_t _sampleSize;
|
||||
|
||||
WebRtc_UWord32 _timeStamp;
|
||||
uint32_t _timeStamp;
|
||||
|
||||
FILE* _file;
|
||||
|
||||
@ -102,33 +102,33 @@ public:
|
||||
};
|
||||
|
||||
static MixerParticipant* CreateParticipant(
|
||||
const WebRtc_UWord32 id,
|
||||
const uint32_t id,
|
||||
ParticipantType participantType,
|
||||
const WebRtc_Word32 startPosition,
|
||||
const int32_t startPosition,
|
||||
char* outputPath);
|
||||
~MixerParticipant();
|
||||
|
||||
WebRtc_Word32 GetAudioFrame(
|
||||
const WebRtc_Word32 id,
|
||||
int32_t GetAudioFrame(
|
||||
const int32_t id,
|
||||
AudioFrame& audioFrame);
|
||||
|
||||
WebRtc_Word32 MixedAudioFrame(
|
||||
int32_t MixedAudioFrame(
|
||||
const AudioFrame& audioFrame);
|
||||
|
||||
WebRtc_Word32 GetParticipantType(
|
||||
int32_t GetParticipantType(
|
||||
ParticipantType& participantType);
|
||||
private:
|
||||
MixerParticipant(
|
||||
const WebRtc_UWord32 id,
|
||||
const uint32_t id,
|
||||
ParticipantType participantType);
|
||||
|
||||
bool InitializeFileReader(
|
||||
const WebRtc_Word32 startPositionInSamples);
|
||||
const int32_t startPositionInSamples);
|
||||
|
||||
bool InitializeFileWriter(
|
||||
char* outputPath);
|
||||
|
||||
WebRtc_UWord32 _id;
|
||||
uint32_t _id;
|
||||
ParticipantType _participantType;
|
||||
|
||||
FileReader _fileReader;
|
||||
@ -139,22 +139,22 @@ class StatusReceiver : public AudioMixerStatusReceiver
|
||||
{
|
||||
public:
|
||||
StatusReceiver(
|
||||
const WebRtc_Word32 id);
|
||||
const int32_t id);
|
||||
~StatusReceiver();
|
||||
|
||||
void MixedParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size);
|
||||
const uint32_t size);
|
||||
|
||||
void VADPositiveParticipants(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const ParticipantStatistics* participantStatistics,
|
||||
const WebRtc_UWord32 size);
|
||||
const uint32_t size);
|
||||
|
||||
void MixedAudioLevel(
|
||||
const WebRtc_Word32 id,
|
||||
const WebRtc_UWord32 level);
|
||||
const int32_t id,
|
||||
const uint32_t level);
|
||||
|
||||
void PrintMixedParticipants();
|
||||
|
||||
@ -162,17 +162,17 @@ public:
|
||||
|
||||
void PrintMixedAudioLevel();
|
||||
private:
|
||||
WebRtc_Word32 _id;
|
||||
int32_t _id;
|
||||
|
||||
ParticipantStatistics* _mixedParticipants;
|
||||
WebRtc_UWord32 _mixedParticipantsAmount;
|
||||
WebRtc_UWord32 _mixedParticipantsSize;
|
||||
uint32_t _mixedParticipantsAmount;
|
||||
uint32_t _mixedParticipantsSize;
|
||||
|
||||
ParticipantStatistics* _vadPositiveParticipants;
|
||||
WebRtc_UWord32 _vadPositiveParticipantsAmount;
|
||||
WebRtc_UWord32 _vadPositiveParticipantsSize;
|
||||
uint32_t _vadPositiveParticipantsAmount;
|
||||
uint32_t _vadPositiveParticipantsSize;
|
||||
|
||||
WebRtc_UWord32 _mixedAudioLevel;
|
||||
uint32_t _mixedAudioLevel;
|
||||
};
|
||||
|
||||
class MixerWrapper : public AudioMixerOutputReceiver
|
||||
@ -189,21 +189,21 @@ public:
|
||||
|
||||
bool CreateParticipant(
|
||||
MixerParticipant::ParticipantType participantType,
|
||||
const WebRtc_Word32 startPosition);
|
||||
const int32_t startPosition);
|
||||
|
||||
bool DeleteParticipant(
|
||||
const WebRtc_UWord32 id);
|
||||
const uint32_t id);
|
||||
|
||||
bool StartMixing(
|
||||
const WebRtc_UWord32 mixedParticipants = AudioConferenceMixer::kDefaultAmountOfMixedParticipants);
|
||||
const uint32_t mixedParticipants = AudioConferenceMixer::kDefaultAmountOfMixedParticipants);
|
||||
|
||||
bool StopMixing();
|
||||
|
||||
void NewMixedAudio(
|
||||
const WebRtc_Word32 id,
|
||||
const int32_t id,
|
||||
const AudioFrame& generalAudioFrame,
|
||||
const AudioFrame** uniqueAudioFrames,
|
||||
const WebRtc_UWord32 size);
|
||||
const uint32_t size);
|
||||
|
||||
bool GetParticipantList(
|
||||
ListWrapper& participants);
|
||||
@ -220,16 +220,16 @@ private:
|
||||
bool Process();
|
||||
|
||||
bool StartMixingParticipant(
|
||||
const WebRtc_UWord32 id);
|
||||
const uint32_t id);
|
||||
|
||||
bool StopMixingParticipant(
|
||||
const WebRtc_UWord32 id);
|
||||
const uint32_t id);
|
||||
|
||||
bool GetFreeItemIds(
|
||||
WebRtc_UWord32& itemId);
|
||||
uint32_t& itemId);
|
||||
|
||||
void AddFreeItemIds(
|
||||
const WebRtc_UWord32 itemId);
|
||||
const uint32_t itemId);
|
||||
|
||||
void ClearAllItemIds();
|
||||
|
||||
@ -241,17 +241,17 @@ private:
|
||||
|
||||
bool _firstProcessCall;
|
||||
TickTime _previousTime; // Tick time of previous process
|
||||
const WebRtc_Word64 _periodicityInTicks; // Periodicity
|
||||
const int64_t _periodicityInTicks; // Periodicity
|
||||
|
||||
webrtc::EventWrapper* _synchronizationEvent;
|
||||
|
||||
ListWrapper _freeItemIds;
|
||||
WebRtc_UWord32 _itemIdCounter;
|
||||
uint32_t _itemIdCounter;
|
||||
|
||||
MapWrapper _mixerParticipants;
|
||||
|
||||
static WebRtc_Word32 _mixerWrapperIdCounter;
|
||||
WebRtc_Word32 _mixerWrappererId;
|
||||
static int32_t _mixerWrapperIdCounter;
|
||||
int32_t _mixerWrappererId;
|
||||
char _instanceOutputPath[128];
|
||||
|
||||
webrtc::Trace* _trace;
|
||||
@ -264,13 +264,13 @@ private:
|
||||
|
||||
bool
|
||||
LoopedFileRead(
|
||||
WebRtc_Word16* buffer,
|
||||
WebRtc_UWord32 bufferSizeInSamples,
|
||||
WebRtc_UWord32 samplesToRead,
|
||||
int16_t* buffer,
|
||||
uint32_t bufferSizeInSamples,
|
||||
uint32_t samplesToRead,
|
||||
FILE* file);
|
||||
|
||||
void
|
||||
GenerateRandomPosition(
|
||||
WebRtc_Word32& startPosition);
|
||||
int32_t& startPosition);
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_CONFERENCE_MIXER_TEST_FUNCTIONTEST_FUNCTIONTEST_H_
|
||||
|
Loading…
x
Reference in New Issue
Block a user