diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-21 21:46:52 -0700 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2020-01-21 21:50:35 -0700 |
commit | a765e52b47169a585993915c1725cf15e961ab59 (patch) | |
tree | 127c6b8e089c3f0baf67d2844bdd40babc947ec4 /libs/ardour/disk_reader.cc | |
parent | 981ee0060a0a65db30b9894c1461b07aacd18cc2 (diff) |
add a heuristic to avoid refilling playback buffers at transport stop
If we're within 1/6th of the size of the reserved buffer of the target sample, no need to refill
Diffstat (limited to 'libs/ardour/disk_reader.cc')
-rw-r--r-- | libs/ardour/disk_reader.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/ardour/disk_reader.cc b/libs/ardour/disk_reader.cc index f792c48784..41d4d24f29 100644 --- a/libs/ardour/disk_reader.cc +++ b/libs/ardour/disk_reader.cc @@ -740,8 +740,17 @@ DiskReader::seek (samplepos_t sample, bool complete_refill) ChannelList::iterator chan; boost::shared_ptr<ChannelList> c = channels.reader(); + if (c->empty()) { + return 0; + } + if (sample == playback_sample && !complete_refill) { - return 0; // XXX double-check this + 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); |