MAD Input: Further gapless decoding and seek fixes
This time, a two-fer. First, ensure that file start seeking still skips over the Xing/LAME header packet properly. Then, ensure that decoding the last desired packet of the file does not indicate having decoded more sample data than desired, which may have caused errors when resuming playback position on restart and then smoothly transitioning to the next track. Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
54f6702fb2
commit
d1c6950ec6
|
@ -455,7 +455,7 @@
|
|||
|
||||
// DLog(@"Revised: %i, %i", startingSample, sampleCount);
|
||||
|
||||
_framesDecoded += _synth.pcm.length;
|
||||
_framesDecoded += sampleCount;
|
||||
|
||||
if(_outputFrames > 0) {
|
||||
DLog(@"LOSING FRAMES!");
|
||||
|
@ -541,11 +541,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
signed long frameDuration = mad_timer_count(_frame.header.duration, sampleRate);
|
||||
if((framesToSkip - 1152 * 4) >= frameDuration) {
|
||||
framesToSkip -= frameDuration;
|
||||
_framesDecoded += frameDuration;
|
||||
return 0;
|
||||
if(!_firstFrame || !_foundXingHeader) {
|
||||
signed long frameDuration = mad_timer_count(_frame.header.duration, sampleRate);
|
||||
if((framesToSkip - 1152 * 4) >= frameDuration) {
|
||||
framesToSkip -= frameDuration;
|
||||
_framesDecoded += frameDuration;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// DLog(@"Decoded buffer.");
|
||||
|
|
Loading…
Reference in New Issue