Skip to content

Commit 3ddf099

Browse files
committed
make raw audio optional at server
1 parent 289522e commit 3ddf099

3 files changed

Lines changed: 27 additions & 2 deletions

File tree

src/main.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ int main ( int argc, char** argv )
8787
bool bDisconnectAllClientsOnQuit = false;
8888
bool bUseDoubleSystemFrameSize = true; // default is 128 samples frame size
8989
bool bUseMultithreading = false;
90+
bool bDisableRaw = false;
9091
bool bShowAnalyzerConsole = false;
9192
bool bMuteStream = false;
9293
bool bMuteMeInPersonalMix = false;
@@ -478,6 +479,19 @@ int main ( int argc, char** argv )
478479
continue;
479480
}
480481

482+
// Disable raw audio feature -------------------------------------------
483+
if ( GetFlagArgument ( argv,
484+
i,
485+
"--noraw", // no short form
486+
"--noraw" ) )
487+
{
488+
bDisableRaw = true;
489+
qInfo() << "- raw audio is disabled";
490+
CommandLineOptions << "--noraw";
491+
ServerOnlyOptions << "--noraw";
492+
continue;
493+
}
494+
481495
// Client only:
482496

483497
// Connect on startup --------------------------------------------------
@@ -989,6 +1003,7 @@ int main ( int argc, char** argv )
9891003
strRecordingDirName,
9901004
bDisconnectAllClientsOnQuit,
9911005
bUseDoubleSystemFrameSize,
1006+
bDisableRaw,
9921007
bUseMultithreading,
9931008
bDisableRecording,
9941009
bDelayPan,
@@ -1115,6 +1130,7 @@ QString UsageArguments ( char** argv )
11151130
" -P, --delaypan start with delay panning enabled\n"
11161131
" -R, --recording set server recording directory; server will record when a session is active by default\n"
11171132
" --norecord set server not to record by default when recording is configured\n"
1133+
" --noraw disable raw audio\n"
11181134
" -s, --server start Server\n"
11191135
" --serverbindip IP address the Server will bind to (rather than all)\n"
11201136
" -T, --multithreading use multithreading to make better use of\n"

src/server.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ CServer::CServer ( const int iNewMaxNumChan,
4040
const QString& strRecordingDirName,
4141
const bool bNDisconnectAllClientsOnQuit,
4242
const bool bNUseDoubleSystemFrameSize,
43+
const bool bNDisableRaw,
4344
const bool bNUseMultithreading,
4445
const bool bDisableRecording,
4546
const bool bNDelayPan,
@@ -49,6 +50,7 @@ CServer::CServer ( const int iNewMaxNumChan,
4950
bUseMultithreading ( bNUseMultithreading ),
5051
iMaxNumChannels ( iNewMaxNumChan ),
5152
iCurNumChannels ( 0 ),
53+
bDisableRaw ( bNDisableRaw ),
5254
Socket ( this, iPortNumber, iQosNumber, strServerBindIP, bNEnableIPv6 ),
5355
Logging(),
5456
iFrameCount ( 0 ),
@@ -383,8 +385,11 @@ void CServer::OnNewConnection ( int iChID, int iTotChans, CHostAddress RecHostAd
383385
// must be the first message to be sent for a new connection)
384386
vecChannels[iChID].CreateClientIDMes ( iChID );
385387

386-
// inform the client that the server supports raw (uncompressed) audio
387-
vecChannels[iChID].CreateRawAudioSupportedMes();
388+
// if not disabled, inform the client that the server supports raw (uncompressed) audio
389+
if ( !bDisableRaw )
390+
{
391+
vecChannels[iChID].CreateRawAudioSupportedMes();
392+
}
388393

389394
// Send an empty channel list in order to force clients to reset their
390395
// audio mixer state. This is required to trigger clients to re-send their

src/server.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
100100
const QString& strRecordingDirName,
101101
const bool bNDisconnectAllClientsOnQuit,
102102
const bool bNUseDoubleSystemFrameSize,
103+
const bool bNDisableRaw,
103104
const bool bNUseMultithreading,
104105
const bool bDisableRecording,
105106
const bool bNDelayPan,
@@ -250,6 +251,9 @@ class CServer : public QObject, public CServerSlots<MAX_NUM_CHANNELS>
250251
CConvBuf<int16_t> DoubleFrameSizeConvBufIn[MAX_NUM_CHANNELS];
251252
CConvBuf<int16_t> DoubleFrameSizeConvBufOut[MAX_NUM_CHANNELS];
252253

254+
// needed for disabling raw audio transmission
255+
bool bDisableRaw;
256+
253257
CVector<QString> vstrChatColors;
254258
CVector<int> vecChanIDsCurConChan;
255259

0 commit comments

Comments
 (0)