diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-02-20 00:21:31 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-02-20 00:21:31 -0700 |
commit | 40371629632c909259370bd0854ac77b73e0e206 (patch) | |
tree | 2d5e86c7441c3754aa76fa4372007610ccd75445 /libs | |
parent | e468e68c231dc4af2d1c9c59c558e47090a0f92b (diff) |
fix test to decide if we can skip disk buffer refill because we're close enough (read direction must match)
Diffstat (limited to 'libs')
-rw-r--r-- | libs/ardour/disk_reader.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index 856abf6361..fadd5c865b 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -745,13 +745,21 @@ DiskReader::seek (samplepos_t sample, bool complete_refill) return 0; } - if (sample == playback_sample && !complete_refill) { - return 0; - } + if (_last_read_reversed && (_last_read_reversed == read_reversed)) { - if (abs (sample - playback_sample) < (c->front()->rbuf->reserved_size() / 6)) { - /* we're close enough. Note: this is a heuristic */ - return 0; + /* We do these things only if we're still reading in the same + * direction we did last time. + */ + + if (sample == playback_sample && !complete_refill) { + + return 0; + } + + if (abs (sample - playback_sample) < (c->front()->rbuf->reserved_size() / 6)) { + /* we're close enough. Note: this is a heuristic */ + return 0; + } } g_atomic_int_set (&_pending_overwrite, 0); |