Log error code if opus file cannot be opened

This commit is contained in:
Robert Müller 2024-04-25 20:27:49 +02:00
parent 51012bcc1b
commit cfb5b15222

View file

@ -341,7 +341,8 @@ void CSound::RateConvert(CSample &Sample) const
bool CSound::DecodeOpus(CSample &Sample, const void *pData, unsigned DataSize) const
{
OggOpusFile *pOpusFile = op_open_memory((const unsigned char *)pData, DataSize, nullptr);
int OpusError = 0;
OggOpusFile *pOpusFile = op_open_memory((const unsigned char *)pData, DataSize, &OpusError);
if(pOpusFile)
{
const int NumChannels = op_channel_count(pOpusFile, -1);
@ -380,7 +381,7 @@ bool CSound::DecodeOpus(CSample &Sample, const void *pData, unsigned DataSize) c
}
else
{
dbg_msg("sound/opus", "failed to decode sample");
dbg_msg("sound/opus", "failed to decode sample, error %d", OpusError);
return false;
}