In the jukebox.c example of libspotify I count all frames of the current track in the music_delivery
callback. When end_of_track
is called the frames count is different each time I played the same track. So end_of_track
is called several seconds after the song is over. And this timespan differs for each playback.
How can I determine if the song is really over? Do I have to take the duration of the song in seconds and multiply it with the sample rate to take care when the song is over?
Why are more frames delivered than necessary for the track? And why is end_of_track
not called on the real end of it? Or I am missing something?