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

fix setFilePos() if bitrate==0

parent b44c54cb
......@@ -2,7 +2,7 @@
* Audio.cpp
*
* Created on: Oct 26,2018
* Updated on: May 15,2021
* Updated on: May 19,2021
* Author: Wolle (schreibfaul1)
*
*/
......@@ -3413,7 +3413,7 @@ bool Audio::setTimeOffset(int sec){
//---------------------------------------------------------------------------------------------------------------------
bool Audio::setFilePos(uint32_t pos) {
if(!audiofile) return false;
if(!m_avr_bitrate) return false;
// if(!m_avr_bitrate) return false;
if(m_codec == CODEC_M4A) return false;
m_f_playing = false;
if(m_codec == CODEC_MP3) MP3Decoder_ClearBuffer();
......@@ -3421,7 +3421,7 @@ bool Audio::setFilePos(uint32_t pos) {
if(m_codec == CODEC_FLAC) FLACDecoderReset();
InBuff.resetBuffer();
if(pos < m_audioDataStart) pos = m_audioDataStart; // issue #96
m_audioCurrentTime = (pos-m_audioDataStart) * 8 / m_avr_bitrate; // #96
if(m_avr_bitrate) m_audioCurrentTime = (pos-m_audioDataStart) * 8 / m_avr_bitrate; // #96
return audiofile.seek(pos);
}
//---------------------------------------------------------------------------------------------------------------------
......
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