make sure the OPUS encoder/decoder function is only called if the audio compression type is actually set to OPUS codec

This commit is contained in:
Volker Fischer 2014-07-28 17:46:54 +00:00
parent 0741b3c388
commit 26ccd51546
2 changed files with 24 additions and 12 deletions

View file

@ -1094,8 +1094,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_encode ( OpusEncoderMono, opus_custom_encode ( OpusEncoderMono,
&vecsStereoSndCrd[i * SYSTEM_FRAME_SIZE_SAMPLES], &vecsStereoSndCrd[i * SYSTEM_FRAME_SIZE_SAMPLES],
@ -1116,8 +1117,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
&vecCeltData[0], &vecCeltData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_encode ( OpusEncoderStereo, opus_custom_encode ( OpusEncoderStereo,
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES], &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES],
@ -1164,8 +1166,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderMono, opus_custom_decode ( OpusDecoderMono,
&vecbyNetwData[0], &vecbyNetwData[0],
@ -1184,8 +1187,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderStereo, opus_custom_decode ( OpusDecoderStereo,
&vecbyNetwData[0], &vecbyNetwData[0],
@ -1208,8 +1212,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
0, 0,
&vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsAudioSndCrdMono[i * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderMono, opus_custom_decode ( OpusDecoderMono,
NULL, NULL,
@ -1228,8 +1233,9 @@ void CClient::ProcessAudioDataIntern ( CVector<int16_t>& vecsStereoSndCrd )
0, 0,
&vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] ); &vecsStereoSndCrd[i * 2 * SYSTEM_FRAME_SIZE_SAMPLES] );
} }
else
#endif #endif
if ( eAudioCompressionType == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderStereo, opus_custom_decode ( OpusDecoderStereo,
NULL, NULL,

View file

@ -759,8 +759,9 @@ void CServer::OnTimer()
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderMono[iCurChanID], opus_custom_decode ( OpusDecoderMono[iCurChanID],
&vecbyCodedData[0], &vecbyCodedData[0],
@ -780,8 +781,9 @@ void CServer::OnTimer()
iCeltNumCodedBytes, iCeltNumCodedBytes,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderStereo[iCurChanID], opus_custom_decode ( OpusDecoderStereo[iCurChanID],
&vecbyCodedData[0], &vecbyCodedData[0],
@ -805,8 +807,9 @@ void CServer::OnTimer()
0, 0,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderMono[iCurChanID], opus_custom_decode ( OpusDecoderMono[iCurChanID],
NULL, NULL,
@ -826,8 +829,9 @@ void CServer::OnTimer()
0, 0,
&vecvecsData[i][0] ); &vecvecsData[i][0] );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
opus_custom_decode ( OpusDecoderStereo[iCurChanID], opus_custom_decode ( OpusDecoderStereo[iCurChanID],
NULL, NULL,
@ -888,8 +892,9 @@ void CServer::OnTimer()
&vecbyCodedData[0], &vecbyCodedData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
// TODO find a better place than this: the setting does not change all the time // TODO find a better place than this: the setting does not change all the time
@ -917,8 +922,9 @@ opus_custom_encoder_ctl ( OpusEncoderMono[iCurChanID],
&vecbyCodedData[0], &vecbyCodedData[0],
iCeltNumCodedBytes ); iCeltNumCodedBytes );
} }
else
#endif #endif
if ( vecChannels[iCurChanID].GetAudioCompressionType() == CT_OPUS )
{ {
// TODO find a better place than this: the setting does not change all the time // TODO find a better place than this: the setting does not change all the time