From 5d8d6eecb2af504e2e446a8ce69611f757dc5b3f Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Mon, 3 Aug 2009 05:50:52 +0000 Subject: [PATCH] fix for auto jitter buffer setting --- src/client.cpp | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 8f061bbb..d37697f4 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -382,19 +382,16 @@ void CClient::ProcessAudioData ( CVector& vecsStereoSndCrd ) } } - // send it through the network -// Socket.SendPacket ( Channel.PrepSendPacket ( vecsNetwork ), -// Channel.GetAddress() ); - -celt_encode ( CeltEncoder, - &vecsNetwork[0], - NULL, - &vecCeltData[0], - iCeltNumCodedBytes ); - -Socket.SendPacket ( vecCeltData, Channel.GetAddress() ); - + // encode current audio frame with CELT encoder + celt_encode ( CeltEncoder, + &vecsNetwork[0], + NULL, + &vecCeltData[0], + iCeltNumCodedBytes ); + // send coded audio through the network + Socket.SendPacket ( Channel.PrepSendPacket ( vecCeltData ), + Channel.GetAddress() ); // receive a new block @@ -480,13 +477,8 @@ void CClient::UpdateSocketBufferSize() const double dHysteresis = 0.3; // calculate current buffer setting - // Use worst case scenario: We add the block size of input and - // output. This is not required if the smaller block size is a - // multiple of the bigger size, but in the general case where - // the block sizes do not have this relation, we require to have - // a minimum buffer size of the sum of both sizes const double dAudioBufferDurationMs = - ( 2 * iMonoBlockSizeSam ) * 1000 / SYSTEM_SAMPLE_RATE; + iMonoBlockSizeSam * 1000 / SYSTEM_SAMPLE_RATE; // accumulate the standard deviations of input network stream and // internal timer,