Removing deprecated NetEQ APIs

Removing WebRtcNetEQ_GetPreferredBufferSize and
WebRtcNetEQ_GetCurrentDelay and all dependent APIs.

Review URL: http://webrtc-codereview.appspot.com/289006

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1063 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
henrik.lundin@webrtc.org 2011-11-30 16:21:22 +00:00
parent 0dffc6449a
commit 524eb48081
14 changed files with 21 additions and 266 deletions

View File

@ -611,19 +611,6 @@ class AudioCodingModule: public Module {
//
virtual WebRtc_Word32 SetMinimumPlayoutDelay(const WebRtc_Word32 timeMs) = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 Delay()
// Get the current playout delay.
//
// Output:
// - delayInMs : delay in millisecond
//
// Return value:
// -1 if failed to get the delay,
// 0 if succeeded to get the delay.
//
virtual WebRtc_Word32 Delay(WebRtc_UWord16& delayMs) const = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 RegisterIncomingMessagesCallback()
// Used by the module to deliver messages to the codec module/application
@ -913,22 +900,6 @@ class AudioCodingModule: public Module {
//
virtual WebRtc_Word32 NetworkStatistics(
ACMNetworkStatistics& networkStatistics) const = 0;
///////////////////////////////////////////////////////////////////////////
// WebRtc_Word32 PreferredBufferSize()
// Get the optimal buffer size calculated for the current network
// conditions.
//
// Output:
// -prefBuffSize : the optimal size of the jitter buffer in
// milliseconds.
//
// Return value:
// -1 if the preferred buffer size could not be computed,
// 0 if a valid buffer is computed successfully.
//
virtual WebRtc_Word32 PreferredBufferSize(
WebRtc_UWord16& prefBufSize) const = 0;
};
} // namespace webrtc

View File

@ -470,21 +470,6 @@ ACMNetEQ::NetworkStatistics(
}
}
WebRtc_Word32
ACMNetEQ::PreferredBufferSize(
WebRtc_UWord16* prefBufSize) const
{
CriticalSectionScoped lock(*_netEqCritSect);
WebRtc_Word32 ok = WebRtcNetEQ_GetPreferredBufferSize(_inst[0], prefBufSize);
if((*prefBufSize == 0) || (*prefBufSize == 0xFFFF))
{
ok = -1;
LogError("getPreferredBufferSize", 0);
}
return ok;
}
WebRtc_Word32
ACMNetEQ::RecIn(
const WebRtc_Word8* incomingPayload,
@ -1028,29 +1013,6 @@ ACMNetEQ::RemoveCodec(
return 0;
}
WebRtc_Word16
ACMNetEQ::Delay(
WebRtc_UWord16& currentDelayInMs) const
{
CriticalSectionScoped lock(*_netEqCritSect);
if(!_isInitialized[0])
{
WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, _id,
"Delay: NetEq is not initialized.");
return -1;
}
if(WebRtcNetEQ_GetCurrentDelay(_inst[0], &currentDelayInMs) < 0)
{
LogError("GetCurrentDelay", 0);
return -1;
}
else
{
return 0;
}
}
WebRtc_Word16
ACMNetEQ::SetBackgroundNoiseMode(
const ACMBackgroundNoiseMode mode)

View File

@ -213,20 +213,6 @@ public:
WebRtc_Word32 NetworkStatistics(
ACMNetworkStatistics* statistics) const;
//
// PreferredBufferSize()
// Get the currently preferred buffer size from NetEQ.
//
// Output:
// - prefBufSize : The optimal buffer size for the current network
// conditions.
//
// Return value : 0 if ok.
// <0 if NetEQ returned an error.
//
WebRtc_Word32 PreferredBufferSize(
WebRtc_UWord16* prefBufSize) const;
//
// VADMode()
// Get the current VAD Mode.
@ -283,20 +269,6 @@ public:
bool isStereo = false);
//
// Delay()
// Get the length of the current audio buffer in milliseconds. That is
// approximately the playout delay, which can be used for lip-synch.
//
// Output:
// - currentDelayInMs : delay in audio buffer given in milliseconds
//
// return value : 0 if ok
// -1 if an error occurred.
//
WebRtc_Word16 Delay(
WebRtc_UWord16& currentDelayInMs) const;
//
// SetBackgroundNoiseMode()
// Set the mode of the background noise.

