diff options
-rw-r--r-- | src/audio.c | 9 | ||||
-rw-r--r-- | src/outputBuffer.c | 2 |
2 files changed, 8 insertions, 3 deletions
diff --git a/src/audio.c b/src/audio.c index dfc209b32..dc5b26e50 100644 --- a/src/audio.c +++ b/src/audio.c @@ -62,8 +62,13 @@ void copyAudioFormat(AudioFormat * dest, AudioFormat * src) { memcpy(dest, src, sizeof(AudioFormat)); } -int cmpAudioFormat(AudioFormat * f1, AudioFormat * f2) { - return memcmp(f1, f2, sizeof(AudioFormat)); +int cmpAudioFormat(AudioFormat * f1, AudioFormat * f2) +{ + if (f1 && f2 && (f1->sampleRate == f2->sampleRate) && + (f1->bits == f2->bits) && + (f1->channels == f2->channels)) + return 0; + return 1; } extern AudioOutputPlugin alsaPlugin; diff --git a/src/outputBuffer.c b/src/outputBuffer.c index 46b98c479..f6c9e0ab6 100644 --- a/src/outputBuffer.c +++ b/src/outputBuffer.c @@ -74,7 +74,7 @@ int sendDataToOutputBuffer(OutputBuffer * cb, InputStream * inStream, static char * convBuffer = NULL; static long convBufferLen = 0; - if(memcmp(&(cb->audioFormat),&(dc->audioFormat),sizeof(AudioFormat))==0) + if(cmpAudioFormat(&(cb->audioFormat),&(dc->audioFormat))==0) { data = dataIn; datalen = dataInLen; |