summaryrefslogtreecommitdiff
path: root/libs/ardour/disk_reader.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2020-01-21 21:46:52 -0700
committerPaul Davis <paul@linuxaudiosystems.com>2020-01-21 21:50:35 -0700
commita765e52b47169a585993915c1725cf15e961ab59 (patch)
tree127c6b8e089c3f0baf67d2844bdd40babc947ec4 /libs/ardour/disk_reader.cc
parent981ee0060a0a65db30b9894c1461b07aacd18cc2 (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.cc11
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);