just cranked down the bitrate a good amount
This commit is contained in:
parent
59fbf67c4a
commit
e6fb78cdf9
@ -55,7 +55,6 @@
|
|||||||
// sensible limit of 8 packets per frame = 552 bytes -> 185.76ms of voice data per frame
|
// sensible limit of 8 packets per frame = 552 bytes -> 185.76ms of voice data per frame
|
||||||
//#define NET_MAX_VOICE_BYTES_FRAME (8 * (5 + 64))
|
//#define NET_MAX_VOICE_BYTES_FRAME (8 * (5 + 64))
|
||||||
#define NET_MAX_VOICE_BYTES_FRAME (10 * (5 + 64))
|
#define NET_MAX_VOICE_BYTES_FRAME (10 * (5 + 64))
|
||||||
#define NET_MAX_VOICE_BYTES_FRAME_TORCHLIGHT (22 * (5 + 64))
|
|
||||||
|
|
||||||
ConVar g_SmVoiceAddr("sm_voice_addr", "127.0.0.1", FCVAR_PROTECTED, "Voice server listen ip address.");
|
ConVar g_SmVoiceAddr("sm_voice_addr", "127.0.0.1", FCVAR_PROTECTED, "Voice server listen ip address.");
|
||||||
ConVar g_SmVoicePort("sm_voice_port", "27020", FCVAR_PROTECTED, "Voice server listen port.", true, 1025.0, true, 65535.0);
|
ConVar g_SmVoicePort("sm_voice_port", "27020", FCVAR_PROTECTED, "Voice server listen port.", true, 1025.0, true, 65535.0);
|
||||||
@ -140,7 +139,7 @@ int g_aFrameVoiceBytes[SM_MAXPLAYERS + 1];
|
|||||||
|
|
||||||
DETOUR_DECL_STATIC4(SV_BroadcastVoiceData, void, IClient *, pClient, int, nBytes, char *, data, int64, xuid)
|
DETOUR_DECL_STATIC4(SV_BroadcastVoiceData, void, IClient *, pClient, int, nBytes, char *, data, int64, xuid)
|
||||||
{
|
{
|
||||||
if(g_Interface.OnBroadcastVoiceData(pClient, nBytes, data, false))
|
if(g_Interface.OnBroadcastVoiceData(pClient, nBytes, data))
|
||||||
DETOUR_STATIC_CALL(SV_BroadcastVoiceData)(pClient, nBytes, data, xuid);
|
DETOUR_STATIC_CALL(SV_BroadcastVoiceData)(pClient, nBytes, data, xuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +152,7 @@ DETOUR_DECL_STATIC2(SV_BroadcastVoiceData_LTCG, void, char *, data, int64, xuid)
|
|||||||
__asm mov pClient, ecx;
|
__asm mov pClient, ecx;
|
||||||
__asm mov nBytes, edx;
|
__asm mov nBytes, edx;
|
||||||
|
|
||||||
bool ret = g_Interface.OnBroadcastVoiceData(pClient, nBytes, data, false);
|
bool ret = g_Interface.OnBroadcastVoiceData(pClient, nBytes, data);
|
||||||
|
|
||||||
__asm mov ecx, pClient;
|
__asm mov ecx, pClient;
|
||||||
__asm mov edx, nBytes;
|
__asm mov edx, nBytes;
|
||||||
@ -310,7 +309,7 @@ bool CVoice::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_BITRATE(510000));
|
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_BITRATE(128000));
|
||||||
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND));
|
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_BANDWIDTH(OPUS_BANDWIDTH_FULLBAND));
|
||||||
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC)); //MDCT mode
|
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_SIGNAL(OPUS_SIGNAL_MUSIC)); //MDCT mode
|
||||||
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_LSB_DEPTH(16));
|
opus_encoder_ctl(m_OpusEncoder, OPUS_SET_LSB_DEPTH(16));
|
||||||
@ -490,7 +489,7 @@ void CVoice::OnGameFrame(bool simulating)
|
|||||||
memset(g_aFrameVoiceBytes, 0, sizeof(g_aFrameVoiceBytes));
|
memset(g_aFrameVoiceBytes, 0, sizeof(g_aFrameVoiceBytes));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CVoice::OnBroadcastVoiceData(IClient *pClient, int nBytes, char *data, bool isSourceTV)
|
bool CVoice::OnBroadcastVoiceData(IClient *pClient, int nBytes, char *data)
|
||||||
{
|
{
|
||||||
// Reject empty packets
|
// Reject empty packets
|
||||||
if(nBytes < 1)
|
if(nBytes < 1)
|
||||||
@ -502,18 +501,10 @@ bool CVoice::OnBroadcastVoiceData(IClient *pClient, int nBytes, char *data, bool
|
|||||||
// 5 = SVC_VoiceData header/overhead
|
// 5 = SVC_VoiceData header/overhead
|
||||||
g_aFrameVoiceBytes[client] += 5 + nBytes;
|
g_aFrameVoiceBytes[client] += 5 + nBytes;
|
||||||
|
|
||||||
if (!isSourceTV && g_aFrameVoiceBytes[client] > NET_MAX_VOICE_BYTES_FRAME)
|
if (g_aFrameVoiceBytes[client] > NET_MAX_VOICE_BYTES_FRAME)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isSourceTV)
|
|
||||||
{
|
|
||||||
if (g_aFrameVoiceBytes[client] > NET_MAX_VOICE_BYTES_FRAME_TORCHLIGHT)
|
|
||||||
{
|
|
||||||
smutils->LogMessage(myself, "inside interface BroadcastVoiceData with torchlight. g_aFrameVoiceBytes[client]: %d. NET_MAX_VOICE_BYTES_FRAME_TORCHLIGHT: %d", g_aFrameVoiceBytes[client], NET_MAX_VOICE_BYTES_FRAME_TORCHLIGHT);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_fLastVoiceData[client] = gpGlobals->curtime;
|
g_fLastVoiceData[client] = gpGlobals->curtime;
|
||||||
|
|
||||||
@ -711,7 +702,7 @@ void CVoice::HandleVoiceData()
|
|||||||
if(!FramesAvailable)
|
if(!FramesAvailable)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//int FramesMax = 5; //used to be 5
|
//int FramesMax = 5;
|
||||||
int FramesMax = 2; //used to be 5
|
int FramesMax = 2; //used to be 5
|
||||||
bool reset_state = false;
|
bool reset_state = false;
|
||||||
if (FramesAvailable <= FramesMax)
|
if (FramesAvailable <= FramesMax)
|
||||||
@ -842,9 +833,6 @@ void CVoice::BroadcastVoiceData(IClient *pClient, int nBytes, unsigned char *pDa
|
|||||||
|
|
||||||
DETOUR_STATIC_CALL(SV_BroadcastVoiceData_LTCG)((char *)pData, 0);
|
DETOUR_STATIC_CALL(SV_BroadcastVoiceData_LTCG)((char *)pData, 0);
|
||||||
#else
|
#else
|
||||||
if (g_Interface.OnBroadcastVoiceData(pClient, nBytes, (char *)pData, true))
|
DETOUR_STATIC_CALL(SV_BroadcastVoiceData)(pClient, nBytes, (char *)pData, 0);
|
||||||
{
|
|
||||||
DETOUR_STATIC_CALL(SV_BroadcastVoiceData)(pClient, nBytes, (char *)pData, 0);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
@ -136,7 +136,7 @@ public: // IConCommandBaseAccessor
|
|||||||
public:
|
public:
|
||||||
CVoice();
|
CVoice();
|
||||||
void OnGameFrame(bool simulating);
|
void OnGameFrame(bool simulating);
|
||||||
bool OnBroadcastVoiceData(IClient *pClient, int nBytes, char *data, bool isSourceTV);
|
bool OnBroadcastVoiceData(IClient *pClient, int nBytes, char *data);
|
||||||
|
|
||||||
void ListenSocket();
|
void ListenSocket();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user