decoder/Bridge: truncate last chunk at the exact end_time

Instead of passing whole chunks to the MusicPipe and checking the
end_time after each chunk, truncate the last chunk if it would exceed
the end_time.  This requires keeping track of the absolute PCM frame
number.

This fixes a problem with gapless CUE song transitions: a small part
of the following song was always played twice.

Closes #113
This commit is contained in:
Max Kellermann
2018-02-17 13:10:00 +01:00
parent c43ea74b30
commit 986ec877b0
3 changed files with 35 additions and 7 deletions

View File

@@ -49,6 +49,11 @@ public:
*/
double timestamp = 0;
/**
* The time stamp of the next data chunk, in PCM frames.
*/
uint64_t absolute_frame = 0;
/**
* Is the initial seek (to the start position of the sub-song)
* pending, or has it been performed already?