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>
This commit is contained in:
parent
54f6702fb2
commit
d1c6950ec6
1 changed files with 8 additions and 6 deletions
|
@ -455,7 +455,7 @@
|
||||||
|
|
||||||
// DLog(@"Revised: %i, %i", startingSample, sampleCount);
|
// DLog(@"Revised: %i, %i", startingSample, sampleCount);
|
||||||
|
|
||||||
_framesDecoded += _synth.pcm.length;
|
_framesDecoded += sampleCount;
|
||||||
|
|
||||||
if(_outputFrames > 0) {
|
if(_outputFrames > 0) {
|
||||||
DLog(@"LOSING FRAMES!");
|
DLog(@"LOSING FRAMES!");
|
||||||
|
@ -541,11 +541,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signed long frameDuration = mad_timer_count(_frame.header.duration, sampleRate);
|
if(!_firstFrame || !_foundXingHeader) {
|
||||||
if((framesToSkip - 1152 * 4) >= frameDuration) {
|
signed long frameDuration = mad_timer_count(_frame.header.duration, sampleRate);
|
||||||
framesToSkip -= frameDuration;
|
if((framesToSkip - 1152 * 4) >= frameDuration) {
|
||||||
_framesDecoded += frameDuration;
|
framesToSkip -= frameDuration;
|
||||||
return 0;
|
_framesDecoded += frameDuration;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// DLog(@"Decoded buffer.");
|
// DLog(@"Decoded buffer.");
|
||||||
|
|
Loading…
Reference in a new issue