View File

@ -1815,17 +1815,6 @@ AudioCodingModuleImpl::SetMinimumPlayoutDelay(
return _netEq.SetExtraDelay(timeMs);
}
// current play out delay
WebRtc_Word32
AudioCodingModuleImpl::Delay(
WebRtc_UWord16& delayMs) const
{
// NetEQ will get an API for this later.
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceAudioCoding, _id,
"Delay()");
return _netEq.Delay(delayMs);
}
// Get Dtmf playout status
bool
AudioCodingModuleImpl::DtmfPlayoutStatus() const
@ -2135,15 +2124,6 @@ AudioCodingModuleImpl::NetworkStatistics(
return status;
}
WebRtc_Word32
AudioCodingModuleImpl::PreferredBufferSize(
WebRtc_UWord16& prefbufsize) const
{
WEBRTC_TRACE(webrtc::kTraceModuleCall, webrtc::kTraceAudioCoding, _id,
"PreferedBufferSize()");
return _netEq.PreferredBufferSize(&prefbufsize);
}
void
AudioCodingModuleImpl::DestructEncoderInst(
void* ptrInst)

View File

@ -203,9 +203,6 @@ public:
WebRtc_Word32 SetMinimumPlayoutDelay(
const WebRtc_Word32 timeMs);
// current play out delay
WebRtc_Word32 Delay(WebRtc_UWord16& delayMs) const;
// configure Dtmf playout status i.e on/off playout the incoming outband Dtmf tone
WebRtc_Word32 SetDtmfPlayoutStatus(
const bool enable);
@ -243,9 +240,6 @@ public:
WebRtc_Word32 NetworkStatistics(
ACMNetworkStatistics& statistics) const;
WebRtc_Word32 PreferredBufferSize(
WebRtc_UWord16& prefbufsize) const;
void DestructEncoderInst(void* ptrInst);
WebRtc_Word16 AudioBuffer(WebRtcACMAudioBuff& audioBuff);

View File

