Skip to content
Open
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
11 changes: 11 additions & 0 deletions src/server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,10 @@ void CServer::DecodeReceiveData ( const int iChanCnt, const int iNumClients )
else
{
CurOpusDecoder = nullptr;

// no codec yet (e.g. a new client in a reused channel): nothing writes this buffer, and it
// still holds the audio last decoded at this position in the connected-channel list
vecvecsData[iChanCnt].Reset ( 0 );
}

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

// the decoders belong to the channel, not the client, so drop this client's state
// before the next client in this channel is decoded
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