-
Notifications
You must be signed in to change notification settings - Fork 247
[WIP] Use unused bytes in CNetworkTransportProps for EAudioQuality (backwards compatible) #3898
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dingodoppelt
wants to merge
2
commits into
jamulussoftware:main
Choose a base branch
from
dingodoppelt:unused_bytes
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+21
−3
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -183,6 +183,7 @@ CServer::CServer ( const int iNewMaxNumChan, | |
| vecNumFrameSizeConvBlocks.Init ( iMaxNumChannels ); | ||
| vecUseDoubleSysFraSizeConvBuf.Init ( iMaxNumChannels ); | ||
| vecAudioComprType.Init ( iMaxNumChannels ); | ||
| vecAudioCodingArg.Init ( iMaxNumChannels ); | ||
|
|
||
| for ( i = 0; i < iMaxNumChannels; i++ ) | ||
| { | ||
|
|
@@ -844,6 +845,7 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients ) | |
| // get and store number of audio channels and compression type | ||
| vecNumAudioChannels[iChanCnt] = vecChannels[iCurChanID].GetNumAudioChannels(); | ||
| vecAudioComprType[iChanCnt] = vecChannels[iCurChanID].GetAudioCompressionType(); | ||
| vecAudioCodingArg[iChanCnt] = vecChannels[iCurChanID].GetAudioCodingArg(); | ||
|
|
||
| // get info about required frame size conversion properties | ||
| vecUseDoubleSysFraSizeConvBuf[iChanCnt] = ( !bUseDoubleSystemFrameSize && ( vecAudioComprType[iChanCnt] == CT_OPUS ) ); | ||
|
|
@@ -964,6 +966,7 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients ) | |
| pCurCodedData = nullptr; | ||
| } | ||
|
|
||
| //### DEPRECATED: BEGIN ###// | ||
| // Recognise a raw audio packet by its size: | ||
| // The client doesn't pass a value for the selected audio quality implicitly. | ||
| // Rather the server is passed the length of the data sent by the client in iClientFrameSizeSamples. | ||
|
|
@@ -973,8 +976,12 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients ) | |
| // iNumAudioChannels is either 1 for mono or 2 for stereo and mono-in/stereo-out | ||
| // sizeof ( int16_t ) is the size in bytes for the raw pcm audio data = 2 | ||
| // Sizes other than that are considered OPUS coded because those depend on hardcoded sizes in client.h | ||
| //### DEPRECATED: END ###// | ||
| // The client sent its audio quality setting. Check if raw audio was set | ||
| // for backwards compatibility the size check is left in, see above | ||
| const bool bIsRawAudio = | ||
| ( iCeltNumCodedBytes == static_cast<int> ( sizeof ( int16_t ) * iClientFrameSizeSamples * vecNumAudioChannels[iChanCnt] ) ); | ||
| ( vecAudioCodingArg[iChanCnt] == AQ_RAW || | ||
| iCeltNumCodedBytes == static_cast<int> ( sizeof ( int16_t ) * iClientFrameSizeSamples * vecNumAudioChannels[iChanCnt] ) ); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I left this in for backwards compatibility. We could deprecate this with a |
||
|
|
||
| const int iOffset = iB * SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[iChanCnt]; | ||
|
|
||
|
|
@@ -1249,6 +1256,9 @@ void CServer::MixEncodeTransmitData ( const int iChanCnt, const int iNumClients | |
| } | ||
| } | ||
|
|
||
| // Check if the client wants raw audio rather than guessing by packet sizes | ||
| const bool bWantsRawAudio = vecAudioCodingArg[iChanCnt] == AQ_RAW; | ||
|
|
||
| // If the server frame size is smaller than the received OPUS frame size, we need a conversion | ||
| // buffer which stores the large buffer. | ||
| // Note that we have a shortcut here. If the conversion buffer is not needed, the boolean flag | ||
|
|
@@ -1263,7 +1273,8 @@ void CServer::MixEncodeTransmitData ( const int iChanCnt, const int iNumClients | |
| DoubleFrameSizeConvBufOut[iCurChanID].GetAll ( vecsSendData, DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES * vecNumAudioChannels[iChanCnt] ); | ||
| } | ||
|
|
||
| if ( iCeltNumCodedBytes != static_cast<int> ( sizeof ( int16_t ) * iClientFrameSizeSamples * vecNumAudioChannels[iChanCnt] ) ) | ||
| if ( !bWantsRawAudio && | ||
| iCeltNumCodedBytes != static_cast<int> ( sizeof ( int16_t ) * iClientFrameSizeSamples * vecNumAudioChannels[iChanCnt] ) ) | ||
| { | ||
| // OPUS encoding | ||
| if ( CurOpusEncoder != nullptr ) | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the server aware of the audio quality set in the client. Before that we had to guess by the packet sizes.