Take the buffer duration into account when deciding when to preload the next

song for gapless playback.
This commit is contained in:
David Sansome 2013-06-01 17:15:37 +10:00
parent ff71138079
commit 90898bd255
2 changed files with 7 additions and 4 deletions

View File

@ -616,7 +616,10 @@ void GstEngine::timerEvent(QTimerEvent* e) {
const qint64 remaining = current_length - current_position;
const qint64 fudge = kTimerIntervalNanosec + 100 * kNsecPerMsec; // Mmm fudge
const qint64 gap = autocrossfade_enabled_ ? fadeout_duration_nanosec_ : kPreloadGapNanosec;
const qint64 gap = buffer_duration_nanosec_ + (
autocrossfade_enabled_ ?
fadeout_duration_nanosec_ :
kPreloadGapNanosec);
// only if we know the length of the current stream...
if(current_length > 0) {

View File

@ -158,9 +158,9 @@ class GstEngine : public Engine::Base, public BufferConsumer {
static QUrl FixupUrl(const QUrl& url);
private:
static const int kTimerIntervalNanosec = 1000 * kNsecPerMsec; // 1s
static const int kPreloadGapNanosec = 1000 * kNsecPerMsec; // 1s
static const int kSeekDelayNanosec = 100 * kNsecPerMsec; // 100msec
static const qint64 kTimerIntervalNanosec = 1000 * kNsecPerMsec; // 1s
static const qint64 kPreloadGapNanosec = 1000 * kNsecPerMsec; // 1s
static const qint64 kSeekDelayNanosec = 100 * kNsecPerMsec; // 100msec
static const char* kHypnotoadPipeline;
static const char* kEnterprisePipeline;