Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,11 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients )
else
{
CurOpusDecoder = nullptr;

// no codec yet, so nothing below overwrites these buffers: clear them so that a new client
// does not inherit the audio of this channel's previous client (#3901)
vecvecsData[iChanCnt].Reset ( 0 );
Comment thread
mcfnord marked this conversation as resolved.
vecvecsData2[iChanCnt].Reset ( 0 );
}

// get gains and pannings of all connected channels, compacted to the
Expand Down Expand Up @@ -940,6 +945,13 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients )
{
emit ClientDisconnected ( iCurChanID ); // TODO do this outside the mutex lock?

// reset the decoders so that the next client in this channel does not continue
// the previous client's audio (#3901)
opus_custom_decoder_ctl ( OpusDecoderMono[iCurChanID], OPUS_RESET_STATE );
opus_custom_decoder_ctl ( OpusDecoderStereo[iCurChanID], OPUS_RESET_STATE );
opus_custom_decoder_ctl ( Opus64DecoderMono[iCurChanID], OPUS_RESET_STATE );
opus_custom_decoder_ctl ( Opus64DecoderStereo[iCurChanID], OPUS_RESET_STATE );

FreeChannel ( iCurChanID ); // note that the channel is now not in use

// note that no mutex is needed for this shared resource since it is a
Expand Down
Loading