diff --git a/ChangeLog b/ChangeLog index 8283ce6a..06b8482b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,8 @@ TODO #71 Increase "stability" of Connection Setup server list TODO update text in CAboutDlg +TODO mixer faders linear -> log gain is better + diff --git a/src/client.cpp b/src/client.cpp index 372088ae..70b5dd40 100755 --- a/src/client.cpp +++ b/src/client.cpp @@ -790,14 +790,14 @@ void CClient::Init() opus_custom_encoder_ctl ( OpusEncoderMono, OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( - iCeltNumCodedBytes ) ) ); + iCeltNumCodedBytes, SYSTEM_FRAME_SIZE_SAMPLES ) ) ); } else { opus_custom_encoder_ctl ( OpusEncoderStereo, OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( - iCeltNumCodedBytes ) ) ); + iCeltNumCodedBytes, SYSTEM_FRAME_SIZE_SAMPLES ) ) ); } // inits for network and channel @@ -1122,7 +1122,7 @@ void CClient::ProcessAudioDataIntern ( CVector& vecsStereoSndCrd ) /* // TEST -// fid=fopen('v.dat','r');x=fread(fid,'int16');fclose(fid); +// fid=fopen('c:\\temp\test2.dat','r');x=fread(fid,'int16');fclose(fid); static FILE* pFileDelay = fopen("c:\\temp\\test2.dat", "wb"); short sData[2]; for (i = 0; i < iMonoBlockSizeSam; i++) diff --git a/src/server.cpp b/src/server.cpp index 72ab96be..c0297ba1 100755 --- a/src/server.cpp +++ b/src/server.cpp @@ -1103,7 +1103,7 @@ JitterMeas.Measure(); // so for speed optimization it would be better to set it only if the network // frame size is changed opus_custom_encoder_ctl ( CurOpusEncoder, - OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes ) ) ); + OPUS_SET_BITRATE ( CalcBitRateBitsPerSecFromCodedBytes ( iCeltNumCodedBytes, iCurRawDataLen ) ) ); opus_custom_encode ( CurOpusEncoder, &vecsSendData[iB * SYSTEM_FRAME_SIZE_SAMPLES_SMALL * vecNumAudioChannels[i]], diff --git a/src/util.h b/src/util.h index 323f136d..e7dcbcfe 100755 --- a/src/util.h +++ b/src/util.h @@ -95,10 +95,10 @@ void DebugError ( const QString& pchErDescr, const double dPar2 ); // calculate the bit rate in bits per second from the number of coded bytes -inline int CalcBitRateBitsPerSecFromCodedBytes ( const int iCeltNumCodedBytes ) +inline int CalcBitRateBitsPerSecFromCodedBytes ( const int iCeltNumCodedBytes, + const int iFrameSize ) { - return ( SYSTEM_SAMPLE_RATE_HZ * iCeltNumCodedBytes * 8 ) / - SYSTEM_FRAME_SIZE_SAMPLES; + return ( SYSTEM_SAMPLE_RATE_HZ * iCeltNumCodedBytes * 8 ) / iFrameSize; }