Unverified Commit ee1dbfec authored by Wolle's avatar Wolle Committed by GitHub

stopsong() if channels >2 or bps>16

parent 73afabe1
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Created on: Oct 26.2018 * Created on: Oct 26.2018
* *
* Version 3.0.2 * Version 3.0.2a
* Updated on: May 05.2023 * Updated on: May 07.2023
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
* *
*/ */
...@@ -3985,6 +3985,14 @@ void Audio::setDecoderItems(){ ...@@ -3985,6 +3985,14 @@ void Audio::setDecoderItems(){
setBitsPerSample(VORBISGetBitsPerSample()); setBitsPerSample(VORBISGetBitsPerSample());
setBitrate(VORBISGetBitRate()); setBitrate(VORBISGetBitRate());
} }
if(getBitsPerSample() !=8 && getBitsPerSample() != 16){
AUDIO_INFO("Bits per sample must be 8 or 16, found %i", getBitsPerSample());
stopSong();
}
if(getChannels() !=1 && getChannels() != 2){
AUDIO_INFO("Num of channels must be 1 or 2, found %i", getChannels());
stopSong();
}
showCodecParams(); showCodecParams();
} }
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
...@@ -4030,6 +4038,10 @@ int Audio::sendBytes(uint8_t* data, size_t len) { ...@@ -4030,6 +4038,10 @@ int Audio::sendBytes(uint8_t* data, size_t len) {
else { else {
printDecodeError(m_decodeError); printDecodeError(m_decodeError);
m_f_playing = false; // seek for new syncword m_f_playing = false; // seek for new syncword
if(m_codec == CODEC_FLAC){
if(m_decodeError == ERR_FLAC_BITS_PER_SAMPLE_TOO_BIG) stopSong();
if(m_decodeError == ERR_FLAC_RESERVED_CHANNEL_ASSIGNMENT) stopSong();
}
} }
return 1; // skip one byte and seek for the next sync word return 1; // skip one byte and seek for the next sync word
} }
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Created on: Oct 28,2018 * Created on: Oct 28,2018
* *
* Version 3.0.2 * Version 3.0.2a
* Updated on: May 05,2023 * Updated on: May 07,2023
* Author: Wolle (schreibfaul1) * Author: Wolle (schreibfaul1)
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment