summaryrefslogtreecommitdiff
path: root/libs/ardour/mp3fileimportable.cc
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2019-12-06 23:13:20 +0100
committerRobin Gareus <robin@gareus.org>2019-12-06 23:13:20 +0100
commit052f3a683676c4aee671b2c8d81ab4c8cba35ec1 (patch)
treec56255e6702872b26bfab8848a11f210ca76685c /libs/ardour/mp3fileimportable.cc
parent9aa887fa65590d235273cc3e8e440f091b9f0d07 (diff)
Speed up seeking in mp3s
Diffstat (limited to 'libs/ardour/mp3fileimportable.cc')
-rw-r--r--libs/ardour/mp3fileimportable.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/libs/ardour/mp3fileimportable.cc b/libs/ardour/mp3fileimportable.cc
index 202ad8493c..99fc0a6384 100644
--- a/libs/ardour/mp3fileimportable.cc
+++ b/libs/ardour/mp3fileimportable.cc
@@ -158,7 +158,12 @@ Mp3FileImportableSource::seek (samplepos_t pos)
}
while (_read_position + _n_frames <= pos) {
- if (!decode_mp3 ()) {
+ /* skip ahead, until the frame before the target,
+ * then start decoding. This provides sufficient
+ * context to prevent audible hiccups, while still
+ * providing fast and accurate seeking.
+ */
+ if (!decode_mp3 (_read_position + 3 * _n_frames <= pos)) {
break;
}
_read_position += _n_frames;