@ -884,16 +884,12 @@ APITest::TestDelay(char side)
WebRtc_UWord32 inTimestamp = 0;
WebRtc_UWord32 outTimestamp = 0;
double estimDelay = 0;
WebRtc_UWord16 delay = 0;
double averageEstimDelay = 0;
double averageDelay = 0;
CircularBuffer estimDelayCB(100);
CircularBuffer delayCB(100);
estimDelayCB.SetArithMean(true);
delayCB.SetArithMean(true);
if(side == 'A')
{
@ -914,7 +910,6 @@ APITest::TestDelay(char side)
inTimestamp = myChannel->LastInTimestamp();
CHECK_ERROR_MT(myACM->PlayoutTimestamp(outTimestamp));
CHECK_ERROR_MT(myACM->Delay(delay));
if(!_randomTest)
{
@ -938,10 +933,6 @@ APITest::TestDelay(char side)
//printf("\n %6.1f \n", estimDelay);
//std::cout << " " << std::flush;
CHECK_ERROR_MT(myACM->Delay(delay));
delayCB.Update(delay);
delayCB.ArithMean(averageDelay);
if(_verbose)
{
fprintf(stdout, "\rExpected: %4d, retreived: %6.1f, measured: %6.1f",

View File

@ -110,16 +110,6 @@ typedef struct
*/
int WebRtcNetEQ_GetNetworkStatistics(void *inst, WebRtcNetEQ_NetworkStatistics *stats);
/*
* Get the optimal buffer size calculated for the current network conditions.
*/
int WebRtcNetEQ_GetPreferredBufferSize(void *inst, WebRtc_UWord16 *preferredBufferSize);
/*
* Get the current buffer size in ms. Return value is 0 if ok, -1 if error.
*/
int WebRtcNetEQ_GetCurrentDelay(const void *inst, WebRtc_UWord16 *currentDelayMs);
/***********************************************/
/* Functions for post-decode VAD functionality */
/***********************************************/

View File

@ -1188,9 +1188,28 @@ int WebRtcNetEQ_GetNetworkStatistics(void *inst, WebRtcNetEQ_NetworkStatistics *
/* Get buffer size */
/*******************/
if (WebRtcNetEQ_GetCurrentDelay((void *) inst, &(stats->currentBufferSize)) != 0)
if (NetEqMainInst->MCUinst.fs != 0)
{
return (-1);
WebRtc_Word32 temp32;
/* Query packet buffer for number of samples. */
temp32 = WebRtcNetEQ_PacketBufferGetSize(
&NetEqMainInst->MCUinst.PacketBuffer_inst);
/* Divide by sample rate.
* Calculate temp32 * 1000 / fs to get result in ms. */
stats->currentBufferSize = (WebRtc_UWord16)
WebRtcSpl_DivU32U16(temp32 * 1000, NetEqMainInst->MCUinst.fs);
/* Add number of samples yet to play in sync buffer. */
temp32 = (WebRtc_Word32) (NetEqMainInst->DSPinst.endPosition -
NetEqMainInst->DSPinst.curPosition);
stats->currentBufferSize += (WebRtc_UWord16)
WebRtcSpl_DivU32U16(temp32 * 1000, NetEqMainInst->MCUinst.fs);
}
else
{
/* Sample rate not initialized. */
stats->currentBufferSize = 0;
}
/***************************/
@ -1512,81 +1531,6 @@ int WebRtcNetEQ_GetNetworkStatistics(void *inst, WebRtcNetEQ_NetworkStatistics *
return (0);
}
/* Get the optimal buffer size calculated for the current network conditions. */
int WebRtcNetEQ_GetPreferredBufferSize(void *inst, WebRtc_UWord16 *preferredBufferSize)
{
MainInst_t *NetEqMainInst = (MainInst_t*) inst;
/***************************/
/* Get optimal buffer size */
/***************************/
if (NetEqMainInst->MCUinst.fs != 0 && NetEqMainInst->MCUinst.fs <= WEBRTC_SPL_WORD16_MAX)
{
/* preferredBufferSize = Bopt * packSizeSamples / (fs/1000) */
*preferredBufferSize
= (WebRtc_UWord16) WEBRTC_SPL_MUL_16_16(
(WebRtc_Word16) ((NetEqMainInst->MCUinst.BufferStat_inst.Automode_inst.optBufLevel) >> 8), /* optimal buffer level in packets shifted to Q0 */
WebRtcSpl_DivW32W16ResW16(
(WebRtc_Word32) NetEqMainInst->MCUinst.BufferStat_inst.Automode_inst.packetSpeechLenSamp, /* samples per packet */
WebRtcSpl_DivW32W16ResW16( (WebRtc_Word32) NetEqMainInst->MCUinst.fs, (WebRtc_Word16) 1000 ) /* samples per ms */
) );
/* add extra delay */
if (NetEqMainInst->MCUinst.BufferStat_inst.Automode_inst.extraDelayMs > 0)
{
*preferredBufferSize
+= NetEqMainInst->MCUinst.BufferStat_inst.Automode_inst.extraDelayMs;
}
}
else
{
/* sample rate not initialized */
*preferredBufferSize = 0;
}
return (0);
}
/* Get the current buffer size in ms. Return value is 0 if ok, -1 if error. */
int WebRtcNetEQ_GetCurrentDelay(const void *inst, WebRtc_UWord16 *currentDelayMs)
{
WebRtc_Word32 temp32;
const MainInst_t *NetEqMainInst = (const MainInst_t*) inst;
/* Instance sanity */
if (NetEqMainInst == NULL) return (-1);
/*******************/
/* Get buffer size */
/*******************/
if (NetEqMainInst->MCUinst.fs != 0 && NetEqMainInst->MCUinst.fs <= WEBRTC_SPL_WORD16_MAX)
{
/* query packet buffer for number of samples */
temp32 = WebRtcNetEQ_PacketBufferGetSize(&NetEqMainInst->MCUinst.PacketBuffer_inst);
/* divide by sample rate */
*currentDelayMs = WebRtcSpl_DivW32W16ResW16(temp32 * 1000, /* multiply by 1000 to get ms */
(WebRtc_Word16) NetEqMainInst->MCUinst.fs); /* divide by fs in samples per second */
/* add number of samples yet to play in sync buffer */
temp32 = (WebRtc_Word32) (NetEqMainInst->DSPinst.endPosition
- NetEqMainInst->DSPinst.curPosition);
*currentDelayMs += WebRtcSpl_DivW32W16ResW16(temp32 * 1000, /* multiply by 1000 to get ms */
(WebRtc_Word16) NetEqMainInst->MCUinst.fs); /* divide by fs in samples per second */
}
else
{
/* sample rate not initialized */
*currentDelayMs = 0;
}
return 0;
}
/****************************************************************************
* WebRtcNetEQ_SetVADInstance(...)
*

View File

@ -35,11 +35,6 @@ public:
// The statistics are reset after the query.
virtual int GetNetworkStatistics(int channel, NetworkStatistics& stats) = 0;
// Get the optimal buffer size calculated for the current network
// conditions.
virtual int GetPreferredBufferSize(
int channel, unsigned short& preferredBufferSize) = 0;
protected:
VoENetEqStats() {}
virtual ~VoENetEqStats() {}

View File

@ -6134,15 +6134,6 @@ Channel::GetNetworkStatistics(NetworkStatistics& stats)
(ACMNetworkStatistics &)stats);
}
int
Channel::GetPreferredBufferSize(unsigned short& preferredBufferSize)
{
WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_instanceId,_channelId),
"Channel::GetPreferredBufferSize()");
return _audioCodingModule.PreferredBufferSize(
(WebRtc_UWord16 &)preferredBufferSize);
}
int
Channel::GetDelayEstimate(int& delayMs) const
{

View File

@ -243,7 +243,6 @@ public:
// VoENetEqStats
int GetNetworkStatistics(NetworkStatistics& stats);
int GetPreferredBufferSize(unsigned short& preferredBufferSize);
// VoEVideoSync
int GetDelayEstimate(int& delayMs) const;

View File

@ -95,33 +95,6 @@ int VoENetEqStatsImpl::GetNetworkStatistics(int channel,
return channelPtr->GetNetworkStatistics(stats);
}
int VoENetEqStatsImpl::GetPreferredBufferSize(
int channel,
unsigned short& preferredBufferSize)
{
WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_instanceId,-1),
"GetPreferredBufferSize(channel=%i, ?)", channel);
ANDROID_NOT_SUPPORTED();
IPHONE_NOT_SUPPORTED();
if (!_engineStatistics.Initialized())
{
_engineStatistics.SetLastError(VE_NOT_INITED, kTraceError);
return -1;
}
voe::ScopedChannel sc(_channelManager, channel);
voe::Channel* channelPtr = sc.ChannelPtr();
if (channelPtr == NULL)
{
_engineStatistics.SetLastError(
VE_CHANNEL_NOT_VALID, kTraceError,
"GetPreferredBufferSize() failed to locate channel");
return -1;
}
return channelPtr->GetPreferredBufferSize(preferredBufferSize);
}
#endif // #ifdef WEBRTC_VOICE_ENGINE_NETEQ_STATS_API
} // namespace webrtc

View File

@ -28,9 +28,6 @@ public:
virtual int GetNetworkStatistics(int channel,
NetworkStatistics& stats);
virtual int GetPreferredBufferSize(int channel,
unsigned short& preferredBufferSize);
protected:
VoENetEqStatsImpl();
virtual ~VoENetEqStatsImpl();

View File

@ -3594,10 +3594,6 @@ int VoETestManager::DoStandardTest()
nStats.currentPreemptiveRate);
TEST_LOG(" preferredBufferSize = %hu \n",
nStats.preferredBufferSize);
unsigned short preferredBufferSize;
TEST_MUSTPASS(neteqst->GetPreferredBufferSize(0, preferredBufferSize));
TEST_MUSTPASS(preferredBufferSize != nStats.preferredBufferSize);
#else
TEST_LOG("Skipping NetEQ statistics tests - "
"WEBRTC_VOICE_ENGINE_NETEQ_STATS_API not defined \n");